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

Side by Side Diff: remoting/client/plugin/pepper_port_allocator_session.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/thunk/ppb_video_decoder_thunk.cc ('k') | no next file » | 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 "remoting/client/plugin/pepper_port_allocator_session.h" 5 #include "remoting/client/plugin/pepper_port_allocator_session.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Grant access to external origins. 114 // Grant access to external origins.
115 const struct PPB_URLLoaderTrusted* trusted_loader_interface = 115 const struct PPB_URLLoaderTrusted* trusted_loader_interface =
116 reinterpret_cast<const PPB_URLLoaderTrusted*>( 116 reinterpret_cast<const PPB_URLLoaderTrusted*>(
117 PPP_GetBrowserInterface(PPB_URLLOADERTRUSTED_INTERFACE)); 117 PPP_GetBrowserInterface(PPB_URLLOADERTRUSTED_INTERFACE));
118 trusted_loader_interface->GrantUniversalAccess( 118 trusted_loader_interface->GrantUniversalAccess(
119 loader_.pp_resource()); 119 loader_.pp_resource());
120 120
121 fetch_callback_.reset(fetch_callback); 121 fetch_callback_.reset(fetch_callback);
122 122
123 pp::CompletionCallback callback = 123 pp::CompletionCallback callback =
124 callback_factory_.NewCallback(&PepperURLFetcher::DidOpen); 124 callback_factory_.NewOptionalCallback(&PepperURLFetcher::DidOpen);
125 int rv = loader_.Open(request, callback); 125 int rv = loader_.Open(request, callback);
126 if (rv != PP_OK_COMPLETIONPENDING) 126 if (rv != PP_OK_COMPLETIONPENDING)
127 callback.Run(rv); 127 callback.Run(rv);
128 } 128 }
129 129
130 private: 130 private:
131 void ReadMore() { 131 void ReadMore() {
132 pp::CompletionCallback callback = 132 pp::CompletionCallback callback =
133 callback_factory_.NewCallback(&PepperURLFetcher::DidRead); 133 callback_factory_.NewOptionalCallback(&PepperURLFetcher::DidRead);
134 int rv = loader_.ReadResponseBody(buf_, sizeof(buf_), callback); 134 int rv = loader_.ReadResponseBody(buf_, sizeof(buf_), callback);
135 if (rv != PP_OK_COMPLETIONPENDING) 135 if (rv != PP_OK_COMPLETIONPENDING)
136 callback.Run(rv); 136 callback.Run(rv);
137 } 137 }
138 138
139 void DidOpen(int32_t result) { 139 void DidOpen(int32_t result) {
140 if (result == PP_OK) { 140 if (result == PP_OK) {
141 ReadMore(); 141 ReadMore();
142 } else { 142 } else {
143 DidFinish(result); 143 DidFinish(result);
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 config->AddRelay(ports, 0.0f); 411 config->AddRelay(ports, 0.0f);
412 ConfigReady(config); 412 ConfigReady(config);
413 } 413 }
414 414
415 PortAllocatorSessionFactory* CreatePepperPortAllocatorSessionFactory( 415 PortAllocatorSessionFactory* CreatePepperPortAllocatorSessionFactory(
416 ChromotingInstance* instance) { 416 ChromotingInstance* instance) {
417 return new SessionFactory(instance, MessageLoop::current()); 417 return new SessionFactory(instance, MessageLoop::current());
418 } 418 }
419 419
420 } // namespace remoting 420 } // namespace remoting
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_video_decoder_thunk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698