| 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/scoped_vector.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "content/common/gpu/gpu_command_buffer_stub.h" | 18 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 19 #include "content/common/gpu/gpu_memory_manager.h" | 19 #include "content/common/gpu/gpu_memory_manager.h" |
| 20 #include "content/common/gpu/gpu_result_codes.h" | 20 #include "content/common/gpu/gpu_result_codes.h" |
| 21 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h" |
| 21 #include "content/common/message_router.h" | 22 #include "content/common/message_router.h" |
| 22 #include "gpu/command_buffer/service/valuebuffer_manager.h" | 23 #include "gpu/command_buffer/service/valuebuffer_manager.h" |
| 23 #include "ipc/ipc_sync_channel.h" | 24 #include "ipc/ipc_sync_channel.h" |
| 24 #include "ui/gfx/geometry/size.h" | 25 #include "ui/gfx/geometry/size.h" |
| 25 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
| 26 #include "ui/gl/gl_share_group.h" | 27 #include "ui/gl/gl_share_group.h" |
| 27 #include "ui/gl/gpu_preference.h" | 28 #include "ui/gl/gpu_preference.h" |
| 28 | 29 |
| 29 struct GPUCreateCommandBufferConfig; | 30 struct GPUCreateCommandBufferConfig; |
| 30 | 31 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 41 } | 42 } |
| 42 } | 43 } |
| 43 | 44 |
| 44 namespace IPC { | 45 namespace IPC { |
| 45 class MessageFilter; | 46 class MessageFilter; |
| 46 } | 47 } |
| 47 | 48 |
| 48 namespace content { | 49 namespace content { |
| 49 class GpuChannelManager; | 50 class GpuChannelManager; |
| 50 class GpuChannelMessageFilter; | 51 class GpuChannelMessageFilter; |
| 52 class GpuJpegDecodeAccelerator; |
| 51 class GpuWatchdog; | 53 class GpuWatchdog; |
| 52 | 54 |
| 53 // Encapsulates an IPC channel between the GPU process and one renderer | 55 // Encapsulates an IPC channel between the GPU process and one renderer |
| 54 // process. On the renderer side there's a corresponding GpuChannelHost. | 56 // process. On the renderer side there's a corresponding GpuChannelHost. |
| 55 class GpuChannel : public IPC::Listener, public IPC::Sender, | 57 class GpuChannel : public IPC::Listener, public IPC::Sender, |
| 56 public gpu::gles2::SubscriptionRefSet::Observer { | 58 public gpu::gles2::SubscriptionRefSet::Observer { |
| 57 public: | 59 public: |
| 58 // Takes ownership of the renderer process handle. | 60 // Takes ownership of the renderer process handle. |
| 59 GpuChannel(GpuChannelManager* gpu_channel_manager, | 61 GpuChannel(GpuChannelManager* gpu_channel_manager, |
| 60 GpuWatchdog* watchdog, | 62 GpuWatchdog* watchdog, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 179 |
| 178 void HandleMessage(); | 180 void HandleMessage(); |
| 179 | 181 |
| 180 // Message handlers. | 182 // Message handlers. |
| 181 void OnCreateOffscreenCommandBuffer( | 183 void OnCreateOffscreenCommandBuffer( |
| 182 const gfx::Size& size, | 184 const gfx::Size& size, |
| 183 const GPUCreateCommandBufferConfig& init_params, | 185 const GPUCreateCommandBufferConfig& init_params, |
| 184 int32 route_id, | 186 int32 route_id, |
| 185 bool* succeeded); | 187 bool* succeeded); |
| 186 void OnDestroyCommandBuffer(int32 route_id); | 188 void OnDestroyCommandBuffer(int32 route_id); |
| 189 void OnCreateJpegDecoder(int32 route_id, IPC::Message* reply_msg); |
| 187 | 190 |
| 188 // Decrement the count of unhandled IPC messages and defer preemption. | 191 // Decrement the count of unhandled IPC messages and defer preemption. |
| 189 void MessageProcessed(); | 192 void MessageProcessed(); |
| 190 | 193 |
| 191 // The lifetime of objects of this class is managed by a GpuChannelManager. | 194 // The lifetime of objects of this class is managed by a GpuChannelManager. |
| 192 // The GpuChannelManager destroy all the GpuChannels that they own when they | 195 // The GpuChannelManager destroy all the GpuChannels that they own when they |
| 193 // are destroyed. So a raw pointer is safe. | 196 // are destroyed. So a raw pointer is safe. |
| 194 GpuChannelManager* gpu_channel_manager_; | 197 GpuChannelManager* gpu_channel_manager_; |
| 195 | 198 |
| 196 scoped_ptr<IPC::SyncChannel> channel_; | 199 scoped_ptr<IPC::SyncChannel> channel_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 222 | 225 |
| 223 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 226 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
| 224 | 227 |
| 225 scoped_refptr<gpu::gles2::SubscriptionRefSet> subscription_ref_set_; | 228 scoped_refptr<gpu::gles2::SubscriptionRefSet> subscription_ref_set_; |
| 226 | 229 |
| 227 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; | 230 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; |
| 228 | 231 |
| 229 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; | 232 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; |
| 230 StubMap stubs_; | 233 StubMap stubs_; |
| 231 | 234 |
| 235 scoped_ptr<GpuJpegDecodeAccelerator> jpeg_decoder_; |
| 236 |
| 232 bool log_messages_; // True if we should log sent and received messages. | 237 bool log_messages_; // True if we should log sent and received messages. |
| 233 gpu::gles2::DisallowedFeatures disallowed_features_; | 238 gpu::gles2::DisallowedFeatures disallowed_features_; |
| 234 GpuWatchdog* watchdog_; | 239 GpuWatchdog* watchdog_; |
| 235 bool software_; | 240 bool software_; |
| 236 bool handle_messages_scheduled_; | 241 bool handle_messages_scheduled_; |
| 237 IPC::Message* currently_processing_message_; | 242 IPC::Message* currently_processing_message_; |
| 238 | 243 |
| 239 scoped_refptr<GpuChannelMessageFilter> filter_; | 244 scoped_refptr<GpuChannelMessageFilter> filter_; |
| 240 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 245 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 241 | 246 |
| 242 size_t num_stubs_descheduled_; | 247 size_t num_stubs_descheduled_; |
| 243 | 248 |
| 244 bool allow_future_sync_points_; | 249 bool allow_future_sync_points_; |
| 245 | 250 |
| 246 // Member variables should appear before the WeakPtrFactory, to ensure | 251 // Member variables should appear before the WeakPtrFactory, to ensure |
| 247 // that any WeakPtrs to Controller are invalidated before its members | 252 // that any WeakPtrs to Controller are invalidated before its members |
| 248 // variable's destructors are executed, rendering them invalid. | 253 // variable's destructors are executed, rendering them invalid. |
| 249 base::WeakPtrFactory<GpuChannel> weak_factory_; | 254 base::WeakPtrFactory<GpuChannel> weak_factory_; |
| 250 | 255 |
| 251 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 256 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
| 252 }; | 257 }; |
| 253 | 258 |
| 254 } // namespace content | 259 } // namespace content |
| 255 | 260 |
| 256 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 261 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
| OLD | NEW |