| 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 99e4b786a0bdcbe9312bddc259358f093c175a9c..c11e01a25ad9ef01b0f08ea60223b60665bef9f0 100644
|
| --- a/gpu/command_buffer/client/gl_in_process_context.cc
|
| +++ b/gpu/command_buffer/client/gl_in_process_context.cc
|
| @@ -57,7 +57,6 @@ class GLInProcessContextImpl
|
|
|
| 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,
|
| @@ -90,28 +89,16 @@ class GLInProcessContextImpl
|
| scoped_ptr<InProcessCommandBuffer> command_buffer_;
|
|
|
| const GLInProcessContextSharedMemoryLimits mem_limits_;
|
| - bool context_lost_;
|
| base::Closure context_lost_callback_;
|
| - base::Lock* lock_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(GLInProcessContextImpl);
|
| };
|
|
|
| -base::LazyInstance<base::Lock> g_all_shared_contexts_lock =
|
| - LAZY_INSTANCE_INITIALIZER;
|
| -base::LazyInstance<std::set<GLInProcessContextImpl*> > g_all_shared_contexts =
|
| - LAZY_INSTANCE_INITIALIZER;
|
| -
|
| GLInProcessContextImpl::GLInProcessContextImpl(
|
| const GLInProcessContextSharedMemoryLimits& mem_limits)
|
| - : mem_limits_(mem_limits), context_lost_(false), lock_(nullptr) {
|
| -}
|
| + : mem_limits_(mem_limits) {}
|
|
|
| GLInProcessContextImpl::~GLInProcessContextImpl() {
|
| - {
|
| - base::AutoLock lock(g_all_shared_contexts_lock.Get());
|
| - g_all_shared_contexts.Get().erase(this);
|
| - }
|
| Destroy();
|
| }
|
|
|
| @@ -124,8 +111,7 @@ size_t GLInProcessContextImpl::GetMappedMemoryLimit() {
|
| }
|
|
|
| void GLInProcessContextImpl::SetLock(base::Lock* lock) {
|
| - command_buffer_->SetLock(lock);
|
| - lock_ = lock;
|
| + NOTREACHED();
|
| }
|
|
|
| void GLInProcessContextImpl::SetContextLostCallback(
|
| @@ -134,19 +120,13 @@ void GLInProcessContextImpl::SetContextLostCallback(
|
| }
|
|
|
| void GLInProcessContextImpl::OnContextLost() {
|
| - scoped_ptr<base::AutoLock> lock;
|
| - if (lock_)
|
| - lock.reset(new base::AutoLock(*lock_));
|
| - context_lost_ = true;
|
| - if (!context_lost_callback_.is_null()) {
|
| + if (!context_lost_callback_.is_null())
|
| context_lost_callback_.Run();
|
| - }
|
| }
|
|
|
| bool GLInProcessContextImpl::Initialize(
|
| scoped_refptr<gfx::GLSurface> surface,
|
| bool is_offscreen,
|
| - bool use_global_share_group,
|
| GLInProcessContext* share_context,
|
| gfx::AcceleratedWidget window,
|
| const gfx::Size& size,
|
| @@ -155,7 +135,6 @@ bool GLInProcessContextImpl::Initialize(
|
| const scoped_refptr<InProcessCommandBuffer::Service>& service,
|
| GpuMemoryBufferManager* gpu_memory_buffer_manager,
|
| ImageFactory* image_factory) {
|
| - DCHECK(!use_global_share_group || !share_context);
|
| DCHECK(size.width() >= 0 && size.height() >= 0);
|
|
|
| std::vector<int32_t> attrib_vector;
|
| @@ -165,31 +144,14 @@ bool GLInProcessContextImpl::Initialize(
|
| base::Bind(&GLInProcessContextImpl::OnContextLost, AsWeakPtr());
|
| 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 (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 =
|
| - g_all_shared_contexts.Get().begin();
|
| - it != g_all_shared_contexts.Get().end();
|
| - it++) {
|
| - const GLInProcessContextImpl* context = *it;
|
| - if (!context->context_lost_) {
|
| - share_group = context->gles2_implementation_->share_group();
|
| - share_command_buffer = context->command_buffer_.get();
|
| - DCHECK(share_group.get());
|
| - DCHECK(share_command_buffer);
|
| - break;
|
| - }
|
| - }
|
| - } else if (share_context) {
|
| + InProcessCommandBuffer* share_command_buffer = nullptr;
|
| + 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.get());
|
| + DCHECK(share_group);
|
| DCHECK(share_command_buffer);
|
| }
|
|
|
| @@ -203,7 +165,7 @@ bool GLInProcessContextImpl::Initialize(
|
| share_command_buffer,
|
| gpu_memory_buffer_manager,
|
| image_factory)) {
|
| - LOG(ERROR) << "Failed to initialize InProcessCommmandBuffer";
|
| + DLOG(ERROR) << "Failed to initialize InProcessCommmandBuffer";
|
| return false;
|
| }
|
|
|
| @@ -233,11 +195,6 @@ bool GLInProcessContextImpl::Initialize(
|
| support_client_side_arrays,
|
| command_buffer_.get()));
|
|
|
| - if (use_global_share_group) {
|
| - g_all_shared_contexts.Get().insert(this);
|
| - scoped_shared_context_lock.reset();
|
| - }
|
| -
|
| if (!gles2_implementation_->Initialize(
|
| mem_limits_.start_transfer_buffer_size,
|
| mem_limits_.min_transfer_buffer_size,
|
| @@ -295,13 +252,11 @@ GLInProcessContext* GLInProcessContext::Create(
|
| gfx::AcceleratedWidget window,
|
| const gfx::Size& size,
|
| GLInProcessContext* share_context,
|
| - bool use_global_share_group,
|
| const ::gpu::gles2::ContextCreationAttribHelper& attribs,
|
| gfx::GpuPreference gpu_preference,
|
| const GLInProcessContextSharedMemoryLimits& memory_limits,
|
| GpuMemoryBufferManager* gpu_memory_buffer_manager,
|
| ImageFactory* image_factory) {
|
| - DCHECK(!use_global_share_group || !share_context);
|
| if (surface.get()) {
|
| DCHECK_EQ(surface->IsOffscreen(), is_offscreen);
|
| DCHECK(surface->GetSize() == size);
|
| @@ -312,7 +267,6 @@ GLInProcessContext* GLInProcessContext::Create(
|
| new GLInProcessContextImpl(memory_limits));
|
| if (!context->Initialize(surface,
|
| is_offscreen,
|
| - use_global_share_group,
|
| share_context,
|
| window,
|
| size,
|
|
|