| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <queue> | 10 #include <queue> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/threading/thread_local.h" | 17 #include "base/threading/thread_local.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 19 #include "gpu/command_buffer/service/in_process_command_buffer.h" | 20 #include "gpu/command_buffer/service/in_process_command_buffer.h" |
| 20 | 21 |
| 21 namespace gpu { | 22 namespace gpu { |
| 22 class SyncPointManager; | 23 class SyncPointManager; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace android_webview { | 26 namespace android_webview { |
| 26 | 27 |
| 27 class ScopedAllowGL { | 28 class ScopedAllowGL { |
| 28 public: | 29 public: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 67 |
| 67 protected: | 68 protected: |
| 68 ~DeferredGpuCommandService() override; | 69 ~DeferredGpuCommandService() override; |
| 69 friend class base::RefCountedThreadSafe<DeferredGpuCommandService>; | 70 friend class base::RefCountedThreadSafe<DeferredGpuCommandService>; |
| 70 | 71 |
| 71 private: | 72 private: |
| 72 friend class ScopedAllowGL; | 73 friend class ScopedAllowGL; |
| 73 static void RequestProcessGL(bool for_idle); | 74 static void RequestProcessGL(bool for_idle); |
| 74 | 75 |
| 75 DeferredGpuCommandService(); | 76 DeferredGpuCommandService(); |
| 77 void InitGpuPreferences(); |
| 76 size_t IdleQueueSize(); | 78 size_t IdleQueueSize(); |
| 77 | 79 |
| 78 base::Lock tasks_lock_; | 80 base::Lock tasks_lock_; |
| 81 gpu::GpuPreferences gpu_preferences_; |
| 79 std::queue<base::Closure> tasks_; | 82 std::queue<base::Closure> tasks_; |
| 80 std::queue<std::pair<base::Time, base::Closure> > idle_tasks_; | 83 std::queue<std::pair<base::Time, base::Closure> > idle_tasks_; |
| 81 | 84 |
| 82 scoped_ptr<gpu::SyncPointManager> sync_point_manager_; | 85 scoped_ptr<gpu::SyncPointManager> sync_point_manager_; |
| 83 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 86 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
| 84 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> | 87 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
| 85 framebuffer_completeness_cache_; | 88 framebuffer_completeness_cache_; |
| 86 DISALLOW_COPY_AND_ASSIGN(DeferredGpuCommandService); | 89 DISALLOW_COPY_AND_ASSIGN(DeferredGpuCommandService); |
| 87 }; | 90 }; |
| 88 | 91 |
| 89 } // namespace android_webview | 92 } // namespace android_webview |
| 90 | 93 |
| 91 #endif // ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_ | 94 #endif // ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_ |
| OLD | NEW |