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