| 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 <memory> | 10 #include <memory> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 void RunTasks(); | 56 void RunTasks(); |
| 57 // If |is_idle| is false, this will only run older idle tasks. | 57 // If |is_idle| is false, this will only run older idle tasks. |
| 58 void PerformIdleWork(bool is_idle); | 58 void PerformIdleWork(bool is_idle); |
| 59 // Flush the idle queue until it is empty. This is different from | 59 // Flush the idle queue until it is empty. This is different from |
| 60 // PerformIdleWork(is_idle = true), which does not run any newly scheduled | 60 // PerformIdleWork(is_idle = true), which does not run any newly scheduled |
| 61 // idle tasks during the idle run. | 61 // idle tasks during the idle run. |
| 62 void PerformAllIdleWork(); | 62 void PerformAllIdleWork(); |
| 63 | 63 |
| 64 void AddRef() const override; | 64 void AddRef() const override; |
| 65 void Release() const override; | 65 void Release() const override; |
| 66 bool BlockThreadOnWaitSyncToken() const override; |
| 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(); |
| 76 size_t IdleQueueSize(); | 77 size_t IdleQueueSize(); |
| 77 | 78 |
| 78 base::Lock tasks_lock_; | 79 base::Lock tasks_lock_; |
| 79 std::queue<base::Closure> tasks_; | 80 std::queue<base::Closure> tasks_; |
| 80 std::queue<std::pair<base::Time, base::Closure> > idle_tasks_; | 81 std::queue<std::pair<base::Time, base::Closure> > idle_tasks_; |
| 81 | 82 |
| 82 std::unique_ptr<gpu::SyncPointManager> sync_point_manager_; | 83 std::unique_ptr<gpu::SyncPointManager> sync_point_manager_; |
| 83 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 84 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
| 84 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> | 85 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
| 85 framebuffer_completeness_cache_; | 86 framebuffer_completeness_cache_; |
| 86 DISALLOW_COPY_AND_ASSIGN(DeferredGpuCommandService); | 87 DISALLOW_COPY_AND_ASSIGN(DeferredGpuCommandService); |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 } // namespace android_webview | 90 } // namespace android_webview |
| 90 | 91 |
| 91 #endif // ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_ | 92 #endif // ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_ |
| OLD | NEW |