Chromium Code Reviews| Index: gpu/command_buffer/service/in_process_command_buffer.cc |
| diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc |
| index 25d57013f2e1dd83f5ace9309efbf1e3fb350ed3..9de7bf8f297f060036432781a79af8110d8693cf 100644 |
| --- a/gpu/command_buffer/service/in_process_command_buffer.cc |
| +++ b/gpu/command_buffer/service/in_process_command_buffer.cc |
| @@ -32,7 +32,6 @@ |
| #include "ui/gl/gl_context.h" |
| #include "ui/gl/gl_image.h" |
| #include "ui/gl/gl_share_group.h" |
| -#include "ui/gl/gl_surface.h" |
| namespace gpu { |
| @@ -287,6 +286,7 @@ bool InProcessCommandBuffer::GetBufferChanged(int32 transfer_buffer_id) { |
| } |
| bool InProcessCommandBuffer::Initialize( |
| + scoped_refptr<gfx::GLSurface> surface, |
|
no sievers
2013/08/05 20:41:09
Hmm, this is dangerous. GLSurface is not RefCounte
boliu
2013/08/05 20:42:52
Bah...good point.
|
| bool is_offscreen, |
| bool share_resources, |
| gfx::AcceleratedWidget window, |
| @@ -300,9 +300,8 @@ bool InProcessCommandBuffer::Initialize( |
| share_resources_ = share_resources; |
| context_lost_callback_ = WrapCallback(context_lost_callback); |
| share_group_id_ = share_group_id; |
| + surface_ = surface; |
| - base::WaitableEvent completion(true, false); |
| - bool result = false; |
| base::Callback<bool(void)> init_task = |
| base::Bind(&InProcessCommandBuffer::InitializeOnGpuThread, |
| base::Unretained(this), |
| @@ -312,6 +311,9 @@ bool InProcessCommandBuffer::Initialize( |
| allowed_extensions, |
| attribs, |
| gpu_preference); |
| + |
| + base::WaitableEvent completion(true, false); |
| + bool result = false; |
| QueueTask( |
| base::Bind(&RunTaskWithResult<bool>, init_task, &result, &completion)); |
| completion.Wait(); |
| @@ -381,10 +383,12 @@ bool InProcessCommandBuffer::InitializeOnGpuThread( |
| decoder_->set_engine(gpu_scheduler_.get()); |
| - if (is_offscreen) |
| - surface_ = gfx::GLSurface::CreateOffscreenGLSurface(size); |
| - else |
| - surface_ = gfx::GLSurface::CreateViewGLSurface(window); |
| + if (!surface_) { |
| + if (is_offscreen) |
| + surface_ = gfx::GLSurface::CreateOffscreenGLSurface(size); |
| + else |
| + surface_ = gfx::GLSurface::CreateViewGLSurface(window); |
| + } |
| if (!surface_.get()) { |
| LOG(ERROR) << "Could not create GLSurface."; |