| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ | 5 #ifndef GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ |
| 6 #define GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ | 6 #define GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "url/gurl.h" | 30 #include "url/gurl.h" |
| 31 | 31 |
| 32 namespace gl { | 32 namespace gl { |
| 33 class GLShareGroup; | 33 class GLShareGroup; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace gpu { | 36 namespace gpu { |
| 37 class GpuDriverBugWorkarounds; | 37 class GpuDriverBugWorkarounds; |
| 38 struct GpuPreferences; | 38 struct GpuPreferences; |
| 39 class PreemptionFlag; | 39 class PreemptionFlag; |
| 40 class Scheduler; | |
| 41 class SyncPointManager; | 40 class SyncPointManager; |
| 42 struct SyncToken; | 41 struct SyncToken; |
| 43 namespace gles2 { | 42 namespace gles2 { |
| 44 class FramebufferCompletenessCache; | 43 class FramebufferCompletenessCache; |
| 45 class MailboxManager; | 44 class MailboxManager; |
| 46 class ProgramCache; | 45 class ProgramCache; |
| 47 class ShaderTranslatorCache; | 46 class ShaderTranslatorCache; |
| 48 } | 47 } |
| 49 } | 48 } |
| 50 | 49 |
| 51 namespace gpu { | 50 namespace gpu { |
| 52 class GpuChannel; | 51 class GpuChannel; |
| 53 class GpuChannelManagerDelegate; | 52 class GpuChannelManagerDelegate; |
| 54 class GpuMemoryBufferFactory; | 53 class GpuMemoryBufferFactory; |
| 55 class GpuWatchdogThread; | 54 class GpuWatchdogThread; |
| 56 | 55 |
| 57 // A GpuChannelManager is a thread responsible for issuing rendering commands | 56 // A GpuChannelManager is a thread responsible for issuing rendering commands |
| 58 // managing the lifetimes of GPU channels and forwarding IPC requests from the | 57 // managing the lifetimes of GPU channels and forwarding IPC requests from the |
| 59 // browser process to them based on the corresponding renderer ID. | 58 // browser process to them based on the corresponding renderer ID. |
| 60 class GPU_EXPORT GpuChannelManager { | 59 class GPU_EXPORT GpuChannelManager { |
| 61 public: | 60 public: |
| 62 GpuChannelManager(const GpuPreferences& gpu_preferences, | 61 GpuChannelManager(const GpuPreferences& gpu_preferences, |
| 63 const GpuDriverBugWorkarounds& workarounds, | 62 const GpuDriverBugWorkarounds& workarounds, |
| 64 GpuChannelManagerDelegate* delegate, | 63 GpuChannelManagerDelegate* delegate, |
| 65 GpuWatchdogThread* watchdog, | 64 GpuWatchdogThread* watchdog, |
| 66 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 65 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 67 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 66 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 68 Scheduler* scheduler, | |
| 69 SyncPointManager* sync_point_manager, | 67 SyncPointManager* sync_point_manager, |
| 70 GpuMemoryBufferFactory* gpu_memory_buffer_factory, | 68 GpuMemoryBufferFactory* gpu_memory_buffer_factory, |
| 71 const GpuFeatureInfo& gpu_feature_info, | 69 const GpuFeatureInfo& gpu_feature_info, |
| 72 GpuProcessActivityFlags activity_flags); | 70 GpuProcessActivityFlags activity_flags); |
| 73 ~GpuChannelManager(); | 71 ~GpuChannelManager(); |
| 74 | 72 |
| 75 GpuChannelManagerDelegate* delegate() const { return delegate_; } | 73 GpuChannelManagerDelegate* delegate() const { return delegate_; } |
| 76 | 74 |
| 77 GpuChannel* EstablishChannel(int client_id, | 75 GpuChannel* EstablishChannel(int client_id, |
| 78 uint64_t client_tracing_id, | 76 uint64_t client_tracing_id, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 #endif | 115 #endif |
| 118 | 116 |
| 119 bool is_exiting_for_lost_context() { return exiting_for_lost_context_; } | 117 bool is_exiting_for_lost_context() { return exiting_for_lost_context_; } |
| 120 | 118 |
| 121 gles2::MailboxManager* mailbox_manager() const { | 119 gles2::MailboxManager* mailbox_manager() const { |
| 122 return mailbox_manager_.get(); | 120 return mailbox_manager_.get(); |
| 123 } | 121 } |
| 124 | 122 |
| 125 gl::GLShareGroup* share_group() const { return share_group_.get(); } | 123 gl::GLShareGroup* share_group() const { return share_group_.get(); } |
| 126 | 124 |
| 127 SyncPointManager* sync_point_manager() const { return sync_point_manager_; } | |
| 128 | |
| 129 private: | 125 private: |
| 130 void InternalDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); | 126 void InternalDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); |
| 131 void InternalDestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, | 127 void InternalDestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, |
| 132 int client_id); | 128 int client_id); |
| 133 #if defined(OS_ANDROID) | 129 #if defined(OS_ANDROID) |
| 134 void ScheduleWakeUpGpu(); | 130 void ScheduleWakeUpGpu(); |
| 135 void DoWakeUpGpu(); | 131 void DoWakeUpGpu(); |
| 136 #endif | 132 #endif |
| 137 | 133 |
| 138 // These objects manage channels to individual renderer processes. There is | 134 // These objects manage channels to individual renderer processes. There is |
| 139 // one channel for each renderer process that has connected to this GPU | 135 // one channel for each renderer process that has connected to this GPU |
| 140 // process. | 136 // process. |
| 141 std::unordered_map<int32_t, std::unique_ptr<GpuChannel>> gpu_channels_; | 137 std::unordered_map<int32_t, std::unique_ptr<GpuChannel>> gpu_channels_; |
| 142 | 138 |
| 143 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 139 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 144 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 140 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 145 | 141 |
| 146 const GpuPreferences gpu_preferences_; | 142 const GpuPreferences gpu_preferences_; |
| 147 GpuDriverBugWorkarounds gpu_driver_bug_workarounds_; | 143 GpuDriverBugWorkarounds gpu_driver_bug_workarounds_; |
| 148 | 144 |
| 149 GpuChannelManagerDelegate* const delegate_; | 145 GpuChannelManagerDelegate* const delegate_; |
| 150 | 146 |
| 151 GpuWatchdogThread* watchdog_; | 147 GpuWatchdogThread* watchdog_; |
| 152 | 148 |
| 153 scoped_refptr<gl::GLShareGroup> share_group_; | 149 scoped_refptr<gl::GLShareGroup> share_group_; |
| 154 | 150 scoped_refptr<gles2::MailboxManager> mailbox_manager_; |
| 155 scoped_refptr<PreemptionFlag> preemption_flag_; | 151 scoped_refptr<PreemptionFlag> preemption_flag_; |
| 156 | |
| 157 scoped_refptr<gles2::MailboxManager> mailbox_manager_; | |
| 158 GpuMemoryManager gpu_memory_manager_; | 152 GpuMemoryManager gpu_memory_manager_; |
| 159 Scheduler* scheduler_; | |
| 160 // SyncPointManager guaranteed to outlive running MessageLoop. | 153 // SyncPointManager guaranteed to outlive running MessageLoop. |
| 161 SyncPointManager* sync_point_manager_; | 154 SyncPointManager* sync_point_manager_; |
| 162 std::unique_ptr<gles2::ProgramCache> program_cache_; | 155 std::unique_ptr<gles2::ProgramCache> program_cache_; |
| 163 scoped_refptr<gles2::ShaderTranslatorCache> shader_translator_cache_; | 156 scoped_refptr<gles2::ShaderTranslatorCache> shader_translator_cache_; |
| 164 scoped_refptr<gles2::FramebufferCompletenessCache> | 157 scoped_refptr<gles2::FramebufferCompletenessCache> |
| 165 framebuffer_completeness_cache_; | 158 framebuffer_completeness_cache_; |
| 166 scoped_refptr<gl::GLSurface> default_offscreen_surface_; | 159 scoped_refptr<gl::GLSurface> default_offscreen_surface_; |
| 167 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; | 160 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; |
| 168 GpuFeatureInfo gpu_feature_info_; | 161 GpuFeatureInfo gpu_feature_info_; |
| 169 #if defined(OS_ANDROID) | 162 #if defined(OS_ANDROID) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 184 // that any WeakPtrs to Controller are invalidated before its members | 177 // that any WeakPtrs to Controller are invalidated before its members |
| 185 // variable's destructors are executed, rendering them invalid. | 178 // variable's destructors are executed, rendering them invalid. |
| 186 base::WeakPtrFactory<GpuChannelManager> weak_factory_; | 179 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
| 187 | 180 |
| 188 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 181 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
| 189 }; | 182 }; |
| 190 | 183 |
| 191 } // namespace gpu | 184 } // namespace gpu |
| 192 | 185 |
| 193 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ | 186 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ |
| OLD | NEW |