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

Unified Diff: webkit/plugins/ppapi/ppb_graphics_2d_impl.cc

Issue 8801027: Always run Flush completion callbacks in Graphics2D. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really fix compile Created 9 years 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 | « webkit/plugins/ppapi/ppb_graphics_2d_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a6c12a8d901cfe10bb0f644941d99cef57c0e4ae..a209e1f837908869f7aec5264b6b944c22e47cd0 100644
--- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
@@ -161,6 +161,9 @@ PPB_Graphics2D_Impl::PPB_Graphics2D_Impl(PP_Instance instance)
}
PPB_Graphics2D_Impl::~PPB_Graphics2D_Impl() {
+ // LastPluginRefWasDeleted should have aborted all pending callbacks.
+ DCHECK(painted_flush_callback_.is_null());
+ DCHECK(unpainted_flush_callback_.is_null());
}
// static
@@ -194,8 +197,14 @@ PPB_Graphics2D_Impl::AsPPB_Graphics2D_API() {
return this;
}
-PPB_Graphics2D_Impl* PPB_Graphics2D_Impl::AsPPB_Graphics2D_Impl() {
- return this;
+void PPB_Graphics2D_Impl::LastPluginRefWasDeleted() {
+ Resource::LastPluginRefWasDeleted();
+
+ // Abort any pending callbacks.
+ if (!unpainted_flush_callback_.is_null())
+ unpainted_flush_callback_.Execute(PP_ERROR_ABORTED);
+ if (!painted_flush_callback_.is_null())
+ painted_flush_callback_.Execute(PP_ERROR_ABORTED);
}
PP_Bool PPB_Graphics2D_Impl::Describe(PP_Size* size,
@@ -540,14 +549,8 @@ void PPB_Graphics2D_Impl::ViewInitiatedPaint() {
void PPB_Graphics2D_Impl::ViewFlushedPaint() {
// Notify any "painted" callback. See |unpainted_flush_callback_| in the
// header for more.
- if (!painted_flush_callback_.is_null()) {
- // We must clear this variable before issuing the callback. It will be
- // common for the plugin to issue another invalidate in response to a flush
- // callback, and we don't want to think that a callback is already pending.
- FlushCallbackData callback;
- std::swap(callback, painted_flush_callback_);
- callback.Execute(PP_OK);
- }
+ if (!painted_flush_callback_.is_null())
+ painted_flush_callback_.Execute(PP_OK);
}
void PPB_Graphics2D_Impl::ExecutePaintImageData(PPB_ImageData_Impl* image,
« no previous file with comments | « webkit/plugins/ppapi/ppb_graphics_2d_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698