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

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

Issue 6899055: PPAPI: Force async callback invocation option. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months 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_surface_3d_proxy.cc ('k') | ppapi/tests/arch_dependent_sizes_32.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 // This heap object will get deleted by the callback handler. 510 // This heap object will get deleted by the callback handler.
511 // TODO(brettw) this will be leaked if the plugin closes the resource! 511 // TODO(brettw) this will be leaked if the plugin closes the resource!
512 // (Also including the plugin unloading and having the resource implicitly 512 // (Also including the plugin unloading and having the resource implicitly
513 // destroyed. Depending on the cleanup ordering, we may not need the weak 513 // destroyed. Depending on the cleanup ordering, we may not need the weak
514 // pointer here.) 514 // pointer here.)
515 ReadCallbackInfo* info = new ReadCallbackInfo; 515 ReadCallbackInfo* info = new ReadCallbackInfo;
516 info->resource = loader; 516 info->resource = loader;
517 // TODO(brettw) have a way to check for out-of-memory. 517 // TODO(brettw) have a way to check for out-of-memory.
518 info->read_buffer.resize(bytes_to_read); 518 info->read_buffer.resize(bytes_to_read);
519 519
520 CompletionCallback callback = callback_factory_.NewCallback( 520 CompletionCallback callback = callback_factory_.NewOptionalCallback(
521 &PPB_URLLoader_Proxy::OnReadCallback, info); 521 &PPB_URLLoader_Proxy::OnReadCallback, info);
522 522
523 EnterHostFromHostResource<PPB_URLLoader_API> enter(loader); 523 EnterHostFromHostResource<PPB_URLLoader_API> enter(loader);
524 int32_t result = PP_ERROR_BADRESOURCE; 524 int32_t result = PP_ERROR_BADRESOURCE;
525 if (enter.succeeded()) { 525 if (enter.succeeded()) {
526 result = enter.object()->ReadResponseBody( 526 result = enter.object()->ReadResponseBody(
527 const_cast<char*>(info->read_buffer.c_str()), 527 const_cast<char*>(info->read_buffer.c_str()),
528 bytes_to_read, callback.pp_completion_callback()); 528 bytes_to_read, callback.pp_completion_callback());
529 } 529 }
530 if (result != PP_OK_COMPLETIONPENDING) { 530 if (result != PP_OK_COMPLETIONPENDING) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 info->read_buffer.resize(bytes_read); 586 info->read_buffer.resize(bytes_read);
587 587
588 dispatcher()->Send(new PpapiMsg_PPBURLLoader_ReadResponseBody_Ack( 588 dispatcher()->Send(new PpapiMsg_PPBURLLoader_ReadResponseBody_Ack(
589 INTERFACE_ID_PPB_URL_LOADER, info->resource, result, info->read_buffer)); 589 INTERFACE_ID_PPB_URL_LOADER, info->resource, result, info->read_buffer));
590 590
591 delete info; 591 delete info;
592 } 592 }
593 593
594 } // namespace proxy 594 } // namespace proxy
595 } // namespace pp 595 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_surface_3d_proxy.cc ('k') | ppapi/tests/arch_dependent_sizes_32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698