diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-27 19:21:55 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-27 19:21:55 +0000 |
commit | 2d7c85529b0210e148d70eb3d0edf485d6521708 (patch) | |
tree | 59152cec5d13a4f91b88ffa8610ca9a82f4fdcce /content/browser/renderer_host/render_widget_host.cc | |
parent | be16cf2bcf61a6ac255c347a6ba8c65d213a5a11 (diff) | |
download | chromium_src-2d7c85529b0210e148d70eb3d0edf485d6521708.zip chromium_src-2d7c85529b0210e148d70eb3d0edf485d6521708.tar.gz chromium_src-2d7c85529b0210e148d70eb3d0edf485d6521708.tar.bz2 |
GPU compositing surface handle is no longer sent to renderer process.
Instead it is stored in a map in RenderWidgetHelper indexed by RenderWidgetHost route ID. This allows the UI thread to maintain the mapping as windows are created and destroyed and the IO thread to lookup the mapping in order to create GL contexts that render to the windows.
This avoids a race where JavaScript would open a popup window and immediately try to use an accelerated canvas to render to it (2D canvas or WebGL canvas). <-- This is no longer true of this patch. There was a potential deadlock.
WebGL canvas used to work in this case only because it would fall back to using ReadPixels.
This goes some way to fixing the bug referenced below but does not fix it completely.BUG=80703
Review URL: http://codereview.chromium.org/7136001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90617 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/render_widget_host.cc')
-rw-r--r-- | content/browser/renderer_host/render_widget_host.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc index b962f6e..4e01606 100644 --- a/content/browser/renderer_host/render_widget_host.cc +++ b/content/browser/renderer_host/render_widget_host.cc @@ -98,12 +98,21 @@ RenderWidgetHost::RenderWidgetHost(RenderProcessHost* process, } RenderWidgetHost::~RenderWidgetHost() { + SetView(NULL); + // Clear our current or cached backing store if either remains. BackingStoreManager::RemoveBackingStore(this); process_->Release(routing_id_); } +void RenderWidgetHost::SetView(RenderWidgetHostView* view) { + view_ = view; + + if (!view_) + process_->SetCompositingSurface(routing_id_, gfx::kNullPluginWindow); +} + gfx::NativeViewId RenderWidgetHost::GetNativeViewId() { if (view_) return gfx::IdFromNativeView(view_->GetNativeView()); @@ -127,9 +136,11 @@ void RenderWidgetHost::Init() { renderer_initialized_ = true; + process_->SetCompositingSurface(routing_id_, + GetCompositingSurface()); + // Send the ack along with the information on placement. - Send(new ViewMsg_CreatingNew_ACK( - routing_id_, GetNativeViewId(), GetCompositingSurface())); + Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetNativeViewId())); WasResized(); } @@ -363,7 +374,7 @@ void RenderWidgetHost::LostCapture() { void RenderWidgetHost::ViewDestroyed() { // TODO(evanm): tracking this may no longer be necessary; // eliminate this function if so. - view_ = NULL; + SetView(NULL); } void RenderWidgetHost::SetIsLoading(bool is_loading) { |