diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-22 18:16:39 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-22 18:16:39 +0000 |
commit | 9a5afa438ce7f913cfede4bfbe3e719e5adfdd0a (patch) | |
tree | 2d93550e7d0d11219d2d0b0464acb92d73ad32e8 /content | |
parent | 0b2cec69a613d94f2ee72743ba53f539843e85e3 (diff) | |
download | chromium_src-9a5afa438ce7f913cfede4bfbe3e719e5adfdd0a.zip chromium_src-9a5afa438ce7f913cfede4bfbe3e719e5adfdd0a.tar.gz chromium_src-9a5afa438ce7f913cfede4bfbe3e719e5adfdd0a.tar.bz2 |
Reland 93106 - Reparenting of RendererGLContexts supports going from no parent to having a parent.
RendererGLContext::SetParent is a no-op if the parent did not change to avoid a redundant sync IPC.
Added SetParentContext to WebGraphicsContext3DCommandBufferImpl. WebKit change to follow.
Original review: http://codereview.chromium.org/7237009
A patch that this was dependent on was reverting, causing this one to break 2D canvas. The patch is relanded. Relanding this one as well.
Review URL: http://codereview.chromium.org/7488001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93677 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
3 files changed, 13 insertions, 20 deletions
diff --git a/content/renderer/gpu/renderer_gl_context.cc b/content/renderer/gpu/renderer_gl_context.cc index bf2d100..4937a46 100644 --- a/content/renderer/gpu/renderer_gl_context.cc +++ b/content/renderer/gpu/renderer_gl_context.cc @@ -224,6 +224,9 @@ RendererGLContext* RendererGLContext::CreateOffscreenContext( } bool RendererGLContext::SetParent(RendererGLContext* new_parent) { + if (parent_.get() == new_parent) + return true; + // Allocate a texture ID with respect to the parent and change the parent. uint32 new_parent_texture_id = 0; if (command_buffer_) { diff --git a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc index 79d7616..7836744 100644 --- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc +++ b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc @@ -106,7 +106,6 @@ bool WebGraphicsContext3DCommandBufferImpl::initialize( if (web_view && web_view->mainFrame()) active_url = GURL(web_view->mainFrame()->document().url()); - RendererGLContext* parent_context = NULL; if (render_directly_to_web_view) { RenderView* renderview = RenderView::FromWebView(web_view); if (!renderview) @@ -125,22 +124,6 @@ bool WebGraphicsContext3DCommandBufferImpl::initialize( &WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete)); } } else { - bool compositing_enabled = !CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableAcceleratedCompositing); - // If GPU compositing is enabled we need to create a GL context that shares - // resources with the compositor's context. - if (compositing_enabled) { - // Asking for the WebGraphicsContext3D on the WebView will force one to - // be created if it doesn't already exist. When the compositor is created - // for the view it will use the same context. - WebKit::WebGraphicsContext3D* view_context = - web_view->graphicsContext3D(); - if (view_context) { - WebGraphicsContext3DCommandBufferImpl* context_impl = - static_cast<WebGraphicsContext3DCommandBufferImpl*>(view_context); - parent_context = context_impl->context_; - } - } context_ = RendererGLContext::CreateOffscreenContext( host, gfx::Size(1, 1), @@ -152,9 +135,6 @@ bool WebGraphicsContext3DCommandBufferImpl::initialize( if (!context_) return false; - if (!context_->SetParent(parent_context)) - return false; - gl_ = context_->GetImplementation(); context_->SetContextLostCallback( NewCallback(this, @@ -202,6 +182,14 @@ bool WebGraphicsContext3DCommandBufferImpl::isGLES2Compliant() { return true; } +bool WebGraphicsContext3DCommandBufferImpl::setParentContext( + WebGraphicsContext3D* parent_context) { + WebGraphicsContext3DCommandBufferImpl* parent_context_impl = + static_cast<WebGraphicsContext3DCommandBufferImpl*>(parent_context); + return context_->SetParent( + parent_context_impl ? parent_context_impl->context() : NULL); +} + WebGLId WebGraphicsContext3DCommandBufferImpl::getPlatformTextureId() { DCHECK(context_); return context_->GetParentTextureId(); diff --git a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h index 5411502..e291c82 100644 --- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h +++ b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h @@ -64,6 +64,8 @@ class WebGraphicsContext3DCommandBufferImpl virtual bool isGLES2Compliant(); + virtual bool setParentContext(WebGraphicsContext3D* parent_context); + virtual void reshape(int width, int height); virtual bool readBackFramebuffer(unsigned char* pixels, size_t buffer_size); |