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

Unified Diff: webkit/plugins/ppapi/ppb_graphics_2d_impl.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: webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
index 89cba977ea524a0df0f064edeed3802ea76f2257..0046d7d2b123d7e82f89a547dbcb60f7a47021ec 100644
--- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
@@ -32,6 +32,7 @@
#include "base/mac/scoped_cftyperef.h"
#endif
+using ppapi::ApiCallbackType;
using ppapi::thunk::EnterResourceNoLock;
using ppapi::thunk::PPB_ImageData_API;
using ppapi::TrackedCallback;
@@ -314,11 +315,8 @@ void PPB_Graphics2D_Impl::ReplaceContents(PP_Resource image_data) {
queued_operations_.push_back(operation);
}
-int32_t PPB_Graphics2D_Impl::Flush(PP_CompletionCallback callback) {
+int32_t PPB_Graphics2D_Impl::Flush(ApiCallbackType callback) {
TRACE_EVENT0("pepper", "PPB_Graphics2D_Impl::Flush");
- if (!callback.func)
- return PP_ERROR_BLOCKS_MAIN_THREAD;
-
// Don't allow more than one pending flush at a time.
if (HasPendingFlush())
return PP_ERROR_INPROGRESS;
@@ -369,11 +367,9 @@ int32_t PPB_Graphics2D_Impl::Flush(PP_CompletionCallback callback) {
if (nothing_visible) {
// There's nothing visible to invalidate so just schedule the callback to
// execute in the next round of the message loop.
- ScheduleOffscreenCallback(FlushCallbackData(
- scoped_refptr<TrackedCallback>(new TrackedCallback(this, callback))));
+ ScheduleOffscreenCallback(FlushCallbackData(callback));
} else {
- unpainted_flush_callback_.Set(
- scoped_refptr<TrackedCallback>(new TrackedCallback(this, callback)));
+ unpainted_flush_callback_.Set(callback);
}
return PP_OK_COMPLETIONPENDING;
}

Powered by Google App Engine
This is Rietveld 408576698