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