| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/atomic_sequence_num.h" | 14 #include "base/atomic_sequence_num.h" |
| 15 #include "base/containers/scoped_ptr_hash_map.h" | 15 #include "base/containers/scoped_ptr_hash_map.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "base/process/process.h" | 20 #include "base/process/process.h" |
| 21 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
| 22 #include "content/common/content_export.h" | 22 #include "content/common/content_export.h" |
| 23 #include "content/common/gpu/gpu_process_launch_causes.h" | 23 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 24 #include "content/common/gpu/gpu_stream_constants.h" | |
| 25 #include "gpu/config/gpu_info.h" | 24 #include "gpu/config/gpu_info.h" |
| 25 #include "gpu/ipc/common/gpu_stream_constants.h" |
| 26 #include "gpu/ipc/common/surface_handle.h" | 26 #include "gpu/ipc/common/surface_handle.h" |
| 27 #include "ipc/ipc_channel_handle.h" | 27 #include "ipc/ipc_channel_handle.h" |
| 28 #include "ipc/ipc_sync_channel.h" | 28 #include "ipc/ipc_sync_channel.h" |
| 29 #include "ipc/message_filter.h" | 29 #include "ipc/message_filter.h" |
| 30 #include "ipc/message_router.h" | 30 #include "ipc/message_router.h" |
| 31 #include "ui/events/latency_info.h" | 31 #include "ui/events/latency_info.h" |
| 32 #include "ui/gfx/geometry/size.h" | 32 #include "ui/gfx/geometry/size.h" |
| 33 #include "ui/gfx/gpu_memory_buffer.h" | 33 #include "ui/gfx/gpu_memory_buffer.h" |
| 34 #include "ui/gl/gpu_preference.h" | 34 #include "ui/gl/gpu_preference.h" |
| 35 | 35 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 public: | 70 public: |
| 71 // Must be called on the main thread (as defined by the factory). | 71 // Must be called on the main thread (as defined by the factory). |
| 72 static scoped_refptr<GpuChannelHost> Create( | 72 static scoped_refptr<GpuChannelHost> Create( |
| 73 GpuChannelHostFactory* factory, | 73 GpuChannelHostFactory* factory, |
| 74 int channel_id, | 74 int channel_id, |
| 75 const gpu::GPUInfo& gpu_info, | 75 const gpu::GPUInfo& gpu_info, |
| 76 const IPC::ChannelHandle& channel_handle, | 76 const IPC::ChannelHandle& channel_handle, |
| 77 base::WaitableEvent* shutdown_event, | 77 base::WaitableEvent* shutdown_event, |
| 78 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); | 78 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); |
| 79 | 79 |
| 80 static const int32_t kDefaultStreamId = GPU_STREAM_DEFAULT; | 80 static const int32_t kDefaultStreamId = gpu::GPU_STREAM_DEFAULT; |
| 81 static const GpuStreamPriority kDefaultStreamPriority = | 81 static const gpu::GpuStreamPriority kDefaultStreamPriority = |
| 82 GpuStreamPriority::NORMAL; | 82 gpu::GpuStreamPriority::NORMAL; |
| 83 | 83 |
| 84 bool IsLost() const { | 84 bool IsLost() const { |
| 85 DCHECK(channel_filter_.get()); | 85 DCHECK(channel_filter_.get()); |
| 86 return channel_filter_->IsLost(); | 86 return channel_filter_->IsLost(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 int channel_id() const { return channel_id_; } | 89 int channel_id() const { return channel_id_; } |
| 90 | 90 |
| 91 // The GPU stats reported by the GPU process. | 91 // The GPU stats reported by the GPU process. |
| 92 const gpu::GPUInfo& gpu_info() const { return gpu_info_; } | 92 const gpu::GPUInfo& gpu_info() const { return gpu_info_; } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 106 bool do_flush); | 106 bool do_flush); |
| 107 | 107 |
| 108 void FlushPendingStream(int32_t stream_id); | 108 void FlushPendingStream(int32_t stream_id); |
| 109 | 109 |
| 110 // Create and connect to a command buffer in the GPU process. | 110 // Create and connect to a command buffer in the GPU process. |
| 111 scoped_ptr<CommandBufferProxyImpl> CreateCommandBuffer( | 111 scoped_ptr<CommandBufferProxyImpl> CreateCommandBuffer( |
| 112 gpu::SurfaceHandle surface_handle, | 112 gpu::SurfaceHandle surface_handle, |
| 113 const gfx::Size& size, | 113 const gfx::Size& size, |
| 114 CommandBufferProxyImpl* share_group, | 114 CommandBufferProxyImpl* share_group, |
| 115 int32_t stream_id, | 115 int32_t stream_id, |
| 116 GpuStreamPriority stream_priority, | 116 gpu::GpuStreamPriority stream_priority, |
| 117 const std::vector<int32_t>& attribs, | 117 const std::vector<int32_t>& attribs, |
| 118 const GURL& active_url, | 118 const GURL& active_url, |
| 119 gfx::GpuPreference gpu_preference); | 119 gfx::GpuPreference gpu_preference); |
| 120 | 120 |
| 121 // Destroy a command buffer created by this channel. | 121 // Destroy a command buffer created by this channel. |
| 122 void DestroyCommandBuffer(CommandBufferProxyImpl* command_buffer); | 122 void DestroyCommandBuffer(CommandBufferProxyImpl* command_buffer); |
| 123 | 123 |
| 124 // Destroy this channel. Must be called on the main thread, before | 124 // Destroy this channel. Must be called on the main thread, before |
| 125 // destruction. | 125 // destruction. |
| 126 void DestroyChannel(); | 126 void DestroyChannel(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 mutable base::Lock context_lock_; | 291 mutable base::Lock context_lock_; |
| 292 scoped_ptr<IPC::SyncChannel> channel_; | 292 scoped_ptr<IPC::SyncChannel> channel_; |
| 293 base::hash_map<int32_t, StreamFlushInfo> stream_flush_info_; | 293 base::hash_map<int32_t, StreamFlushInfo> stream_flush_info_; |
| 294 | 294 |
| 295 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); | 295 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); |
| 296 }; | 296 }; |
| 297 | 297 |
| 298 } // namespace content | 298 } // namespace content |
| 299 | 299 |
| 300 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ | 300 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
| OLD | NEW |