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

Unified Diff: gpu/command_buffer/client/gl_in_process_context.cc

Issue 143023005: Support multiple service instances with GLInProcessContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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: gpu/command_buffer/client/gl_in_process_context.cc
diff --git a/gpu/command_buffer/client/gl_in_process_context.cc b/gpu/command_buffer/client/gl_in_process_context.cc
index 3c19c4d22fb40d78453c75f8c10a6aea746dc552..d9a258eaf291a7be629fc2d9455be95d8b5c8af0 100644
--- a/gpu/command_buffer/client/gl_in_process_context.cc
+++ b/gpu/command_buffer/client/gl_in_process_context.cc
@@ -26,7 +26,6 @@
#include "gpu/command_buffer/client/transfer_buffer.h"
#include "gpu/command_buffer/common/command_buffer.h"
#include "gpu/command_buffer/common/constants.h"
-#include "gpu/command_buffer/service/in_process_command_buffer.h"
#include "ui/gfx/size.h"
#include "ui/gl/gl_image.h"
@@ -52,13 +51,16 @@ class GLInProcessContextImpl
explicit GLInProcessContextImpl();
virtual ~GLInProcessContextImpl();
- bool Initialize(scoped_refptr<gfx::GLSurface> surface,
- bool is_offscreen,
- bool share_resources,
- gfx::AcceleratedWidget window,
- const gfx::Size& size,
- const GLInProcessContextAttribs& attribs,
- gfx::GpuPreference gpu_preference);
+ bool Initialize(
+ scoped_refptr<gfx::GLSurface> surface,
+ bool is_offscreen,
+ bool use_global_share_group,
+ GLInProcessContext* share_context,
+ gfx::AcceleratedWidget window,
+ const gfx::Size& size,
+ const GLInProcessContextAttribs& attribs,
+ gfx::GpuPreference gpu_preference,
+ const scoped_refptr<InProcessCommandBuffer::Service>& service);
// GLInProcessContext implementation:
virtual void SetContextLostCallback(const base::Closure& callback) OVERRIDE;
@@ -120,11 +122,14 @@ void GLInProcessContextImpl::OnContextLost() {
bool GLInProcessContextImpl::Initialize(
scoped_refptr<gfx::GLSurface> surface,
bool is_offscreen,
- bool share_resources,
+ bool use_global_share_group,
+ GLInProcessContext* share_context,
gfx::AcceleratedWidget window,
const gfx::Size& size,
const GLInProcessContextAttribs& attribs,
- gfx::GpuPreference gpu_preference) {
+ gfx::GpuPreference gpu_preference,
+ const scoped_refptr<InProcessCommandBuffer::Service>& service) {
+ DCHECK(!use_global_share_group || !share_context);
DCHECK(size.width() >= 0 && size.height() >= 0);
// Changes to these values should also be copied to
@@ -184,12 +189,12 @@ bool GLInProcessContextImpl::Initialize(
base::Closure wrapped_callback =
base::Bind(&GLInProcessContextImpl::OnContextLost, AsWeakPtr());
- command_buffer_.reset(new InProcessCommandBuffer());
+ command_buffer_.reset(new InProcessCommandBuffer(service));
scoped_ptr<base::AutoLock> scoped_shared_context_lock;
scoped_refptr<gles2::ShareGroup> share_group;
InProcessCommandBuffer* share_command_buffer = NULL;
- if (share_resources) {
+ if (use_global_share_group) {
scoped_shared_context_lock.reset(
new base::AutoLock(g_all_shared_contexts_lock.Get()));
for (std::set<GLInProcessContextImpl*>::const_iterator it =
@@ -205,7 +210,15 @@ bool GLInProcessContextImpl::Initialize(
break;
}
}
+ } else if (share_context) {
+ GLInProcessContextImpl* impl =
+ static_cast<GLInProcessContextImpl*>(share_context);
+ share_group = impl->gles2_implementation_->share_group();
+ share_command_buffer = impl->command_buffer_.get();
+ DCHECK(share_group);
+ DCHECK(share_command_buffer);
}
+
if (!command_buffer_->Initialize(surface,
is_offscreen,
window,
@@ -241,7 +254,7 @@ bool GLInProcessContextImpl::Initialize(
free_everything_when_invisible,
command_buffer_.get()));
- if (share_resources) {
+ if (use_global_share_group) {
g_all_shared_contexts.Get().insert(this);
scoped_shared_context_lock.reset();
}
@@ -307,10 +320,12 @@ GLInProcessContext* GLInProcessContext::CreateContext(
NULL /* surface */,
is_offscreen,
share_resources,
+ NULL,
window,
size,
attribs,
- gpu_preference))
+ gpu_preference,
+ scoped_refptr<InProcessCommandBuffer::Service>()))
return NULL;
return context.release();
@@ -319,7 +334,8 @@ GLInProcessContext* GLInProcessContext::CreateContext(
// static
GLInProcessContext* GLInProcessContext::CreateWithSurface(
scoped_refptr<gfx::GLSurface> surface,
- bool share_resources,
+ scoped_refptr<gpu::InProcessCommandBuffer::Service> service,
+ GLInProcessContext* share_context,
const GLInProcessContextAttribs& attribs,
gfx::GpuPreference gpu_preference) {
scoped_ptr<GLInProcessContextImpl> context(
@@ -327,11 +343,13 @@ GLInProcessContext* GLInProcessContext::CreateWithSurface(
if (!context->Initialize(
surface,
surface->IsOffscreen(),
- share_resources,
+ false,
+ share_context,
gfx::kNullAcceleratedWidget,
surface->GetSize(),
attribs,
- gpu_preference))
+ gpu_preference,
+ service))
return NULL;
return context.release();
« no previous file with comments | « gpu/command_buffer/client/gl_in_process_context.h ('k') | gpu/command_buffer/service/in_process_command_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698