summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-20 20:27:36 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-20 20:27:36 +0000
commit5435e933450b28154d6ab7e96bf46c86c2d4962e (patch)
tree7b94c8055d5489e2005fabedd838443c50ea660f /content
parent360c62fe6a83579f565ca660faadf9fc1d087102 (diff)
downloadchromium_src-5435e933450b28154d6ab7e96bf46c86c2d4962e.zip
chromium_src-5435e933450b28154d6ab7e96bf46c86c2d4962e.tar.gz
chromium_src-5435e933450b28154d6ab7e96bf46c86c2d4962e.tar.bz2
Revert 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. Review URL: http://codereview.chromium.org/7237009 TBR=apatrick@chromium.org Review URL: http://codereview.chromium.org/7475001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93244 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/renderer/gpu/renderer_gl_context.cc3
-rw-r--r--content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc28
-rw-r--r--content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h2
3 files changed, 20 insertions, 13 deletions
diff --git a/content/renderer/gpu/renderer_gl_context.cc b/content/renderer/gpu/renderer_gl_context.cc
index 4937a46..bf2d100 100644
--- a/content/renderer/gpu/renderer_gl_context.cc
+++ b/content/renderer/gpu/renderer_gl_context.cc
@@ -224,9 +224,6 @@ 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 04bfe9d..2d825b9 100644
--- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc
+++ b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc
@@ -106,6 +106,7 @@ 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)
@@ -124,6 +125,22 @@ 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),
@@ -135,6 +152,9 @@ bool WebGraphicsContext3DCommandBufferImpl::initialize(
if (!context_)
return false;
+ if (!context_->SetParent(parent_context))
+ return false;
+
gl_ = context_->GetImplementation();
context_->SetContextLostCallback(
NewCallback(this,
@@ -182,14 +202,6 @@ 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 e291c82..5411502 100644
--- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h
+++ b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h
@@ -64,8 +64,6 @@ 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);