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

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: 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 side-by-side diff with in-line comments
Download patch
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..227872754b551dd197d4e19fc54ddb0bd7afd607 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(ApiCallbackType 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(ApiCallbackType 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()));

Powered by Google App Engine
This is Rietveld 408576698