OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/proxy/ppb_url_loader_proxy.h" | 5 #include "ppapi/proxy/ppb_url_loader_proxy.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 if (result > bytes_to_return) { | 344 if (result > bytes_to_return) { |
345 // Save what remains to be copied when ReadResponseBody is called again. | 345 // Save what remains to be copied when ReadResponseBody is called again. |
346 buffer_.insert(buffer_.end(), | 346 buffer_.insert(buffer_.end(), |
347 data + bytes_to_return, | 347 data + bytes_to_return, |
348 data + result); | 348 data + result); |
349 } | 349 } |
350 | 350 |
351 result = bytes_to_return; | 351 result = bytes_to_return; |
352 } | 352 } |
353 | 353 |
354 TrackedCallback::ClearAndRun(¤t_callback_, result); | 354 current_callback_->Run(result); |
355 } | 355 } |
356 | 356 |
357 void URLLoader::CallbackComplete(int32_t result) { | 357 void URLLoader::CallbackComplete(int32_t result) { |
358 TrackedCallback::ClearAndRun(¤t_callback_, result); | 358 current_callback_->Run(result); |
359 } | 359 } |
360 | 360 |
361 void URLLoader::PopBuffer(void* output_buffer, int32_t output_size) { | 361 void URLLoader::PopBuffer(void* output_buffer, int32_t output_size) { |
362 CHECK(output_size <= static_cast<int32_t>(buffer_.size())); | 362 CHECK(output_size <= static_cast<int32_t>(buffer_.size())); |
363 std::copy(buffer_.begin(), | 363 std::copy(buffer_.begin(), |
364 buffer_.begin() + output_size, | 364 buffer_.begin() + output_size, |
365 static_cast<char*>(output_buffer)); | 365 static_cast<char*>(output_buffer)); |
366 buffer_.erase(buffer_.begin(), | 366 buffer_.erase(buffer_.begin(), |
367 buffer_.begin() + output_size); | 367 buffer_.begin() + output_size); |
368 } | 368 } |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 } | 615 } |
616 | 616 |
617 void PPB_URLLoader_Proxy::OnCallback(int32_t result, | 617 void PPB_URLLoader_Proxy::OnCallback(int32_t result, |
618 const HostResource& resource) { | 618 const HostResource& resource) { |
619 dispatcher()->Send(new PpapiMsg_PPBURLLoader_CallbackComplete( | 619 dispatcher()->Send(new PpapiMsg_PPBURLLoader_CallbackComplete( |
620 API_ID_PPB_URL_LOADER, resource, result)); | 620 API_ID_PPB_URL_LOADER, resource, result)); |
621 } | 621 } |
622 | 622 |
623 } // namespace proxy | 623 } // namespace proxy |
624 } // namespace ppapi | 624 } // namespace ppapi |
OLD | NEW |