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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 if (result > bytes_to_return) { | 333 if (result > bytes_to_return) { |
334 // Save what remains to be copied when ReadResponseBody is called again. | 334 // Save what remains to be copied when ReadResponseBody is called again. |
335 buffer_.insert(buffer_.end(), | 335 buffer_.insert(buffer_.end(), |
336 data + bytes_to_return, | 336 data + bytes_to_return, |
337 data + result); | 337 data + result); |
338 } | 338 } |
339 | 339 |
340 result = bytes_to_return; | 340 result = bytes_to_return; |
341 } | 341 } |
342 | 342 |
343 TrackedCallback::ClearAndRun(¤t_callback_, result); | 343 current_callback_->Run(result); |
344 } | 344 } |
345 | 345 |
346 void URLLoader::CallbackComplete(int32_t result) { | 346 void URLLoader::CallbackComplete(int32_t result) { |
347 TrackedCallback::ClearAndRun(¤t_callback_, result); | 347 current_callback_->Run(result); |
348 } | 348 } |
349 | 349 |
350 void URLLoader::PopBuffer(void* output_buffer, int32_t output_size) { | 350 void URLLoader::PopBuffer(void* output_buffer, int32_t output_size) { |
351 CHECK(output_size <= static_cast<int32_t>(buffer_.size())); | 351 CHECK(output_size <= static_cast<int32_t>(buffer_.size())); |
352 std::copy(buffer_.begin(), | 352 std::copy(buffer_.begin(), |
353 buffer_.begin() + output_size, | 353 buffer_.begin() + output_size, |
354 static_cast<char*>(output_buffer)); | 354 static_cast<char*>(output_buffer)); |
355 buffer_.erase(buffer_.begin(), | 355 buffer_.erase(buffer_.begin(), |
356 buffer_.begin() + output_size); | 356 buffer_.begin() + output_size); |
357 } | 357 } |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 } | 612 } |
613 | 613 |
614 void PPB_URLLoader_Proxy::OnCallback(int32_t result, | 614 void PPB_URLLoader_Proxy::OnCallback(int32_t result, |
615 const HostResource& resource) { | 615 const HostResource& resource) { |
616 dispatcher()->Send(new PpapiMsg_PPBURLLoader_CallbackComplete( | 616 dispatcher()->Send(new PpapiMsg_PPBURLLoader_CallbackComplete( |
617 API_ID_PPB_URL_LOADER, resource, result)); | 617 API_ID_PPB_URL_LOADER, resource, result)); |
618 } | 618 } |
619 | 619 |
620 } // namespace proxy | 620 } // namespace proxy |
621 } // namespace ppapi | 621 } // namespace ppapi |
OLD | NEW |