summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/ppapi
diff options
context:
space:
mode:
authoralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-10 19:59:10 +0000
committeralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-10 19:59:10 +0000
commit7a65ac8a11916a4f13a7ed69346a4bda41e2d0ba (patch)
tree2716ec2db47a21d98de0ebebd02a2b512029110c /webkit/plugins/ppapi
parent6aacd8d639d7bb6d85c83e91e97e78e6bda12a27 (diff)
downloadchromium_src-7a65ac8a11916a4f13a7ed69346a4bda41e2d0ba.zip
chromium_src-7a65ac8a11916a4f13a7ed69346a4bda41e2d0ba.tar.gz
chromium_src-7a65ac8a11916a4f13a7ed69346a4bda41e2d0ba.tar.bz2
Used new WebKit::WebPluginContainer::setBackingTextureId() to switch on/off accelerated compositing for a ppapi plugin.
BUG=72784 Review URL: http://codereview.chromium.org/6656009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77682 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/ppapi')
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc18
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.h5
2 files changed, 23 insertions, 0 deletions
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index f1e4e26..a198289 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -481,6 +481,7 @@ bool PluginInstance::BindGraphics(PP_Resource graphics_id) {
} else if (bound_graphics_.get()) {
bound_graphics_3d()->BindToInstance(false);
}
+ setBackingTextureId(0);
InvalidateRect(gfx::Rect());
}
bound_graphics_ = NULL;
@@ -523,6 +524,7 @@ bool PluginInstance::BindGraphics(PP_Resource graphics_id) {
}
bound_graphics_ = graphics_2d;
+ setBackingTextureId(0);
// BindToInstance will have invalidated the plugin if necessary.
} else if (graphics_3d) {
// Refuse to bind if we're transitioning to fullscreen.
@@ -535,6 +537,7 @@ bool PluginInstance::BindGraphics(PP_Resource graphics_id) {
if (!graphics_3d->BindToInstance(true))
return false;
+ setBackingTextureId(graphics_3d->GetBackingTextureId());
bound_graphics_ = graphics_3d;
}
@@ -1297,6 +1300,21 @@ PPB_Surface3D_Impl* PluginInstance::bound_graphics_3d() const {
return bound_graphics_->Cast<PPB_Surface3D_Impl>();
}
+void PluginInstance::setBackingTextureId(unsigned int id) {
+ // If we have a full-screen container_ then the plugin is fullscreen,
+ // and the parent context is not the one for the browser page, but for the
+ // full-screen window, and so the parent texture ID doesn't correspond to
+ // anything in the page's context.
+ //
+ // TODO(alokp): It would be better at some point to have the equivalent
+ // in the FullscreenContainer so that we don't need to poll
+ if (fullscreen_container_)
+ return;
+
+ if (container_)
+ container_->setBackingTextureId(id);
+}
+
void PluginInstance::AddPluginObject(PluginObject* plugin_object) {
DCHECK(live_plugin_objects_.find(plugin_object) ==
live_plugin_objects_.end());
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index 356eb4c..b847c36 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -267,6 +267,11 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
// Returns NULL if bound graphics is not a 3D surface.
PPB_Surface3D_Impl* bound_graphics_3d() const;
+ // Sets the id of the texture that the plugin draws to. The id is in the
+ // compositor space so it can use it to composite with rest of the page.
+ // A value of zero indicates the plugin is not backed by a texture.
+ void setBackingTextureId(unsigned int id);
+
// Internal helper function for PrintPage().
bool PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges,
int num_ranges,