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

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: protect ShFinalize 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..4f136b3e1c7b4738131ebba3e208148438fdafeb 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.cc
+++ b/gpu/command_buffer/service/in_process_command_buffer.cc
@@ -73,11 +73,13 @@ 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 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 +100,12 @@ void GpuInProcessThread::ScheduleIdleWork(const base::Closure& callback) {
FROM_HERE, callback, base::TimeDelta::FromMilliseconds(5));
}
+gles2::ShaderTranslatorCache* GpuInProcessThread::shader_translator_cache() {
+ if (!shader_translator_cache_.get())
+ shader_translator_cache_ = new gpu::gles2::ShaderTranslatorCache;
+ return shader_translator_cache_.get();
+}
+
base::LazyInstance<std::set<InProcessCommandBuffer*> > default_thread_clients_ =
LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<base::Lock> default_thread_clients_lock_ =
@@ -389,6 +397,7 @@ bool InProcessCommandBuffer::InitializeOnGpuThread(
disallowed_features.gpu_memory_manager = true;
if (!decoder_->Initialize(surface_,
context_,
+ service_->shader_translator_cache(),
params.is_offscreen,
params.size,
disallowed_features,

Powered by Google App Engine
This is Rietveld 408576698