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

Side by Side Diff: mojo/services/gles2/command_buffer_impl.cc

Issue 217813004: Make ShaderTranslatorCache thread safe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gpu/gles2_conform_support/egl/display.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/services/gles2/command_buffer_impl.h" 5 #include "mojo/services/gles2/command_buffer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 9
10 #include "gpu/command_buffer/common/constants.h" 10 #include "gpu/command_buffer/common/constants.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 // TODO(piman): context sharing, virtual contexts, gpu preference. 71 // TODO(piman): context sharing, virtual contexts, gpu preference.
72 scoped_refptr<gfx::GLContext> context = gfx::GLContext::CreateGLContext( 72 scoped_refptr<gfx::GLContext> context = gfx::GLContext::CreateGLContext(
73 NULL, surface.get(), gfx::PreferIntegratedGpu); 73 NULL, surface.get(), gfx::PreferIntegratedGpu);
74 if (!context.get()) 74 if (!context.get())
75 return false; 75 return false;
76 76
77 if (!context->MakeCurrent(surface.get())) 77 if (!context->MakeCurrent(surface.get()))
78 return false; 78 return false;
79 79
80 // TODO(piman): ShaderTranslatorCache is currently per-ContextGroup but
81 // only needs to be per-thread.
80 scoped_refptr<gpu::gles2::ContextGroup> context_group = 82 scoped_refptr<gpu::gles2::ContextGroup> context_group =
81 new gpu::gles2::ContextGroup( 83 new gpu::gles2::ContextGroup(NULL,
82 NULL, NULL, new MemoryTrackerStub(), NULL, true); 84 NULL,
85 new MemoryTrackerStub,
86 new gpu::gles2::ShaderTranslatorCache,
87 NULL,
88 true);
89
83 command_buffer_.reset( 90 command_buffer_.reset(
84 new gpu::CommandBufferService(context_group->transfer_buffer_manager())); 91 new gpu::CommandBufferService(context_group->transfer_buffer_manager()));
85 bool result = command_buffer_->Initialize(); 92 bool result = command_buffer_->Initialize();
86 DCHECK(result); 93 DCHECK(result);
87 94
88 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get())); 95 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get()));
89 scheduler_.reset(new gpu::GpuScheduler( 96 scheduler_.reset(new gpu::GpuScheduler(
90 command_buffer_.get(), decoder_.get(), decoder_.get())); 97 command_buffer_.get(), decoder_.get(), decoder_.get()));
91 decoder_->set_engine(scheduler_.get()); 98 decoder_->set_engine(scheduler_.get());
92 99
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 185
179 void CommandBufferImpl::OnParseError() { 186 void CommandBufferImpl::OnParseError() {
180 gpu::CommandBuffer::State state = command_buffer_->GetState(); 187 gpu::CommandBuffer::State state = command_buffer_->GetState();
181 client_->LostContext(state.context_lost_reason); 188 client_->LostContext(state.context_lost_reason);
182 } 189 }
183 190
184 void CommandBufferImpl::DrawAnimationFrame() { client_->DrawAnimationFrame(); } 191 void CommandBufferImpl::DrawAnimationFrame() { client_->DrawAnimationFrame(); }
185 192
186 } // namespace services 193 } // namespace services
187 } // namespace mojo 194 } // namespace mojo
OLDNEW
« no previous file with comments | « gpu/gles2_conform_support/egl/display.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698