OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_ |
6 #define ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 DISALLOW_COPY_AND_ASSIGN(ScopedAllowGL); | 27 DISALLOW_COPY_AND_ASSIGN(ScopedAllowGL); |
28 }; | 28 }; |
29 | 29 |
30 // TODO(boliu): Teach this class about RT. | 30 // TODO(boliu): Teach this class about RT. |
31 class DeferredGpuCommandService | 31 class DeferredGpuCommandService |
32 : public gpu::InProcessCommandBuffer::Service, | 32 : public gpu::InProcessCommandBuffer::Service, |
33 public base::RefCountedThreadSafe<DeferredGpuCommandService> { | 33 public base::RefCountedThreadSafe<DeferredGpuCommandService> { |
34 public: | 34 public: |
35 static void SetInstance(); | 35 static void SetInstance(); |
| 36 static DeferredGpuCommandService* GetInstance(); |
36 | 37 |
37 virtual void ScheduleTask(const base::Closure& task) OVERRIDE; | 38 virtual void ScheduleTask(const base::Closure& task) OVERRIDE; |
38 virtual void ScheduleIdleWork(const base::Closure& task) OVERRIDE; | 39 virtual void ScheduleIdleWork(const base::Closure& task) OVERRIDE; |
39 virtual bool UseVirtualizedGLContexts() OVERRIDE; | 40 virtual bool UseVirtualizedGLContexts() OVERRIDE; |
40 virtual scoped_refptr<gpu::gles2::ShaderTranslatorCache> | 41 virtual scoped_refptr<gpu::gles2::ShaderTranslatorCache> |
41 shader_translator_cache() OVERRIDE; | 42 shader_translator_cache() OVERRIDE; |
42 | 43 |
43 void RunTasks(); | 44 void RunTasks(); |
44 | 45 |
45 virtual void AddRef() const OVERRIDE; | 46 virtual void AddRef() const OVERRIDE; |
(...skipping 11 matching lines...) Expand all Loading... |
57 base::Lock tasks_lock_; | 58 base::Lock tasks_lock_; |
58 std::queue<base::Closure> tasks_; | 59 std::queue<base::Closure> tasks_; |
59 | 60 |
60 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 61 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
61 DISALLOW_COPY_AND_ASSIGN(DeferredGpuCommandService); | 62 DISALLOW_COPY_AND_ASSIGN(DeferredGpuCommandService); |
62 }; | 63 }; |
63 | 64 |
64 } // namespace android_webview | 65 } // namespace android_webview |
65 | 66 |
66 #endif // ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_ | 67 #endif // ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_ |
OLD | NEW |