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> |
11 #include <memory> | 11 #include <memory> |
| 12 #include <queue> |
12 #include <string> | 13 #include <string> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/containers/scoped_ptr_hash_map.h" | 16 #include "base/containers/scoped_ptr_hash_map.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
18 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
20 #include "gpu/command_buffer/common/constants.h" | 21 #include "gpu/command_buffer/common/constants.h" |
21 #include "gpu/command_buffer/service/gpu_preferences.h" | 22 #include "gpu/command_buffer/service/gpu_preferences.h" |
(...skipping 26 matching lines...) Expand all Loading... |
48 class ShaderTranslatorCache; | 49 class ShaderTranslatorCache; |
49 } | 50 } |
50 } | 51 } |
51 | 52 |
52 namespace IPC { | 53 namespace IPC { |
53 struct ChannelHandle; | 54 struct ChannelHandle; |
54 } | 55 } |
55 | 56 |
56 namespace gpu { | 57 namespace gpu { |
57 class GpuChannel; | 58 class GpuChannel; |
| 59 class GpuChannelDeleter; |
58 class GpuChannelManagerDelegate; | 60 class GpuChannelManagerDelegate; |
59 class GpuMemoryBufferFactory; | 61 class GpuMemoryBufferFactory; |
60 class GpuWatchdogThread; | 62 class GpuWatchdogThread; |
61 | 63 |
62 // A GpuChannelManager is a thread responsible for issuing rendering commands | 64 // A GpuChannelManager is a thread responsible for issuing rendering commands |
63 // managing the lifetimes of GPU channels and forwarding IPC requests from the | 65 // managing the lifetimes of GPU channels and forwarding IPC requests from the |
64 // browser process to them based on the corresponding renderer ID. | 66 // browser process to them based on the corresponding renderer ID. |
65 class GPU_EXPORT GpuChannelManager { | 67 class GPU_EXPORT GpuChannelManager { |
66 public: | 68 public: |
67 GpuChannelManager(const GpuPreferences& gpu_preferences, | 69 GpuChannelManager(const GpuPreferences& gpu_preferences, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 160 |
159 // These objects manage channels to individual renderer processes there is | 161 // These objects manage channels to individual renderer processes there is |
160 // one channel for each renderer process that has connected to this GPU | 162 // one channel for each renderer process that has connected to this GPU |
161 // process. | 163 // process. |
162 base::ScopedPtrHashMap<int32_t, std::unique_ptr<GpuChannel>> gpu_channels_; | 164 base::ScopedPtrHashMap<int32_t, std::unique_ptr<GpuChannel>> gpu_channels_; |
163 | 165 |
164 private: | 166 private: |
165 void InternalDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); | 167 void InternalDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); |
166 void InternalDestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, | 168 void InternalDestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, |
167 int client_id); | 169 int client_id); |
| 170 void RunChannelDeleter(); |
168 #if defined(OS_ANDROID) | 171 #if defined(OS_ANDROID) |
169 void ScheduleWakeUpGpu(); | 172 void ScheduleWakeUpGpu(); |
170 void DoWakeUpGpu(); | 173 void DoWakeUpGpu(); |
171 #endif | 174 #endif |
172 | 175 |
173 const GpuPreferences gpu_preferences_; | 176 const GpuPreferences gpu_preferences_; |
174 GpuDriverBugWorkarounds gpu_driver_bug_workarounds_; | 177 GpuDriverBugWorkarounds gpu_driver_bug_workarounds_; |
175 | 178 |
176 GpuChannelManagerDelegate* const delegate_; | 179 GpuChannelManagerDelegate* const delegate_; |
177 | 180 |
(...skipping 14 matching lines...) Expand all Loading... |
192 framebuffer_completeness_cache_; | 195 framebuffer_completeness_cache_; |
193 scoped_refptr<gl::GLSurface> default_offscreen_surface_; | 196 scoped_refptr<gl::GLSurface> default_offscreen_surface_; |
194 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; | 197 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; |
195 #if defined(OS_ANDROID) | 198 #if defined(OS_ANDROID) |
196 // Last time we know the GPU was powered on. Global for tracking across all | 199 // Last time we know the GPU was powered on. Global for tracking across all |
197 // transport surfaces. | 200 // transport surfaces. |
198 base::TimeTicks last_gpu_access_time_; | 201 base::TimeTicks last_gpu_access_time_; |
199 base::TimeTicks begin_wake_up_time_; | 202 base::TimeTicks begin_wake_up_time_; |
200 #endif | 203 #endif |
201 | 204 |
| 205 bool channel_deleter_running_ = false; |
| 206 std::queue<std::unique_ptr<GpuChannelDeleter>> pending_deleters_; |
| 207 |
202 // Set during intentional GPU process shutdown. | 208 // Set during intentional GPU process shutdown. |
203 bool exiting_for_lost_context_; | 209 bool exiting_for_lost_context_; |
204 | 210 |
205 // Member variables should appear before the WeakPtrFactory, to ensure | 211 // Member variables should appear before the WeakPtrFactory, to ensure |
206 // that any WeakPtrs to Controller are invalidated before its members | 212 // that any WeakPtrs to Controller are invalidated before its members |
207 // variable's destructors are executed, rendering them invalid. | 213 // variable's destructors are executed, rendering them invalid. |
208 base::WeakPtrFactory<GpuChannelManager> weak_factory_; | 214 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
209 | 215 |
210 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 216 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
211 }; | 217 }; |
212 | 218 |
213 } // namespace gpu | 219 } // namespace gpu |
214 | 220 |
215 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ | 221 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ |
OLD | NEW |