Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: ppapi/proxy/ppb_url_loader_proxy.cc

Issue 10909244: PPAPI: Get TrackedCallback ready for running on non-main threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_tcp_server_socket_private_proxy.cc ('k') | ppapi/proxy/printing_resource.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(&current_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(&current_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
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
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_tcp_server_socket_private_proxy.cc ('k') | ppapi/proxy/printing_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698