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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 bool OnControlMessageReceived(const IPC::Message& msg); | 158 bool OnControlMessageReceived(const IPC::Message& msg); |
160 | 159 |
161 void HandleMessage(); | 160 void HandleMessage(); |
162 | 161 |
163 // Message handlers. | 162 // Message handlers. |
164 void OnCreateOffscreenCommandBuffer( | 163 void OnCreateOffscreenCommandBuffer( |
165 const gfx::Size& size, | 164 const gfx::Size& size, |
166 const GPUCreateCommandBufferConfig& init_params, | 165 const GPUCreateCommandBufferConfig& init_params, |
167 int32* route_id); | 166 int32* route_id); |
168 void OnDestroyCommandBuffer(int32 route_id); | 167 void OnDestroyCommandBuffer(int32 route_id); |
169 void OnCreateVideoEncoder(int32* route_id); | |
170 void OnDestroyVideoEncoder(int32 route_id); | |
171 void OnDevToolsStartEventsRecording(int32* route_id); | 168 void OnDevToolsStartEventsRecording(int32* route_id); |
172 void OnDevToolsStopEventsRecording(); | 169 void OnDevToolsStopEventsRecording(); |
173 | 170 |
174 // Decrement the count of unhandled IPC messages and defer preemption. | 171 // Decrement the count of unhandled IPC messages and defer preemption. |
175 void MessageProcessed(); | 172 void MessageProcessed(); |
176 | 173 |
177 // The lifetime of objects of this class is managed by a GpuChannelManager. | 174 // The lifetime of objects of this class is managed by a GpuChannelManager. |
178 // The GpuChannelManager destroy all the GpuChannels that they own when they | 175 // The GpuChannelManager destroy all the GpuChannels that they own when they |
179 // are destroyed. So a raw pointer is safe. | 176 // are destroyed. So a raw pointer is safe. |
180 GpuChannelManager* gpu_channel_manager_; | 177 GpuChannelManager* gpu_channel_manager_; |
(...skipping 24 matching lines...) Expand all Loading... |
205 // The share group that all contexts associated with a particular renderer | 202 // The share group that all contexts associated with a particular renderer |
206 // process use. | 203 // process use. |
207 scoped_refptr<gfx::GLShareGroup> share_group_; | 204 scoped_refptr<gfx::GLShareGroup> share_group_; |
208 | 205 |
209 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 206 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
210 scoped_refptr<gpu::gles2::ImageManager> image_manager_; | 207 scoped_refptr<gpu::gles2::ImageManager> image_manager_; |
211 | 208 |
212 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; | 209 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; |
213 StubMap stubs_; | 210 StubMap stubs_; |
214 | 211 |
215 typedef IDMap<GpuVideoEncodeAccelerator, IDMapOwnPointer> EncoderMap; | |
216 EncoderMap video_encoders_; | |
217 | |
218 bool log_messages_; // True if we should log sent and received messages. | 212 bool log_messages_; // True if we should log sent and received messages. |
219 gpu::gles2::DisallowedFeatures disallowed_features_; | 213 gpu::gles2::DisallowedFeatures disallowed_features_; |
220 GpuWatchdog* watchdog_; | 214 GpuWatchdog* watchdog_; |
221 bool software_; | 215 bool software_; |
222 bool handle_messages_scheduled_; | 216 bool handle_messages_scheduled_; |
223 bool processed_get_state_fast_; | 217 bool processed_get_state_fast_; |
224 IPC::Message* currently_processing_message_; | 218 IPC::Message* currently_processing_message_; |
225 | 219 |
226 base::WeakPtrFactory<GpuChannel> weak_factory_; | 220 base::WeakPtrFactory<GpuChannel> weak_factory_; |
227 | 221 |
228 scoped_refptr<GpuChannelMessageFilter> filter_; | 222 scoped_refptr<GpuChannelMessageFilter> filter_; |
229 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 223 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
230 scoped_ptr<DevToolsGpuAgent> devtools_gpu_agent_; | 224 scoped_ptr<DevToolsGpuAgent> devtools_gpu_agent_; |
231 | 225 |
232 size_t num_stubs_descheduled_; | 226 size_t num_stubs_descheduled_; |
233 | 227 |
234 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 228 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
235 }; | 229 }; |
236 | 230 |
237 } // namespace content | 231 } // namespace content |
238 | 232 |
239 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 233 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
OLD | NEW |