| 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_CLIENT_GPU_CHANNEL_HOST_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
| 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/atomic_sequence_num.h" | 11 #include "base/atomic_sequence_num.h" |
| 12 #include "base/hash_tables.h" | 12 #include "base/hash_tables.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/process.h" | 16 #include "base/process.h" |
| 17 #include "base/process_util.h" | 17 #include "base/process_util.h" |
| 18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
| 19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
| 20 #include "content/common/gpu/gpu_process_launch_causes.h" | 20 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 21 #include "content/common/message_router.h" | 21 #include "content/common/message_router.h" |
| 22 #include "content/public/common/gpu_info.h" | 22 #include "gpu/config/gpu_info.h" |
| 23 #include "ipc/ipc_channel_handle.h" | 23 #include "ipc/ipc_channel_handle.h" |
| 24 #include "ipc/ipc_channel_proxy.h" | 24 #include "ipc/ipc_channel_proxy.h" |
| 25 #include "ipc/ipc_sync_channel.h" | 25 #include "ipc/ipc_sync_channel.h" |
| 26 #include "media/video/video_decode_accelerator.h" | 26 #include "media/video/video_decode_accelerator.h" |
| 27 #include "ui/gfx/native_widget_types.h" | 27 #include "ui/gfx/native_widget_types.h" |
| 28 #include "ui/gfx/size.h" | 28 #include "ui/gfx/size.h" |
| 29 #include "ui/gl/gpu_preference.h" | 29 #include "ui/gl/gpu_preference.h" |
| 30 | 30 |
| 31 class GURL; | 31 class GURL; |
| 32 class TransportTextureService; | 32 class TransportTextureService; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 // Connect to GPU process channel. | 104 // Connect to GPU process channel. |
| 105 void Connect(const IPC::ChannelHandle& channel_handle); | 105 void Connect(const IPC::ChannelHandle& channel_handle); |
| 106 | 106 |
| 107 State state() const { return state_; } | 107 State state() const { return state_; } |
| 108 | 108 |
| 109 // Change state to kLost. | 109 // Change state to kLost. |
| 110 void SetStateLost(); | 110 void SetStateLost(); |
| 111 | 111 |
| 112 // The GPU stats reported by the GPU process. | 112 // The GPU stats reported by the GPU process. |
| 113 void set_gpu_info(const GPUInfo& gpu_info); | 113 void set_gpu_info(const gpu::GPUInfo& gpu_info); |
| 114 const GPUInfo& gpu_info() const; | 114 const gpu::GPUInfo& gpu_info() const; |
| 115 | 115 |
| 116 void OnMessageReceived(const IPC::Message& message); | 116 void OnMessageReceived(const IPC::Message& message); |
| 117 void OnChannelError(); | 117 void OnChannelError(); |
| 118 | 118 |
| 119 // IPC::Sender implementation: | 119 // IPC::Sender implementation: |
| 120 virtual bool Send(IPC::Message* msg) OVERRIDE; | 120 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 121 | 121 |
| 122 // Create and connect to a command buffer in the GPU process. | 122 // Create and connect to a command buffer in the GPU process. |
| 123 CommandBufferProxyImpl* CreateViewCommandBuffer( | 123 CommandBufferProxyImpl* CreateViewCommandBuffer( |
| 124 int32 surface_id, | 124 int32 surface_id, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 typedef base::hash_map<int, GpuListenerInfo> ListenerMap; | 210 typedef base::hash_map<int, GpuListenerInfo> ListenerMap; |
| 211 ListenerMap listeners_; | 211 ListenerMap listeners_; |
| 212 }; | 212 }; |
| 213 | 213 |
| 214 GpuChannelHostFactory* factory_; | 214 GpuChannelHostFactory* factory_; |
| 215 int client_id_; | 215 int client_id_; |
| 216 int gpu_host_id_; | 216 int gpu_host_id_; |
| 217 | 217 |
| 218 State state_; | 218 State state_; |
| 219 | 219 |
| 220 GPUInfo gpu_info_; | 220 gpu::GPUInfo gpu_info_; |
| 221 | 221 |
| 222 scoped_ptr<IPC::SyncChannel> channel_; | 222 scoped_ptr<IPC::SyncChannel> channel_; |
| 223 scoped_refptr<MessageFilter> channel_filter_; | 223 scoped_refptr<MessageFilter> channel_filter_; |
| 224 | 224 |
| 225 // Used to look up a proxy from its routing id. | 225 // Used to look up a proxy from its routing id. |
| 226 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; | 226 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; |
| 227 ProxyMap proxies_; | 227 ProxyMap proxies_; |
| 228 | 228 |
| 229 // A lock to guard against concurrent access to members like the proxies map | 229 // A lock to guard against concurrent access to members like the proxies map |
| 230 // for calls from contexts that may live on the compositor or main thread. | 230 // for calls from contexts that may live on the compositor or main thread. |
| 231 mutable base::Lock context_lock_; | 231 mutable base::Lock context_lock_; |
| 232 | 232 |
| 233 // A filter for sending messages from thread other than the main thread. | 233 // A filter for sending messages from thread other than the main thread. |
| 234 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; | 234 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; |
| 235 | 235 |
| 236 // A pool of valid mailbox names. | 236 // A pool of valid mailbox names. |
| 237 std::vector<gpu::Mailbox> mailbox_name_pool_; | 237 std::vector<gpu::Mailbox> mailbox_name_pool_; |
| 238 | 238 |
| 239 // Transfer buffer IDs are allocated in sequence. | 239 // Transfer buffer IDs are allocated in sequence. |
| 240 base::AtomicSequenceNumber next_transfer_buffer_id_; | 240 base::AtomicSequenceNumber next_transfer_buffer_id_; |
| 241 | 241 |
| 242 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); | 242 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 } // namespace content | 245 } // namespace content |
| 246 | 246 |
| 247 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ | 247 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
| OLD | NEW |