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

Side by Side Diff: ppapi/thunk/ppb_graphics_2d_thunk.cc

Issue 10081020: PPAPI: Make blocking completion callbacks work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: export AssertLockHeld Created 8 years, 6 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_graphics_2d_api.h ('k') | ppapi/thunk/ppb_graphics_3d_api.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) 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/c/pp_completion_callback.h" 5 #include "ppapi/c/pp_completion_callback.h"
6 #include "ppapi/c/pp_errors.h" 6 #include "ppapi/c/pp_errors.h"
7 #include "ppapi/c/ppb_graphics_2d.h" 7 #include "ppapi/c/ppb_graphics_2d.h"
8 #include "ppapi/shared_impl/tracked_callback.h"
8 #include "ppapi/thunk/enter.h" 9 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/ppb_graphics_2d_api.h" 10 #include "ppapi/thunk/ppb_graphics_2d_api.h"
10 #include "ppapi/thunk/resource_creation_api.h" 11 #include "ppapi/thunk/resource_creation_api.h"
11 #include "ppapi/thunk/thunk.h" 12 #include "ppapi/thunk/thunk.h"
12 13
13 namespace ppapi { 14 namespace ppapi {
14 namespace thunk { 15 namespace thunk {
15 16
16 namespace { 17 namespace {
17 18
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 enter.object()->Scroll(clip_rect, amount); 64 enter.object()->Scroll(clip_rect, amount);
64 } 65 }
65 66
66 void ReplaceContents(PP_Resource graphics_2d, PP_Resource image_data) { 67 void ReplaceContents(PP_Resource graphics_2d, PP_Resource image_data) {
67 EnterGraphics2D enter(graphics_2d, true); 68 EnterGraphics2D enter(graphics_2d, true);
68 if (enter.failed()) 69 if (enter.failed())
69 return; 70 return;
70 enter.object()->ReplaceContents(image_data); 71 enter.object()->ReplaceContents(image_data);
71 } 72 }
72 73
73 int32_t Flush(PP_Resource graphics_2d, 74 int32_t Flush(PP_Resource graphics_2d, PP_CompletionCallback callback) {
74 PP_CompletionCallback callback) {
75 EnterGraphics2D enter(graphics_2d, callback, true); 75 EnterGraphics2D enter(graphics_2d, callback, true);
76 if (enter.failed()) 76 if (enter.failed())
77 return enter.retval(); 77 return enter.retval();
78 return enter.SetResult(enter.object()->Flush(callback)); 78 return enter.SetResult(enter.object()->Flush(enter.callback()));
79 } 79 }
80 80
81 const PPB_Graphics2D g_ppb_graphics_2d_thunk = { 81 const PPB_Graphics2D g_ppb_graphics_2d_thunk = {
82 &Create, 82 &Create,
83 &IsGraphics2D, 83 &IsGraphics2D,
84 &Describe, 84 &Describe,
85 &PaintImageData, 85 &PaintImageData,
86 &Scroll, 86 &Scroll,
87 &ReplaceContents, 87 &ReplaceContents,
88 &Flush 88 &Flush
89 }; 89 };
90 90
91 } // namespace 91 } // namespace
92 92
93 const PPB_Graphics2D_1_0* GetPPB_Graphics2D_1_0_Thunk() { 93 const PPB_Graphics2D_1_0* GetPPB_Graphics2D_1_0_Thunk() {
94 return &g_ppb_graphics_2d_thunk; 94 return &g_ppb_graphics_2d_thunk;
95 } 95 }
96 96
97 } // namespace thunk 97 } // namespace thunk
98 } // namespace ppapi 98 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_graphics_2d_api.h ('k') | ppapi/thunk/ppb_graphics_3d_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698