Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2293)

Unified Diff: content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc

Issue 7669072: Use 3D graphics context shareResources flag to decide whether a context should share resources. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc
===================================================================
--- content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc (revision 97282)
+++ content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc (working copy)
@@ -33,7 +33,7 @@
#include "webkit/glue/gl_bindings_skia_cmd_buffer.h"
static base::LazyInstance<std::set<WebGraphicsContext3DCommandBufferImpl*> >
- g_all_contexts(base::LINKER_INITIALIZED);
+ g_all_shared_contexts(base::LINKER_INITIALIZED);
WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl()
: context_(NULL),
@@ -52,7 +52,7 @@
WebGraphicsContext3DCommandBufferImpl::
~WebGraphicsContext3DCommandBufferImpl() {
- g_all_contexts.Pointer()->erase(this);
+ g_all_shared_contexts.Pointer()->erase(this);
delete context_;
}
@@ -93,6 +93,8 @@
RendererGLContext::STENCIL_SIZE, stencil_size,
RendererGLContext::SAMPLES, samples,
RendererGLContext::SAMPLE_BUFFERS, sample_buffers,
+ RendererGLContext::SHARE_RESOURCES, attributes.shareResources ? 1 : 0,
+ RendererGLContext::BIND_GENERATES_RESOURCES, 0,
RendererGLContext::NONE,
};
@@ -113,14 +115,10 @@
if (web_view && web_view->mainFrame())
active_url = GURL(web_view->mainFrame()->document().url());
- // HACK: Assume this is a WebGL context by looking for the noExtensions
- // attribute. WebGL contexts must not go in the share group because they
- // rely on destruction of the context to clean up owned resources. Putting
- // them in a share group would prevent this from happening.
RendererGLContext* share_group = NULL;
- if (!attributes.noExtensions) {
- share_group = g_all_contexts.Pointer()->empty() ?
- NULL : (*g_all_contexts.Pointer()->begin())->context_;
+ if (attributes.shareResources) {
+ share_group = g_all_shared_contexts.Pointer()->empty() ?
+ NULL : (*g_all_shared_contexts.Pointer()->begin())->context_;
}
if (render_directly_to_web_view) {
@@ -132,7 +130,6 @@
context_ = RendererGLContext::CreateViewContext(
host,
renderview->routing_id(),
- !attributes.noExtensions,
share_group,
preferred_extensions,
attribs,
@@ -146,7 +143,6 @@
context_ = RendererGLContext::CreateOffscreenContext(
host,
gfx::Size(1, 1),
- !attributes.noExtensions,
share_group,
preferred_extensions,
attribs,
@@ -184,8 +180,8 @@
attributes_.antialias = samples > 0;
}
- if (!attributes.noExtensions)
- g_all_contexts.Pointer()->insert(this);
+ if (attributes.shareResources)
+ g_all_shared_contexts.Pointer()->insert(this);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698