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

Unified Diff: ppapi/proxy/ppb_graphics_2d_proxy.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/ppb_flash_menu_proxy.cc ('k') | ppapi/proxy/ppb_instance_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_graphics_2d_proxy.cc
diff --git a/ppapi/proxy/ppb_graphics_2d_proxy.cc b/ppapi/proxy/ppb_graphics_2d_proxy.cc
index 0cbd3885af2dc51b4ea8a9a561c6d887f7b84e60..2fc34ccc6166de063cf75559b92f378a2b24295b 100644
--- a/ppapi/proxy/ppb_graphics_2d_proxy.cc
+++ b/ppapi/proxy/ppb_graphics_2d_proxy.cc
@@ -43,7 +43,7 @@ class Graphics2D : public Resource, public thunk::PPB_Graphics2D_API {
void Scroll(const PP_Rect* clip_rect,
const PP_Point* amount);
void ReplaceContents(PP_Resource image_data);
- int32_t Flush(PP_CompletionCallback callback);
+ int32_t Flush(scoped_refptr<TrackedCallback> callback);
// Notification that the host has sent an ACK for a pending Flush.
void FlushACK(int32_t result_code);
@@ -126,15 +126,10 @@ void Graphics2D::ReplaceContents(PP_Resource image_data) {
kApiID, host_resource(), image_object->host_resource()));
}
-int32_t Graphics2D::Flush(PP_CompletionCallback callback) {
- // For now, disallow blocking calls. We'll need to add support for other
- // threads to this later.
- if (!callback.func)
- return PP_ERROR_BLOCKS_MAIN_THREAD;
-
+int32_t Graphics2D::Flush(scoped_refptr<TrackedCallback> callback) {
if (TrackedCallback::IsPending(current_flush_callback_))
return PP_ERROR_INPROGRESS; // Can't have >1 flush pending.
- current_flush_callback_ = new TrackedCallback(this, callback);
+ current_flush_callback_ = callback;
GetDispatcher()->Send(new PpapiHostMsg_PPBGraphics2D_Flush(kApiID,
host_resource()));
« no previous file with comments | « ppapi/proxy/ppb_flash_menu_proxy.cc ('k') | ppapi/proxy/ppb_instance_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698