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_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 class PreemptionFlag; | 35 class PreemptionFlag; |
36 namespace gles2 { | 36 namespace gles2 { |
37 class ImageManager; | 37 class ImageManager; |
38 } | 38 } |
39 } | 39 } |
40 | 40 |
41 namespace content { | 41 namespace content { |
42 class DevToolsGpuAgent; | 42 class DevToolsGpuAgent; |
43 class GpuChannelManager; | 43 class GpuChannelManager; |
44 class GpuChannelMessageFilter; | 44 class GpuChannelMessageFilter; |
45 class GpuVideoEncodeAccelerator; | |
46 class GpuWatchdog; | 45 class GpuWatchdog; |
47 | 46 |
48 // Encapsulates an IPC channel between the GPU process and one renderer | 47 // Encapsulates an IPC channel between the GPU process and one renderer |
49 // process. On the renderer side there's a corresponding GpuChannelHost. | 48 // process. On the renderer side there's a corresponding GpuChannelHost. |
50 class GpuChannel : public IPC::Listener, | 49 class GpuChannel : public IPC::Listener, |
51 public IPC::Sender, | 50 public IPC::Sender, |
52 public base::RefCountedThreadSafe<GpuChannel> { | 51 public base::RefCountedThreadSafe<GpuChannel> { |
53 public: | 52 public: |
54 // Takes ownership of the renderer process handle. | 53 // Takes ownership of the renderer process handle. |
55 GpuChannel(GpuChannelManager* gpu_channel_manager, | 54 GpuChannel(GpuChannelManager* gpu_channel_manager, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 bool OnControlMessageReceived(const IPC::Message& msg); | 162 bool OnControlMessageReceived(const IPC::Message& msg); |
164 | 163 |
165 void HandleMessage(); | 164 void HandleMessage(); |
166 | 165 |
167 // Message handlers. | 166 // Message handlers. |
168 void OnCreateOffscreenCommandBuffer( | 167 void OnCreateOffscreenCommandBuffer( |
169 const gfx::Size& size, | 168 const gfx::Size& size, |
170 const GPUCreateCommandBufferConfig& init_params, | 169 const GPUCreateCommandBufferConfig& init_params, |
171 int32* route_id); | 170 int32* route_id); |
172 void OnDestroyCommandBuffer(int32 route_id); | 171 void OnDestroyCommandBuffer(int32 route_id); |
173 void OnCreateVideoEncoder(int32* route_id); | |
174 void OnDestroyVideoEncoder(int32 route_id); | |
175 void OnDevToolsStartEventsRecording(int32* route_id); | 172 void OnDevToolsStartEventsRecording(int32* route_id); |
176 void OnDevToolsStopEventsRecording(); | 173 void OnDevToolsStopEventsRecording(); |
177 | 174 |
178 // Decrement the count of unhandled IPC messages and defer preemption. | 175 // Decrement the count of unhandled IPC messages and defer preemption. |
179 void MessageProcessed(); | 176 void MessageProcessed(); |
180 | 177 |
181 // The lifetime of objects of this class is managed by a GpuChannelManager. | 178 // The lifetime of objects of this class is managed by a GpuChannelManager. |
182 // The GpuChannelManager destroy all the GpuChannels that they own when they | 179 // The GpuChannelManager destroy all the GpuChannels that they own when they |
183 // are destroyed. So a raw pointer is safe. | 180 // are destroyed. So a raw pointer is safe. |
184 GpuChannelManager* gpu_channel_manager_; | 181 GpuChannelManager* gpu_channel_manager_; |
(...skipping 24 matching lines...) Expand all Loading... |
209 // The share group that all contexts associated with a particular renderer | 206 // The share group that all contexts associated with a particular renderer |
210 // process use. | 207 // process use. |
211 scoped_refptr<gfx::GLShareGroup> share_group_; | 208 scoped_refptr<gfx::GLShareGroup> share_group_; |
212 | 209 |
213 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 210 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
214 scoped_refptr<gpu::gles2::ImageManager> image_manager_; | 211 scoped_refptr<gpu::gles2::ImageManager> image_manager_; |
215 | 212 |
216 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; | 213 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; |
217 StubMap stubs_; | 214 StubMap stubs_; |
218 | 215 |
219 typedef IDMap<GpuVideoEncodeAccelerator, IDMapOwnPointer> EncoderMap; | |
220 EncoderMap video_encoders_; | |
221 | |
222 bool log_messages_; // True if we should log sent and received messages. | 216 bool log_messages_; // True if we should log sent and received messages. |
223 gpu::gles2::DisallowedFeatures disallowed_features_; | 217 gpu::gles2::DisallowedFeatures disallowed_features_; |
224 GpuWatchdog* watchdog_; | 218 GpuWatchdog* watchdog_; |
225 bool software_; | 219 bool software_; |
226 bool handle_messages_scheduled_; | 220 bool handle_messages_scheduled_; |
227 bool processed_get_state_fast_; | 221 bool processed_get_state_fast_; |
228 IPC::Message* currently_processing_message_; | 222 IPC::Message* currently_processing_message_; |
229 | 223 |
230 base::WeakPtrFactory<GpuChannel> weak_factory_; | 224 base::WeakPtrFactory<GpuChannel> weak_factory_; |
231 | 225 |
232 scoped_refptr<GpuChannelMessageFilter> filter_; | 226 scoped_refptr<GpuChannelMessageFilter> filter_; |
233 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 227 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
234 scoped_ptr<DevToolsGpuAgent> devtools_gpu_agent_; | 228 scoped_ptr<DevToolsGpuAgent> devtools_gpu_agent_; |
235 | 229 |
236 size_t num_stubs_descheduled_; | 230 size_t num_stubs_descheduled_; |
237 | 231 |
238 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 232 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
239 }; | 233 }; |
240 | 234 |
241 } // namespace content | 235 } // namespace content |
242 | 236 |
243 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 237 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
OLD | NEW |