summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/webplugin_delegate_proxy.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer/webplugin_delegate_proxy.cc')
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc29
1 files changed, 22 insertions, 7 deletions
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index b00f1b5..10bf1f8 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -402,6 +402,8 @@ void WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) {
OnDeferResourceLoading)
#if defined(OS_MACOSX)
+ IPC_MESSAGE_HANDLER(PluginHostMsg_BindFakePluginWindowHandle,
+ OnBindFakePluginWindowHandle);
IPC_MESSAGE_HANDLER(PluginHostMsg_UpdateGeometry_ACK,
OnUpdateGeometry_ACK)
// Used only on 10.6 and later.
@@ -1255,25 +1257,38 @@ WebPluginDelegateProxy::CreateSeekableResourceClient(
return proxy;
}
-CommandBufferProxy* WebPluginDelegateProxy::CreateCommandBuffer() {
-#if defined(ENABLE_GPU)
#if defined(OS_MACOSX)
- // We need to synthesize a fake window handle for this nested
- // delegate to identify the instance of the GPU plugin back to the
- // browser.
+void WebPluginDelegateProxy::OnBindFakePluginWindowHandle() {
+ BindFakePluginWindowHandle();
+}
+
+// Synthesize a fake window handle for the plug-in to identify the instance
+// to the browser, allowing mapping to a surface for hardware acceleration
+// of plug-in content. The browser generates the handle which is then set on
+// the plug-in. Returns true if it successfully sets the window handle on the
+// plug-in.
+bool WebPluginDelegateProxy::BindFakePluginWindowHandle() {
gfx::PluginWindowHandle fake_window = NULL;
if (render_view_)
fake_window = render_view_->AllocateFakePluginWindowHandle();
// If we aren't running on 10.6, this allocation will fail.
if (!fake_window)
- return NULL;
+ return false;
OnSetWindow(fake_window);
if (!Send(new PluginMsg_SetFakeGPUPluginWindowHandle(instance_id_,
fake_window))) {
- return NULL;
+ return false;
}
+ return true;
+}
#endif
+CommandBufferProxy* WebPluginDelegateProxy::CreateCommandBuffer() {
+#if defined(ENABLE_GPU)
+#if defined(OS_MACOSX)
+ if (!BindFakePluginWindowHandle())
+ return NULL;
+#endif
int command_buffer_id;
if (!Send(new PluginMsg_CreateCommandBuffer(instance_id_,
&command_buffer_id))) {