OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "gpu/ipc/gpu_in_process_thread_service.h" |
| 6 |
| 7 #include "base/lazy_instance.h" |
| 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 |
| 10 namespace gpu { |
| 11 |
| 12 GpuInProcessThreadService::GpuInProcessThreadService( |
| 13 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 14 gpu::SyncPointManager* sync_point_manager, |
| 15 gpu::gles2::MailboxManager* mailbox_manager, |
| 16 scoped_refptr<gl::GLShareGroup> share_group) |
| 17 : gpu::InProcessCommandBuffer::Service(mailbox_manager, share_group), |
| 18 task_runner_(task_runner), |
| 19 sync_point_manager_(sync_point_manager) {} |
| 20 |
| 21 void GpuInProcessThreadService::ScheduleTask(const base::Closure& task) { |
| 22 task_runner_->PostTask(FROM_HERE, task); |
| 23 } |
| 24 |
| 25 void GpuInProcessThreadService::ScheduleDelayedWork(const base::Closure& task) { |
| 26 task_runner_->PostDelayedTask(FROM_HERE, task, |
| 27 base::TimeDelta::FromMilliseconds(2)); |
| 28 } |
| 29 bool GpuInProcessThreadService::UseVirtualizedGLContexts() { |
| 30 return true; |
| 31 } |
| 32 |
| 33 scoped_refptr<gpu::gles2::ShaderTranslatorCache> |
| 34 GpuInProcessThreadService::shader_translator_cache() { |
| 35 if (!shader_translator_cache_) { |
| 36 shader_translator_cache_ = make_scoped_refptr( |
| 37 new gpu::gles2::ShaderTranslatorCache(gpu_preferences())); |
| 38 } |
| 39 return shader_translator_cache_; |
| 40 } |
| 41 |
| 42 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
| 43 GpuInProcessThreadService::framebuffer_completeness_cache() { |
| 44 if (!framebuffer_completeness_cache_.get()) { |
| 45 framebuffer_completeness_cache_ = |
| 46 make_scoped_refptr(new gpu::gles2::FramebufferCompletenessCache); |
| 47 } |
| 48 return framebuffer_completeness_cache_; |
| 49 } |
| 50 |
| 51 gpu::SyncPointManager* GpuInProcessThreadService::sync_point_manager() { |
| 52 return sync_point_manager_; |
| 53 } |
| 54 |
| 55 void GpuInProcessThreadService::AddRef() const { |
| 56 base::RefCountedThreadSafe<GpuInProcessThreadService>::AddRef(); |
| 57 } |
| 58 |
| 59 void GpuInProcessThreadService::Release() const { |
| 60 base::RefCountedThreadSafe<GpuInProcessThreadService>::Release(); |
| 61 } |
| 62 |
| 63 bool GpuInProcessThreadService::BlockThreadOnWaitSyncToken() const { |
| 64 return false; |
| 65 } |
| 66 |
| 67 GpuInProcessThreadService::~GpuInProcessThreadService() {} |
| 68 |
| 69 } // namespace gpu |
OLD | NEW |