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())); |