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

Unified Diff: gpu/command_buffer/service/in_process_command_buffer.cc

Issue 217813004: Make ShaderTranslatorCache thread safe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 6 years, 9 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/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 71faba607c77c4312655e3dbead04ccfaec2118f..0411806916805c306e093b0b6d38f840c067cf31 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.cc
+++ b/gpu/command_buffer/service/in_process_command_buffer.cc
@@ -73,11 +73,14 @@ class GpuInProcessThread
virtual void ScheduleTask(const base::Closure& task) OVERRIDE;
virtual void ScheduleIdleWork(const base::Closure& callback) OVERRIDE;
virtual bool UseVirtualizedGLContexts() OVERRIDE { return false; }
+ virtual scoped_refptr<gles2::ShaderTranslatorCache> shader_translator_cache()
+ OVERRIDE;
private:
virtual ~GpuInProcessThread();
friend class base::RefCountedThreadSafe<GpuInProcessThread>;
+ scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_;
DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread);
};
@@ -98,6 +101,13 @@ void GpuInProcessThread::ScheduleIdleWork(const base::Closure& callback) {
FROM_HERE, callback, base::TimeDelta::FromMilliseconds(5));
}
+scoped_refptr<gles2::ShaderTranslatorCache>
+GpuInProcessThread::shader_translator_cache() {
+ if (!shader_translator_cache_.get())
+ shader_translator_cache_ = new gpu::gles2::ShaderTranslatorCache;
+ return shader_translator_cache_;
+}
+
base::LazyInstance<std::set<InProcessCommandBuffer*> > default_thread_clients_ =
LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<base::Lock> default_thread_clients_lock_ =
@@ -325,12 +335,14 @@ bool InProcessCommandBuffer::InitializeOnGpuThread(
bool bind_generates_resource = false;
decoder_.reset(gles2::GLES2Decoder::Create(
- params.context_group ? params.context_group->decoder_->GetContextGroup()
- : new gles2::ContextGroup(NULL,
- NULL,
- NULL,
- NULL,
- bind_generates_resource)));
+ params.context_group
+ ? params.context_group->decoder_->GetContextGroup()
+ : new gles2::ContextGroup(NULL,
+ NULL,
+ NULL,
+ service_->shader_translator_cache(),
+ NULL,
+ bind_generates_resource)));
gpu_scheduler_.reset(
new GpuScheduler(command_buffer.get(), decoder_.get(), decoder_.get()));
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.h ('k') | gpu/command_buffer/service/shader_translator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698