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

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: Updated TestURLLoader to test blocking callbacks. Created 8 years, 8 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
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/thunk/enter.h" 8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/ppb_graphics_2d_api.h" 9 #include "ppapi/thunk/ppb_graphics_2d_api.h"
10 #include "ppapi/thunk/resource_creation_api.h" 10 #include "ppapi/thunk/resource_creation_api.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 enter.object()->Scroll(clip_rect, amount); 63 enter.object()->Scroll(clip_rect, amount);
64 } 64 }
65 65
66 void ReplaceContents(PP_Resource graphics_2d, PP_Resource image_data) { 66 void ReplaceContents(PP_Resource graphics_2d, PP_Resource image_data) {
67 EnterGraphics2D enter(graphics_2d, true); 67 EnterGraphics2D enter(graphics_2d, true);
68 if (enter.failed()) 68 if (enter.failed())
69 return; 69 return;
70 enter.object()->ReplaceContents(image_data); 70 enter.object()->ReplaceContents(image_data);
71 } 71 }
72 72
73 int32_t Flush(PP_Resource graphics_2d, 73 int32_t Flush(PP_Resource graphics_2d, PP_CompletionCallback callback) {
74 PP_CompletionCallback callback) {
75 EnterGraphics2D enter(graphics_2d, callback, true); 74 EnterGraphics2D enter(graphics_2d, callback, true);
76 if (enter.failed()) 75 if (enter.failed())
77 return enter.retval(); 76 return enter.retval();
78 return enter.SetResult(enter.object()->Flush(callback)); 77 return enter.SetResult(enter.object()->Flush(enter.callback()));
79 } 78 }
80 79
81 const PPB_Graphics2D g_ppb_graphics_2d_thunk = { 80 const PPB_Graphics2D g_ppb_graphics_2d_thunk = {
82 &Create, 81 &Create,
83 &IsGraphics2D, 82 &IsGraphics2D,
84 &Describe, 83 &Describe,
85 &PaintImageData, 84 &PaintImageData,
86 &Scroll, 85 &Scroll,
87 &ReplaceContents, 86 &ReplaceContents,
88 &Flush 87 &Flush
89 }; 88 };
90 89
91 } // namespace 90 } // namespace
92 91
93 const PPB_Graphics2D_1_0* GetPPB_Graphics2D_1_0_Thunk() { 92 const PPB_Graphics2D_1_0* GetPPB_Graphics2D_1_0_Thunk() {
94 return &g_ppb_graphics_2d_thunk; 93 return &g_ppb_graphics_2d_thunk;
95 } 94 }
96 95
97 } // namespace thunk 96 } // namespace thunk
98 } // namespace ppapi 97 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698