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

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

Issue 8678001: Commit Pepper backing texture immediately on swapbuffers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « no previous file | 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_3d_impl.cc
diff --git a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
index 1e26319d8301bd945c6b9382552852a28f1be656..2794436a12597d9c1bcef5a5f1b7fcc052ea5c3b 100644
--- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
@@ -165,8 +165,22 @@ int32 PPB_Graphics3D_Impl::DoSwapBuffers() {
if (gles2_impl())
gles2_impl()->SwapBuffers();
- platform_context_->Echo(base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers,
- weak_ptr_factory_.GetWeakPtr()));
+ if (bound_to_instance_) {
+ // If we are bound to the instance, we need to ask the compositor
+ // to commit our backing texture so that the graphics appears on the page.
+ // When the backing texture will be committed we get notified via
+ // ViewFlushedPaint().
+ //
+ // Don't need to check for NULL from GetPluginInstance since when we're
+ // bound, we know our instance is valid.
+ ResourceHelper::GetPluginInstance(this)->CommitBackingTexture();
piman 2011/11/23 06:41:49 This part is good, but you'll want to fix ppapi::p
+ commit_pending_ = true;
+ } else {
+ // Wait for the command to complete on the GPU to allow for throttling.
+ platform_context_->Echo(base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers,
+ weak_ptr_factory_.GetWeakPtr()));
+ }
+
return PP_OK_COMPLETIONPENDING;
}
@@ -208,17 +222,7 @@ bool PPB_Graphics3D_Impl::InitRaw(PP_Resource share_context,
}
void PPB_Graphics3D_Impl::OnSwapBuffers() {
- if (bound_to_instance_) {
- // If we are bound to the instance, we need to ask the compositor
- // to commit our backing texture so that the graphics appears on the page.
- // When the backing texture will be committed we get notified via
- // ViewFlushedPaint().
- //
- // Don't need to check for NULL from GetPluginInstance since when we're
- // bound, we know our instance is valid.
- ResourceHelper::GetPluginInstance(this)->CommitBackingTexture();
- commit_pending_ = true;
- } else if (HasPendingSwap()) {
+ if (HasPendingSwap()) {
// If we're off-screen, no need to trigger and wait for compositing.
// Just send the swap-buffers ACK to the plugin immediately.
commit_pending_ = false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698