summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-19 22:58:53 +0000
committerjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-19 22:58:53 +0000
commitba506c9fdbb80aea3cdad31a0e81ad6650e86dcf (patch)
treeb6c453717bceb8936c856c407bc2573f0896258c
parent09fbfc2fd91654b9909dc139f94b0f107b746e0a (diff)
downloadchromium_src-ba506c9fdbb80aea3cdad31a0e81ad6650e86dcf.zip
chromium_src-ba506c9fdbb80aea3cdad31a0e81ad6650e86dcf.tar.gz
chromium_src-ba506c9fdbb80aea3cdad31a0e81ad6650e86dcf.tar.bz2
Don't require a recreation of the context when fullscreening
Instead of requiring flash to destroy and recreate its context, we can reparent its context onto the new view context (and later back again). BUG=147746 Review URL: https://chromiumcodereview.appspot.com/10918182 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157641 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/renderer/pepper/pepper_platform_context_3d_impl.cc31
-rw-r--r--content/renderer/pepper/pepper_platform_context_3d_impl.h3
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.cc5
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.h1
-rw-r--r--content/renderer/render_widget_fullscreen_pepper.cc5
-rw-r--r--content/renderer/render_widget_fullscreen_pepper.h2
-rw-r--r--ppapi/api/private/ppb_flash_fullscreen.idl29
-rw-r--r--ppapi/c/private/ppb_flash_fullscreen.h31
-rw-r--r--ppapi/cpp/private/flash_fullscreen.cc24
-rw-r--r--ppapi/cpp/private/flash_fullscreen.h2
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c12
-rw-r--r--ppapi/thunk/interfaces_ppb_private.h2
-rw-r--r--ppapi/thunk/ppb_flash_fullscreen_thunk.cc2
-rw-r--r--webkit/plugins/ppapi/fullscreen_container.h2
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.cc3
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.h1
-rw-r--r--webkit/plugins/ppapi/plugin_delegate.h3
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc15
18 files changed, 138 insertions, 35 deletions
diff --git a/content/renderer/pepper/pepper_platform_context_3d_impl.cc b/content/renderer/pepper/pepper_platform_context_3d_impl.cc
index b3981bf..3c80538 100644
--- a/content/renderer/pepper/pepper_platform_context_3d_impl.cc
+++ b/content/renderer/pepper/pepper_platform_context_3d_impl.cc
@@ -147,6 +147,37 @@ bool PlatformContext3DImpl::Init(const int32* attrib_list,
return true;
}
+void PlatformContext3DImpl::SetParentContext(
+ PepperParentContextProvider* parent_context_provider) {
+ if (parent_context_.get() && parent_texture_id_ != 0) {
+ // Flush any remaining commands in the parent context to make sure the
+ // texture id accounting stays consistent.
+ gpu::gles2::GLES2Implementation* parent_gles2 =
+ parent_context_->GetImplementation();
+ parent_gles2->helper()->CommandBufferHelper::Flush();
+ parent_gles2->FreeTextureId(parent_texture_id_);
+ parent_context_.reset();
+ parent_texture_id_ = 0;
+ }
+
+ WebGraphicsContext3DCommandBufferImpl* parent_context =
+ parent_context_provider->GetParentContextForPlatformContext3D();
+ if (!parent_context)
+ return;
+
+ parent_context_ = parent_context->AsWeakPtr();
+ // Flush any remaining commands in the parent context to make sure the
+ // texture id accounting stays consistent.
+ gpu::gles2::GLES2Implementation* parent_gles2 =
+ parent_context_->GetImplementation();
+ parent_gles2->helper()->CommandBufferHelper::Flush();
+ parent_texture_id_ = parent_gles2->MakeTextureId();
+
+ CommandBufferProxy* parent_command_buffer =
+ parent_context_->GetCommandBufferProxy();
+ command_buffer_->SetParent(parent_command_buffer, parent_texture_id_);
+}
+
unsigned PlatformContext3DImpl::GetBackingTextureId() {
DCHECK(command_buffer_);
return parent_texture_id_;
diff --git a/content/renderer/pepper/pepper_platform_context_3d_impl.h b/content/renderer/pepper/pepper_platform_context_3d_impl.h
index 85140be..f3caa89 100644
--- a/content/renderer/pepper/pepper_platform_context_3d_impl.h
+++ b/content/renderer/pepper/pepper_platform_context_3d_impl.h
@@ -46,6 +46,9 @@ class PlatformContext3DImpl
const ConsoleMessageCallback& callback) OVERRIDE;
virtual bool Echo(const base::Closure& task) OVERRIDE;
+ virtual void SetParentContext(
+ PepperParentContextProvider* parent_context_provider);
+
private:
bool InitRaw();
void OnContextLost();
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
index 3b1f070..78dd2fe 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -778,6 +778,11 @@ webkit::ppapi::PluginDelegate::PlatformContext3D*
#endif
}
+void PepperPluginDelegateImpl::ReparentContext(
+ webkit::ppapi::PluginDelegate::PlatformContext3D* context) {
+ static_cast<PlatformContext3DImpl*>(context)->SetParentContext(this);
+}
+
webkit::ppapi::PluginDelegate::PlatformVideoCapture*
PepperPluginDelegateImpl::CreateVideoCapture(
const std::string& device_id,
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h
index 140e71f..c21ef21 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.h
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h
@@ -203,6 +203,7 @@ class PepperPluginDelegateImpl
PlatformAudioInputClient* client) OVERRIDE;
virtual PlatformImage2D* CreateImage2D(int width, int height) OVERRIDE;
virtual PlatformContext3D* CreateContext3D() OVERRIDE;
+ virtual void ReparentContext(PlatformContext3D*) OVERRIDE;
virtual PlatformVideoCapture* CreateVideoCapture(
const std::string& device_id,
PlatformVideoCaptureEventHandler* handler) OVERRIDE;
diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc
index 887d1de..d02c459 100644
--- a/content/renderer/render_widget_fullscreen_pepper.cc
+++ b/content/renderer/render_widget_fullscreen_pepper.cc
@@ -367,6 +367,11 @@ RenderWidgetFullscreenPepper::CreateContext3D() {
#endif
}
+void RenderWidgetFullscreenPepper::ReparentContext(
+ webkit::ppapi::PluginDelegate::PlatformContext3D* context) {
+ static_cast<content::PlatformContext3DImpl*>(context)->SetParentContext(this);
+}
+
MouseLockDispatcher* RenderWidgetFullscreenPepper::GetMouseLockDispatcher() {
return mouse_lock_dispatcher_.get();
}
diff --git a/content/renderer/render_widget_fullscreen_pepper.h b/content/renderer/render_widget_fullscreen_pepper.h
index 3ccedc44..d3fd06d 100644
--- a/content/renderer/render_widget_fullscreen_pepper.h
+++ b/content/renderer/render_widget_fullscreen_pepper.h
@@ -54,6 +54,8 @@ class RenderWidgetFullscreenPepper :
virtual webkit::ppapi::PluginDelegate::PlatformContext3D*
CreateContext3D() OVERRIDE;
virtual MouseLockDispatcher* GetMouseLockDispatcher() OVERRIDE;
+ virtual void ReparentContext(
+ webkit::ppapi::PluginDelegate::PlatformContext3D*) OVERRIDE;
// IPC::Listener implementation. This overrides the implementation
// in RenderWidgetFullscreen.
diff --git a/ppapi/api/private/ppb_flash_fullscreen.idl b/ppapi/api/private/ppb_flash_fullscreen.idl
index b646e8f..11f94e4 100644
--- a/ppapi/api/private/ppb_flash_fullscreen.idl
+++ b/ppapi/api/private/ppb_flash_fullscreen.idl
@@ -9,7 +9,8 @@
*/
label Chrome {
- M16 = 0.1
+ M16 = 0.1,
+ M23 = 1.0
};
interface PPB_FlashFullscreen {
@@ -19,21 +20,27 @@ interface PPB_FlashFullscreen {
PP_Bool IsFullscreen(
[in] PP_Instance instance);
+ /*
+ * This older version required that graphics contexts be recreated after the
+ * transition.
+ */
+ [version=0.1, deprecate=1.0]
+ PP_Bool SetFullscreen(
+ [in] PP_Instance instance,
+ [in] PP_Bool fullscreen);
+
/**
* Switches the plugin instance to/from fullscreen mode. Returns PP_TRUE on
* success, PP_FALSE on failure.
*
- * This unbinds the current Graphics2D or Graphics3D. Pending flushes and
- * swapbuffers will execute as if the resource was off-screen. The transition
- * is asynchronous. During the transition, IsFullscreen will return PP_FALSE,
- * and no Graphics2D or Graphics3D can be bound. The transition ends at the
- * next DidChangeView when going into fullscreen mode. The transition out of
- * fullscreen mode is synchronous.
- *
- * Note: when switching to and from fullscreen, Graphics3D resources need to
- * be re-created. This is a current limitation that will be lifted in a later
- * revision.
+ * This does not unbind the current Graphics2D or Graphics3D. Pending flushes
+ * and swapbuffers will execute as if the resource was off-screen. The
+ * transition is asynchronous. During the transition, IsFullscreen will
+ * return PP_FALSE, and no Graphics2D or Graphics3D can be bound. The
+ * transition ends at the next DidChangeView when going into fullscreen mode.
+ * The transition out of fullscreen mode is synchronous.
*/
+ [version=1.0]
PP_Bool SetFullscreen(
[in] PP_Instance instance,
[in] PP_Bool fullscreen);
diff --git a/ppapi/c/private/ppb_flash_fullscreen.h b/ppapi/c/private/ppb_flash_fullscreen.h
index b21a731..3dc23cc 100644
--- a/ppapi/c/private/ppb_flash_fullscreen.h
+++ b/ppapi/c/private/ppb_flash_fullscreen.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_flash_fullscreen.idl modified Wed Dec 14 18:08:00 2011. */
+/* From private/ppb_flash_fullscreen.idl modified Tue Sep 11 13:52:24 2012. */
#ifndef PPAPI_C_PRIVATE_PPB_FLASH_FULLSCREEN_H_
#define PPAPI_C_PRIVATE_PPB_FLASH_FULLSCREEN_H_
@@ -15,7 +15,8 @@
#include "ppapi/c/pp_stdint.h"
#define PPB_FLASHFULLSCREEN_INTERFACE_0_1 "PPB_FlashFullscreen;0.1"
-#define PPB_FLASHFULLSCREEN_INTERFACE PPB_FLASHFULLSCREEN_INTERFACE_0_1
+#define PPB_FLASHFULLSCREEN_INTERFACE_1_0 "PPB_FlashFullscreen;1.0"
+#define PPB_FLASHFULLSCREEN_INTERFACE PPB_FLASHFULLSCREEN_INTERFACE_1_0
/**
* @file
@@ -27,7 +28,7 @@
* @addtogroup Interfaces
* @{
*/
-struct PPB_FlashFullscreen_0_1 {
+struct PPB_FlashFullscreen_1_0 {
/**
* Checks whether the plugin instance is currently in fullscreen mode.
*/
@@ -36,16 +37,12 @@ struct PPB_FlashFullscreen_0_1 {
* Switches the plugin instance to/from fullscreen mode. Returns PP_TRUE on
* success, PP_FALSE on failure.
*
- * This unbinds the current Graphics2D or Graphics3D. Pending flushes and
- * swapbuffers will execute as if the resource was off-screen. The transition
- * is asynchronous. During the transition, IsFullscreen will return PP_FALSE,
- * and no Graphics2D or Graphics3D can be bound. The transition ends at the
- * next DidChangeView when going into fullscreen mode. The transition out of
- * fullscreen mode is synchronous.
- *
- * Note: when switching to and from fullscreen, Graphics3D resources need to
- * be re-created. This is a current limitation that will be lifted in a later
- * revision.
+ * This does not unbind the current Graphics2D or Graphics3D. Pending flushes
+ * and swapbuffers will execute as if the resource was off-screen. The
+ * transition is asynchronous. During the transition, IsFullscreen will
+ * return PP_FALSE, and no Graphics2D or Graphics3D can be bound. The
+ * transition ends at the next DidChangeView when going into fullscreen mode.
+ * The transition out of fullscreen mode is synchronous.
*/
PP_Bool (*SetFullscreen)(PP_Instance instance, PP_Bool fullscreen);
/**
@@ -55,7 +52,13 @@ struct PPB_FlashFullscreen_0_1 {
PP_Bool (*GetScreenSize)(PP_Instance instance, struct PP_Size* size);
};
-typedef struct PPB_FlashFullscreen_0_1 PPB_FlashFullscreen;
+typedef struct PPB_FlashFullscreen_1_0 PPB_FlashFullscreen;
+
+struct PPB_FlashFullscreen_0_1 {
+ PP_Bool (*IsFullscreen)(PP_Instance instance);
+ PP_Bool (*SetFullscreen)(PP_Instance instance, PP_Bool fullscreen);
+ PP_Bool (*GetScreenSize)(PP_Instance instance, struct PP_Size* size);
+};
/**
* @}
*/
diff --git a/ppapi/cpp/private/flash_fullscreen.cc b/ppapi/cpp/private/flash_fullscreen.cc
index 8a5be26..dd17b1a 100644
--- a/ppapi/cpp/private/flash_fullscreen.cc
+++ b/ppapi/cpp/private/flash_fullscreen.cc
@@ -14,8 +14,12 @@ namespace pp {
namespace {
-template <> const char* interface_name<PPB_FlashFullscreen>() {
- return PPB_FLASHFULLSCREEN_INTERFACE;
+template <> const char* interface_name<PPB_FlashFullscreen_0_1>() {
+ return PPB_FLASHFULLSCREEN_INTERFACE_0_1;
+}
+
+template <> const char* interface_name<PPB_FlashFullscreen_1_0>() {
+ return PPB_FLASHFULLSCREEN_INTERFACE_1_0;
}
} // namespace
@@ -28,23 +32,27 @@ FlashFullscreen::~FlashFullscreen() {
}
bool FlashFullscreen::IsFullscreen() {
- return has_interface<PPB_FlashFullscreen>() &&
- get_interface<PPB_FlashFullscreen>()->IsFullscreen(
+ return has_interface<PPB_FlashFullscreen_0_1>() &&
+ get_interface<PPB_FlashFullscreen_0_1>()->IsFullscreen(
instance_.pp_instance());
}
bool FlashFullscreen::SetFullscreen(bool fullscreen) {
- if (!has_interface<PPB_FlashFullscreen>())
+ if (!has_interface<PPB_FlashFullscreen_0_1>())
return false;
- return PP_ToBool(get_interface<PPB_FlashFullscreen>()->SetFullscreen(
+ return PP_ToBool(get_interface<PPB_FlashFullscreen_0_1>()->SetFullscreen(
instance_.pp_instance(), PP_FromBool(fullscreen)));
}
bool FlashFullscreen::GetScreenSize(Size* size) {
- if (!has_interface<PPB_FlashFullscreen>())
+ if (!has_interface<PPB_FlashFullscreen_0_1>())
return false;
- return PP_ToBool(get_interface<PPB_FlashFullscreen>()->GetScreenSize(
+ return PP_ToBool(get_interface<PPB_FlashFullscreen_0_1>()->GetScreenSize(
instance_.pp_instance(), &size->pp_size()));
}
+bool FlashFullscreen::MustRecreateContexts() {
+ return !get_interface<PPB_FlashFullscreen_1_0>();
+}
+
} // namespace pp
diff --git a/ppapi/cpp/private/flash_fullscreen.h b/ppapi/cpp/private/flash_fullscreen.h
index 224824d..48e4ffd 100644
--- a/ppapi/cpp/private/flash_fullscreen.h
+++ b/ppapi/cpp/private/flash_fullscreen.h
@@ -21,6 +21,8 @@ class FlashFullscreen {
bool SetFullscreen(bool fullscreen);
bool GetScreenSize(Size* size);
+ bool MustRecreateContexts();
+
private:
InstanceHandle instance_;
};
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index 9dfe11d..065c2db 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -207,6 +207,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Clipboard_3_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Clipboard_4_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_DeviceID_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FlashFullscreen_0_1;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FlashFullscreen_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_MessageLoop_0_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_Print_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_TCPSocket_0_2;
@@ -2557,6 +2558,8 @@ int32_t Pnacl_M21_PPB_Flash_DeviceID_GetDeviceID(PP_Resource device_id, struct P
/* Not generating wrapper methods for PPB_FlashFullscreen_0_1 */
+/* Not generating wrapper methods for PPB_FlashFullscreen_1_0 */
+
/* Not generating wrapper methods for PPB_Flash_MessageLoop_0_1 */
/* Not generating wrapper methods for PPB_Flash_Print_1_0 */
@@ -3930,6 +3933,8 @@ struct PPB_Flash_DeviceID_1_0 Pnacl_Wrappers_PPB_Flash_DeviceID_1_0 = {
/* Not generating wrapper interface for PPB_FlashFullscreen_0_1 */
+/* Not generating wrapper interface for PPB_FlashFullscreen_1_0 */
+
/* Not generating wrapper interface for PPB_Flash_MessageLoop_0_1 */
/* Not generating wrapper interface for PPB_Flash_Print_1_0 */
@@ -4719,6 +4724,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FlashFullscreen_0_1 = {
.real_iface = NULL
};
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FlashFullscreen_1_0 = {
+ .iface_macro = PPB_FLASHFULLSCREEN_INTERFACE_1_0,
+ .wrapped_iface = NULL /* Still need slot for real_iface */,
+ .real_iface = NULL
+};
+
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_MessageLoop_0_1 = {
.iface_macro = PPB_FLASH_MESSAGELOOP_INTERFACE_0_1,
.wrapped_iface = NULL /* Still need slot for real_iface */,
@@ -4941,6 +4952,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = {
&Pnacl_WrapperInfo_PPB_Flash_Clipboard_4_0,
&Pnacl_WrapperInfo_PPB_Flash_DeviceID_1_0,
&Pnacl_WrapperInfo_PPB_FlashFullscreen_0_1,
+ &Pnacl_WrapperInfo_PPB_FlashFullscreen_1_0,
&Pnacl_WrapperInfo_PPB_Flash_MessageLoop_0_1,
&Pnacl_WrapperInfo_PPB_Flash_Print_1_0,
&Pnacl_WrapperInfo_PPB_Flash_TCPSocket_0_2,
diff --git a/ppapi/thunk/interfaces_ppb_private.h b/ppapi/thunk/interfaces_ppb_private.h
index a3c800d..6c3efc2 100644
--- a/ppapi/thunk/interfaces_ppb_private.h
+++ b/ppapi/thunk/interfaces_ppb_private.h
@@ -39,6 +39,8 @@ PROXIED_IFACE(PPB_HostResolver_Private, PPB_HOSTRESOLVER_PRIVATE_INTERFACE_0_1,
PPB_HostResolver_Private_0_1)
PROXIED_IFACE(PPB_Instance, PPB_FLASHFULLSCREEN_INTERFACE_0_1,
PPB_FlashFullscreen_0_1)
+PROXIED_IFACE(PPB_Instance, PPB_FLASHFULLSCREEN_INTERFACE_1_0,
+ PPB_FlashFullscreen_0_1)
PROXIED_IFACE(NoAPIName, PPB_NETADDRESS_PRIVATE_INTERFACE_0_1,
PPB_NetAddress_Private_0_1)
PROXIED_IFACE(NoAPIName, PPB_NETADDRESS_PRIVATE_INTERFACE_1_0,
diff --git a/ppapi/thunk/ppb_flash_fullscreen_thunk.cc b/ppapi/thunk/ppb_flash_fullscreen_thunk.cc
index 4b2d1ec..598dc71 100644
--- a/ppapi/thunk/ppb_flash_fullscreen_thunk.cc
+++ b/ppapi/thunk/ppb_flash_fullscreen_thunk.cc
@@ -37,7 +37,7 @@ PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) {
return enter.functions()->GetFlashAPI()->FlashGetScreenSize(instance, size);
}
-const PPB_FlashFullscreen g_ppb_flash_fullscreen_thunk = {
+const PPB_FlashFullscreen_0_1 g_ppb_flash_fullscreen_thunk = {
&IsFullscreen,
&SetFullscreen,
&GetScreenSize
diff --git a/webkit/plugins/ppapi/fullscreen_container.h b/webkit/plugins/ppapi/fullscreen_container.h
index 88500cd..284386b 100644
--- a/webkit/plugins/ppapi/fullscreen_container.h
+++ b/webkit/plugins/ppapi/fullscreen_container.h
@@ -39,6 +39,8 @@ class FullscreenContainer {
virtual PluginDelegate::PlatformContext3D* CreateContext3D() = 0;
+ virtual void ReparentContext(PluginDelegate::PlatformContext3D*) = 0;
+
// The returned object is owned by FullscreenContainer.
virtual MouseLockDispatcher* GetMouseLockDispatcher() = 0;
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc
index 7f3c228..c77e904 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.cc
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc
@@ -79,6 +79,9 @@ MockPluginDelegate::PlatformImage2D* MockPluginDelegate::CreateImage2D(
MockPluginDelegate::PlatformContext3D* MockPluginDelegate::CreateContext3D() {
return NULL;
}
+void MockPluginDelegate::ReparentContext(
+ MockPluginDelegate::PlatformContext3D* context) {
+}
MockPluginDelegate::PlatformVideoDecoder*
MockPluginDelegate::CreateVideoDecoder(
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h
index c899e8d..ed5b857 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.h
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.h
@@ -39,6 +39,7 @@ class MockPluginDelegate : public PluginDelegate {
virtual WebKit::WebPlugin* CreatePluginReplacement(const FilePath& file_path);
virtual PlatformImage2D* CreateImage2D(int width, int height);
virtual PlatformContext3D* CreateContext3D();
+ virtual void ReparentContext(PlatformContext3D*);
virtual PlatformVideoDecoder* CreateVideoDecoder(
media::VideoDecodeAccelerator::Client* client,
int32 command_buffer_route_id);
diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h
index 04063db..e65beca 100644
--- a/webkit/plugins/ppapi/plugin_delegate.h
+++ b/webkit/plugins/ppapi/plugin_delegate.h
@@ -365,6 +365,9 @@ class PluginDelegate {
// The caller will own the pointer returned from this.
virtual PlatformContext3D* CreateContext3D() = 0;
+ // Set that the context will now present to the delegate.
+ virtual void ReparentContext(PlatformContext3D*) = 0;
+
// If |device_id| is empty, the default video capture device will be used. The
// user can start using the returned object to capture video right away.
// Otherwise, the specified device will be used. The user needs to wait till
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 591f264..2dbec46 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -1607,6 +1607,7 @@ bool PluginInstance::SetFullscreen(bool fullscreen) {
}
void PluginInstance::FlashSetFullscreen(bool fullscreen, bool delay_report) {
+ TRACE_EVENT0("ppapi", "PluginInstance::FlashSetFullscreen");
// Keep a reference on the stack. See NOTE above.
scoped_refptr<PluginInstance> ref(this);
@@ -1617,10 +1618,10 @@ void PluginInstance::FlashSetFullscreen(bool fullscreen, bool delay_report) {
return;
// Unbind current 2D or 3D graphics context.
- BindGraphics(pp_instance(), 0);
VLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off");
if (fullscreen) {
DCHECK(!fullscreen_container_);
+ setBackingTextureId(0, false);
fullscreen_container_ = delegate_->CreateFullscreenContainer(this);
} else {
DCHECK(fullscreen_container_);
@@ -1646,6 +1647,17 @@ void PluginInstance::UpdateFlashFullscreenState(bool flash_fullscreen) {
return;
}
+ PPB_Graphics3D_Impl* graphics_3d = GetBoundGraphics3D();
+ if (graphics_3d) {
+ if (flash_fullscreen) {
+ fullscreen_container_->ReparentContext(graphics_3d->platform_context());
+ } else {
+ delegate_->ReparentContext(graphics_3d->platform_context());
+ setBackingTextureId(graphics_3d->GetBackingTextureId(),
+ graphics_3d->IsOpaque());
+ }
+ }
+
bool old_plugin_focus = PluginHasFocus();
flash_fullscreen_ = flash_fullscreen;
if (is_mouselock_pending && !delegate()->IsMouseLocked(this)) {
@@ -2008,6 +2020,7 @@ void PluginInstance::ClosePendingUserGesture(PP_Instance instance,
PP_Bool PluginInstance::BindGraphics(PP_Instance instance,
PP_Resource device) {
+ TRACE_EVENT0("ppapi", "PluginInstance::BindGraphics");
// The Graphics3D instance can't be destroyed until we call
// setBackingTextureId.
scoped_refptr< ::ppapi::Resource> old_graphics = bound_graphics_;