summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-10 19:20:05 +0000
committerboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-10 19:20:05 +0000
commit7dfcda1c8c3523433d052d3f6bd9031bd3aab7bf (patch)
treed2fa809104648c7d20ae8296d17c7114a77f1d4a /gpu
parent188d11b3bc1156441d2b71fb3db295a5f119b067 (diff)
downloadchromium_src-7dfcda1c8c3523433d052d3f6bd9031bd3aab7bf.zip
chromium_src-7dfcda1c8c3523433d052d3f6bd9031bd3aab7bf.tar.gz
chromium_src-7dfcda1c8c3523433d052d3f6bd9031bd3aab7bf.tar.bz2
Clean up SyncCompositorFactory context creation
Separate out context creation that does not need surface or service into separate CreateOffscreenContext call. Do not create GLSurfaceStubs on client side, and pass in NULL window so the context creates GLSurfaceStubs on service side. Clean up share context code since compositor does not need an offscreen context anymore. BUG=370566 Review URL: https://codereview.chromium.org/271763002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269618 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/client/gl_in_process_context.cc38
-rw-r--r--gpu/command_buffer/client/gl_in_process_context.h20
2 files changed, 37 insertions, 21 deletions
diff --git a/gpu/command_buffer/client/gl_in_process_context.cc b/gpu/command_buffer/client/gl_in_process_context.cc
index 2b5e559..33d4156 100644
--- a/gpu/command_buffer/client/gl_in_process_context.cc
+++ b/gpu/command_buffer/client/gl_in_process_context.cc
@@ -337,25 +337,33 @@ GLInProcessContext* GLInProcessContext::CreateContext(
return context.release();
}
-// static
-GLInProcessContext* GLInProcessContext::CreateWithSurface(
- scoped_refptr<gfx::GLSurface> surface,
+GLInProcessContext* GLInProcessContext::Create(
scoped_refptr<gpu::InProcessCommandBuffer::Service> service,
+ scoped_refptr<gfx::GLSurface> surface,
+ bool is_offscreen,
+ gfx::AcceleratedWidget window,
+ const gfx::Size& size,
GLInProcessContext* share_context,
+ bool use_global_share_group,
const GLInProcessContextAttribs& attribs,
gfx::GpuPreference gpu_preference) {
- scoped_ptr<GLInProcessContextImpl> context(
- new GLInProcessContextImpl());
- if (!context->Initialize(
- surface,
- surface->IsOffscreen(),
- false,
- share_context,
- gfx::kNullAcceleratedWidget,
- surface->GetSize(),
- attribs,
- gpu_preference,
- service))
+ DCHECK(!use_global_share_group || !share_context);
+ if (surface.get()) {
+ DCHECK_EQ(surface->IsOffscreen(), is_offscreen);
+ DCHECK(surface->GetSize() == size);
+ DCHECK_EQ(gfx::kNullAcceleratedWidget, window);
+ }
+
+ scoped_ptr<GLInProcessContextImpl> context(new GLInProcessContextImpl());
+ if (!context->Initialize(surface,
+ is_offscreen,
+ use_global_share_group,
+ share_context,
+ gfx::kNullAcceleratedWidget,
+ size,
+ attribs,
+ gpu_preference,
+ service))
return NULL;
return context.release();
diff --git a/gpu/command_buffer/client/gl_in_process_context.h b/gpu/command_buffer/client/gl_in_process_context.h
index 60a1665..c1478b1 100644
--- a/gpu/command_buffer/client/gl_in_process_context.h
+++ b/gpu/command_buffer/client/gl_in_process_context.h
@@ -52,6 +52,7 @@ class GL_IN_PROCESS_CONTEXT_EXPORT GLInProcessContext {
// Create a GLInProcessContext, if |is_offscreen| is true, renders to an
// offscreen context. |attrib_list| must be NULL or a NONE-terminated list
// of attribute/value pairs.
+ // TODO(boliu): Fix all callsites to use Create and remove this.
static GLInProcessContext* CreateContext(
bool is_offscreen,
gfx::AcceleratedWidget window,
@@ -60,14 +61,21 @@ class GL_IN_PROCESS_CONTEXT_EXPORT GLInProcessContext {
const GLInProcessContextAttribs& attribs,
gfx::GpuPreference gpu_preference);
- // Create context with the provided GLSurface. All other arguments match
- // CreateContext factory above. Can only be called if the command buffer
- // service runs on the same thread as this client because GLSurface is not
- // thread safe.
- static GLInProcessContext* CreateWithSurface(
- scoped_refptr<gfx::GLSurface> surface,
+ // If |surface| is not NULL, then it must match |is_offscreen| and |size|,
+ // |window| must be gfx::kNullAcceleratedWidget, and the command buffer
+ // service must run on the same thread as this client because GLSurface is
+ // not thread safe. If |surface| is NULL, then the other parameters are used
+ // to correctly create a surface.
+ // Only one of |share_context| and |use_global_share_group| can be used at
+ // the same time.
+ static GLInProcessContext* Create(
scoped_refptr<gpu::InProcessCommandBuffer::Service> service,
+ scoped_refptr<gfx::GLSurface> surface,
+ bool is_offscreen,
+ gfx::AcceleratedWidget window,
+ const gfx::Size& size,
GLInProcessContext* share_context,
+ bool use_global_share_group,
const GLInProcessContextAttribs& attribs,
gfx::GpuPreference gpu_preference);