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