From ebebd706bf470fc11f7ffba25b791e2548d82b87 Mon Sep 17 00:00:00 2001 From: "thakis@chromium.org" Date: Tue, 24 Aug 2010 02:54:40 +0000 Subject: Mac: Correctly show/hide compositor on navigations. The problem was that unlike plugins, the compositor surface is not destroyed on navigation, only a variable is_gpu_rendering_active is updated. The fix is to tell the RenderWidgetHostView if this variable changed and then to adapt the visibility of the view rendering the compositing layer accordingly. Also, destroy its AcceleratedSurfaceContainer when the compositor is destroyed. BUG=52134,51748 TEST=go to http://webkit.org/blog/386/3d-transforms/, then hit back. page should redraw on back button. go forward, should work too. Review URL: http://codereview.chromium.org/3132038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57135 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/webgles2context_impl.cc | 20 +++++++++++++++++--- chrome/renderer/webgles2context_impl.h | 8 ++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'chrome/renderer') diff --git a/chrome/renderer/webgles2context_impl.cc b/chrome/renderer/webgles2context_impl.cc index d0e35d7..b4241e1 100644 --- a/chrome/renderer/webgles2context_impl.cc +++ b/chrome/renderer/webgles2context_impl.cc @@ -12,7 +12,13 @@ #include "third_party/WebKit/WebKit/chromium/public/WebView.h" -WebGLES2ContextImpl::WebGLES2ContextImpl() : context_(NULL) { +WebGLES2ContextImpl::WebGLES2ContextImpl() + : context_(NULL) +#if defined(OS_MACOSX) + , plugin_handle_(gfx::kNullPluginWindow) + , web_view_(NULL) +#endif + { } WebGLES2ContextImpl::~WebGLES2ContextImpl() { @@ -49,8 +55,9 @@ bool WebGLES2ContextImpl::initialize( #if !defined(OS_MACOSX) view_id = renderview->host_window(); #else - view_id = static_cast( - renderview->AllocateFakePluginWindowHandle(true, true)); + plugin_handle_ = renderview->AllocateFakePluginWindowHandle(true, true); + web_view_ = web_view; + view_id = static_cast(plugin_handle_); #endif context_ = ggl::CreateViewContext( host, view_id, @@ -76,6 +83,13 @@ bool WebGLES2ContextImpl::makeCurrent() { } bool WebGLES2ContextImpl::destroy() { +#if defined(OS_MACOSX) + RenderView* renderview = RenderView::FromWebView(web_view_); + DCHECK(plugin_handle_ == gfx::kNullPluginWindow || renderview); + if (plugin_handle_ != gfx::kNullPluginWindow && renderview) + renderview->DestroyFakePluginWindowHandle(plugin_handle_); + plugin_handle_ = gfx::kNullPluginWindow; +#endif return ggl::DestroyContext(context_); } diff --git a/chrome/renderer/webgles2context_impl.h b/chrome/renderer/webgles2context_impl.h index e8c267e..d77313b 100644 --- a/chrome/renderer/webgles2context_impl.h +++ b/chrome/renderer/webgles2context_impl.h @@ -12,6 +12,10 @@ #include "third_party/WebKit/WebKit/chromium/public/WebGLES2Context.h" #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" +#if defined(OS_MACOSX) +#include "gfx/native_widget_types.h" +#endif + class WebGLES2ContextImpl : public WebKit::WebGLES2Context { public: WebGLES2ContextImpl(); @@ -36,7 +40,11 @@ class WebGLES2ContextImpl : public WebKit::WebGLES2Context { private: // The GGL context we use for OpenGL rendering. ggl::Context* context_; + +#if defined(OS_MACOSX) + gfx::PluginWindowHandle plugin_handle_; WebKit::WebView* web_view_; +#endif }; #endif // defined(ENABLE_GPU) -- cgit v1.1