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

Side by Side Diff: ppapi/proxy/ppb_graphics_2d_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_flash_net_connector_proxy.cc ('k') | ppapi/proxy/ppb_surface_3d_proxy.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) 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_graphics_2d_proxy.h" 5 #include "ppapi/proxy/ppb_graphics_2d_proxy.h"
6 6
7 #include <string.h> // For memset. 7 #include <string.h> // For memset.
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 void PPB_Graphics2D_Proxy::OnMsgReplaceContents( 233 void PPB_Graphics2D_Proxy::OnMsgReplaceContents(
234 const HostResource& graphics_2d, 234 const HostResource& graphics_2d,
235 const HostResource& image_data) { 235 const HostResource& image_data) {
236 EnterHostFromHostResource<PPB_Graphics2D_API> enter(graphics_2d); 236 EnterHostFromHostResource<PPB_Graphics2D_API> enter(graphics_2d);
237 if (enter.failed()) 237 if (enter.failed())
238 return; 238 return;
239 enter.object()->ReplaceContents(image_data.host_resource()); 239 enter.object()->ReplaceContents(image_data.host_resource());
240 } 240 }
241 241
242 void PPB_Graphics2D_Proxy::OnMsgFlush(const HostResource& graphics_2d) { 242 void PPB_Graphics2D_Proxy::OnMsgFlush(const HostResource& graphics_2d) {
243 CompletionCallback callback = callback_factory_.NewCallback( 243 CompletionCallback callback = callback_factory_.NewOptionalCallback(
244 &PPB_Graphics2D_Proxy::SendFlushACKToPlugin, graphics_2d); 244 &PPB_Graphics2D_Proxy::SendFlushACKToPlugin, graphics_2d);
245 int32_t result = ppb_graphics_2d_target()->Flush( 245 int32_t result = ppb_graphics_2d_target()->Flush(
246 graphics_2d.host_resource(), callback.pp_completion_callback()); 246 graphics_2d.host_resource(), callback.pp_completion_callback());
247 if (result != PP_OK_COMPLETIONPENDING) { 247 if (result != PP_OK_COMPLETIONPENDING) {
248 // There was some error, so we won't get a flush callback. We need to now 248 // There was some error, so we won't get a flush callback. We need to now
249 // issue the ACK to the plugin hears about the error. This will also clean 249 // issue the ACK to the plugin hears about the error. This will also clean
250 // up the data associated with the callback. 250 // up the data associated with the callback.
251 callback.Run(result); 251 callback.Run(result);
252 } 252 }
253 } 253 }
254 254
255 void PPB_Graphics2D_Proxy::OnMsgFlushACK(const HostResource& host_resource, 255 void PPB_Graphics2D_Proxy::OnMsgFlushACK(const HostResource& host_resource,
256 int32_t pp_error) { 256 int32_t pp_error) {
257 EnterPluginFromHostResource<PPB_Graphics2D_API> enter(host_resource); 257 EnterPluginFromHostResource<PPB_Graphics2D_API> enter(host_resource);
258 if (enter.succeeded()) 258 if (enter.succeeded())
259 static_cast<Graphics2D*>(enter.object())->FlushACK(pp_error); 259 static_cast<Graphics2D*>(enter.object())->FlushACK(pp_error);
260 } 260 }
261 261
262 void PPB_Graphics2D_Proxy::SendFlushACKToPlugin( 262 void PPB_Graphics2D_Proxy::SendFlushACKToPlugin(
263 int32_t result, 263 int32_t result,
264 const HostResource& graphics_2d) { 264 const HostResource& graphics_2d) {
265 dispatcher()->Send(new PpapiMsg_PPBGraphics2D_FlushACK( 265 dispatcher()->Send(new PpapiMsg_PPBGraphics2D_FlushACK(
266 INTERFACE_ID_PPB_GRAPHICS_2D, graphics_2d, result)); 266 INTERFACE_ID_PPB_GRAPHICS_2D, graphics_2d, result));
267 } 267 }
268 268
269 } // namespace proxy 269 } // namespace proxy
270 } // namespace pp 270 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_flash_net_connector_proxy.cc ('k') | ppapi/proxy/ppb_surface_3d_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698