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 CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 namespace IPC { | 52 namespace IPC { |
53 struct ChannelHandle; | 53 struct ChannelHandle; |
54 class SyncChannel; | 54 class SyncChannel; |
55 } | 55 } |
56 | 56 |
57 struct GPUCreateCommandBufferConfig; | 57 struct GPUCreateCommandBufferConfig; |
58 struct GpuMsg_EstablishChannel_Params; | 58 struct GpuMsg_EstablishChannel_Params; |
59 | 59 |
60 namespace content { | 60 namespace content { |
| 61 class GpuChannelManagerDelegate; |
61 class GpuChannel; | 62 class GpuChannel; |
62 class GpuMemoryBufferFactory; | 63 class GpuMemoryBufferFactory; |
63 class GpuWatchdog; | 64 class GpuWatchdog; |
64 | 65 |
65 // A GpuChannelManager is a thread responsible for issuing rendering commands | 66 // A GpuChannelManager is a thread responsible for issuing rendering commands |
66 // managing the lifetimes of GPU channels and forwarding IPC requests from the | 67 // managing the lifetimes of GPU channels and forwarding IPC requests from the |
67 // browser process to them based on the corresponding renderer ID. | 68 // browser process to them based on the corresponding renderer ID. |
68 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, | 69 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, |
69 public IPC::Sender { | 70 public IPC::Sender { |
70 public: | 71 public: |
71 GpuChannelManager(IPC::SyncChannel* channel, | 72 GpuChannelManager(GpuChannelManagerDelegate* delegate, |
| 73 IPC::SyncChannel* channel, |
72 GpuWatchdog* watchdog, | 74 GpuWatchdog* watchdog, |
73 base::SingleThreadTaskRunner* task_runner, | 75 base::SingleThreadTaskRunner* task_runner, |
74 base::SingleThreadTaskRunner* io_task_runner, | 76 base::SingleThreadTaskRunner* io_task_runner, |
75 base::WaitableEvent* shutdown_event, | 77 base::WaitableEvent* shutdown_event, |
76 gpu::SyncPointManager* sync_point_manager, | 78 gpu::SyncPointManager* sync_point_manager, |
77 GpuMemoryBufferFactory* gpu_memory_buffer_factory); | 79 GpuMemoryBufferFactory* gpu_memory_buffer_factory); |
78 ~GpuChannelManager() override; | 80 ~GpuChannelManager() override; |
79 | 81 |
| 82 GpuChannelManagerDelegate* delegate() { return delegate_; } |
| 83 const GpuChannelManagerDelegate* delegate() const { return delegate_; } |
| 84 |
80 // Remove the channel for a particular renderer. | 85 // Remove the channel for a particular renderer. |
81 void RemoveChannel(int client_id); | 86 void RemoveChannel(int client_id); |
82 | 87 |
83 // Listener overrides. | 88 // Listener overrides. |
84 bool OnMessageReceived(const IPC::Message& msg) override; | 89 bool OnMessageReceived(const IPC::Message& msg) override; |
85 | 90 |
86 // Sender overrides. | 91 // Sender overrides. |
87 bool Send(IPC::Message* msg) override; | 92 bool Send(IPC::Message* msg) override; |
88 | 93 |
89 void LoseAllContexts(); | 94 void LoseAllContexts(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 void OnUpdateValueState(int client_id, | 169 void OnUpdateValueState(int client_id, |
165 unsigned int target, | 170 unsigned int target, |
166 const gpu::ValueState& state); | 171 const gpu::ValueState& state); |
167 #if defined(OS_ANDROID) | 172 #if defined(OS_ANDROID) |
168 void OnWakeUpGpu(); | 173 void OnWakeUpGpu(); |
169 void ScheduleWakeUpGpu(); | 174 void ScheduleWakeUpGpu(); |
170 void DoWakeUpGpu(); | 175 void DoWakeUpGpu(); |
171 #endif | 176 #endif |
172 void OnLoseAllContexts(); | 177 void OnLoseAllContexts(); |
173 | 178 |
| 179 GpuChannelManagerDelegate* const delegate_; |
| 180 |
174 // Used to send and receive IPC messages from the browser process. | 181 // Used to send and receive IPC messages from the browser process. |
175 IPC::SyncChannel* const channel_; | 182 IPC::SyncChannel* const channel_; |
176 IPC::MessageRouter router_; | 183 IPC::MessageRouter router_; |
177 | 184 |
178 GpuWatchdog* watchdog_; | 185 GpuWatchdog* watchdog_; |
179 | 186 |
180 base::WaitableEvent* shutdown_event_; | 187 base::WaitableEvent* shutdown_event_; |
181 | 188 |
182 scoped_refptr<gfx::GLShareGroup> share_group_; | 189 scoped_refptr<gfx::GLShareGroup> share_group_; |
183 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 190 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
(...skipping 19 matching lines...) Expand all Loading... |
203 // that any WeakPtrs to Controller are invalidated before its members | 210 // that any WeakPtrs to Controller are invalidated before its members |
204 // variable's destructors are executed, rendering them invalid. | 211 // variable's destructors are executed, rendering them invalid. |
205 base::WeakPtrFactory<GpuChannelManager> weak_factory_; | 212 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
206 | 213 |
207 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 214 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
208 }; | 215 }; |
209 | 216 |
210 } // namespace content | 217 } // namespace content |
211 | 218 |
212 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 219 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
OLD | NEW |