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 |
11 #include "base/id_map.h" | 11 #include "base/id_map.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/scoped_vector.h" | |
15 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
16 #include "base/process/process.h" | 15 #include "base/process/process.h" |
17 #include "build/build_config.h" | 16 #include "build/build_config.h" |
18 #include "content/common/gpu/gpu_command_buffer_stub.h" | 17 #include "content/common/gpu/gpu_command_buffer_stub.h" |
19 #include "content/common/gpu/gpu_memory_manager.h" | 18 #include "content/common/gpu/gpu_memory_manager.h" |
20 #include "content/common/message_router.h" | 19 #include "content/common/message_router.h" |
21 #include "ipc/ipc_sync_channel.h" | 20 #include "ipc/ipc_sync_channel.h" |
22 #include "ui/gfx/native_widget_types.h" | 21 #include "ui/gfx/native_widget_types.h" |
23 #include "ui/gfx/size.h" | 22 #include "ui/gfx/size.h" |
24 #include "ui/gl/gl_share_group.h" | 23 #include "ui/gl/gl_share_group.h" |
(...skipping 18 matching lines...) Expand all Loading... |
43 } | 42 } |
44 | 43 |
45 #if defined(OS_ANDROID) | 44 #if defined(OS_ANDROID) |
46 namespace content { | 45 namespace content { |
47 class StreamTextureManagerAndroid; | 46 class StreamTextureManagerAndroid; |
48 } | 47 } |
49 #endif | 48 #endif |
50 | 49 |
51 namespace content { | 50 namespace content { |
52 class GpuChannelManager; | 51 class GpuChannelManager; |
| 52 struct GpuRenderingStats; |
| 53 class GpuWatchdog; |
53 class GpuChannelMessageFilter; | 54 class GpuChannelMessageFilter; |
54 struct GpuRenderingStats; | |
55 class GpuVideoEncodeAccelerator; | |
56 class GpuWatchdog; | |
57 | 55 |
58 // Encapsulates an IPC channel between the GPU process and one renderer | 56 // Encapsulates an IPC channel between the GPU process and one renderer |
59 // process. On the renderer side there's a corresponding GpuChannelHost. | 57 // process. On the renderer side there's a corresponding GpuChannelHost. |
60 class GpuChannel : public IPC::Listener, | 58 class GpuChannel : public IPC::Listener, |
61 public IPC::Sender, | 59 public IPC::Sender, |
62 public base::RefCountedThreadSafe<GpuChannel> { | 60 public base::RefCountedThreadSafe<GpuChannel> { |
63 public: | 61 public: |
64 // Takes ownership of the renderer process handle. | 62 // Takes ownership of the renderer process handle. |
65 GpuChannel(GpuChannelManager* gpu_channel_manager, | 63 GpuChannel(GpuChannelManager* gpu_channel_manager, |
66 GpuWatchdog* watchdog, | 64 GpuWatchdog* watchdog, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 bool OnControlMessageReceived(const IPC::Message& msg); | 166 bool OnControlMessageReceived(const IPC::Message& msg); |
169 | 167 |
170 void HandleMessage(); | 168 void HandleMessage(); |
171 | 169 |
172 // Message handlers. | 170 // Message handlers. |
173 void OnCreateOffscreenCommandBuffer( | 171 void OnCreateOffscreenCommandBuffer( |
174 const gfx::Size& size, | 172 const gfx::Size& size, |
175 const GPUCreateCommandBufferConfig& init_params, | 173 const GPUCreateCommandBufferConfig& init_params, |
176 int32* route_id); | 174 int32* route_id); |
177 void OnDestroyCommandBuffer(int32 route_id); | 175 void OnDestroyCommandBuffer(int32 route_id); |
178 void OnCreateVideoEncoder(int32* route_id); | |
179 void OnDestroyVideoEncoder(int32 route_id); | |
180 | 176 |
181 #if defined(OS_ANDROID) | 177 #if defined(OS_ANDROID) |
182 // Register the StreamTextureProxy class with the gpu process so that all | 178 // Register the StreamTextureProxy class with the gpu process so that all |
183 // the callbacks will be correctly forwarded to the renderer. | 179 // the callbacks will be correctly forwarded to the renderer. |
184 void OnRegisterStreamTextureProxy(int32 stream_id, int32* route_id); | 180 void OnRegisterStreamTextureProxy(int32 stream_id, int32* route_id); |
185 | 181 |
186 // Create a java surface texture object and send it to the renderer process | 182 // Create a java surface texture object and send it to the renderer process |
187 // through binder thread. | 183 // through binder thread. |
188 void OnEstablishStreamTexture( | 184 void OnEstablishStreamTexture( |
189 int32 stream_id, int32 primary_id, int32 secondary_id); | 185 int32 stream_id, int32 primary_id, int32 secondary_id); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 scoped_refptr<gpu::gles2::ImageManager> image_manager_; | 231 scoped_refptr<gpu::gles2::ImageManager> image_manager_; |
236 #if defined(OS_ANDROID) | 232 #if defined(OS_ANDROID) |
237 scoped_ptr<StreamTextureManagerAndroid> stream_texture_manager_; | 233 scoped_ptr<StreamTextureManagerAndroid> stream_texture_manager_; |
238 #endif | 234 #endif |
239 | 235 |
240 #if defined(ENABLE_GPU) | 236 #if defined(ENABLE_GPU) |
241 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; | 237 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; |
242 StubMap stubs_; | 238 StubMap stubs_; |
243 #endif // defined (ENABLE_GPU) | 239 #endif // defined (ENABLE_GPU) |
244 | 240 |
245 typedef IDMap<GpuVideoEncodeAccelerator, IDMapOwnPointer> EncoderMap; | |
246 EncoderMap video_encoders_; | |
247 | |
248 bool log_messages_; // True if we should log sent and received messages. | 241 bool log_messages_; // True if we should log sent and received messages. |
249 gpu::gles2::DisallowedFeatures disallowed_features_; | 242 gpu::gles2::DisallowedFeatures disallowed_features_; |
250 GpuWatchdog* watchdog_; | 243 GpuWatchdog* watchdog_; |
251 bool software_; | 244 bool software_; |
252 bool handle_messages_scheduled_; | 245 bool handle_messages_scheduled_; |
253 bool processed_get_state_fast_; | 246 bool processed_get_state_fast_; |
254 IPC::Message* currently_processing_message_; | 247 IPC::Message* currently_processing_message_; |
255 | 248 |
256 base::WeakPtrFactory<GpuChannel> weak_factory_; | 249 base::WeakPtrFactory<GpuChannel> weak_factory_; |
257 | 250 |
258 scoped_refptr<GpuChannelMessageFilter> filter_; | 251 scoped_refptr<GpuChannelMessageFilter> filter_; |
259 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 252 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
260 | 253 |
261 size_t num_stubs_descheduled_; | 254 size_t num_stubs_descheduled_; |
262 | 255 |
263 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 256 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
264 }; | 257 }; |
265 | 258 |
266 } // namespace content | 259 } // namespace content |
267 | 260 |
268 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 261 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
OLD | NEW |