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 GPU_IPC_CLIENT_GPU_CHANNEL_HOST_H_ | 5 #ifndef GPU_IPC_CLIENT_GPU_CHANNEL_HOST_H_ |
6 #define GPU_IPC_CLIENT_GPU_CHANNEL_HOST_H_ | 6 #define GPU_IPC_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 <memory> |
11 #include <string> | 12 #include <string> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/atomic_sequence_num.h" | 15 #include "base/atomic_sequence_num.h" |
15 #include "base/containers/scoped_ptr_hash_map.h" | 16 #include "base/containers/scoped_ptr_hash_map.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.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 "gpu/config/gpu_info.h" | 22 #include "gpu/config/gpu_info.h" |
23 #include "gpu/gpu_export.h" | 23 #include "gpu/gpu_export.h" |
24 #include "gpu/ipc/common/gpu_stream_constants.h" | 24 #include "gpu/ipc/common/gpu_stream_constants.h" |
25 #include "gpu/ipc/common/surface_handle.h" | 25 #include "gpu/ipc/common/surface_handle.h" |
26 #include "ipc/ipc_channel_handle.h" | 26 #include "ipc/ipc_channel_handle.h" |
27 #include "ipc/ipc_sync_channel.h" | 27 #include "ipc/ipc_sync_channel.h" |
28 #include "ipc/message_filter.h" | 28 #include "ipc/message_filter.h" |
(...skipping 21 matching lines...) Expand all Loading... |
50 class CommandBufferProxyImpl; | 50 class CommandBufferProxyImpl; |
51 class GpuChannelHost; | 51 class GpuChannelHost; |
52 | 52 |
53 class GPU_EXPORT GpuChannelHostFactory { | 53 class GPU_EXPORT GpuChannelHostFactory { |
54 public: | 54 public: |
55 virtual ~GpuChannelHostFactory() {} | 55 virtual ~GpuChannelHostFactory() {} |
56 | 56 |
57 virtual bool IsMainThread() = 0; | 57 virtual bool IsMainThread() = 0; |
58 virtual scoped_refptr<base::SingleThreadTaskRunner> | 58 virtual scoped_refptr<base::SingleThreadTaskRunner> |
59 GetIOThreadTaskRunner() = 0; | 59 GetIOThreadTaskRunner() = 0; |
60 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0; | 60 virtual std::unique_ptr<base::SharedMemory> AllocateSharedMemory( |
| 61 size_t size) = 0; |
61 }; | 62 }; |
62 | 63 |
63 // Encapsulates an IPC channel between the client and one GPU process. | 64 // Encapsulates an IPC channel between the client and one GPU process. |
64 // On the GPU process side there's a corresponding GpuChannel. | 65 // On the GPU process side there's a corresponding GpuChannel. |
65 // Every method can be called on any thread with a message loop, except for the | 66 // Every method can be called on any thread with a message loop, except for the |
66 // IO thread. | 67 // IO thread. |
67 class GPU_EXPORT GpuChannelHost | 68 class GPU_EXPORT GpuChannelHost |
68 : public IPC::Sender, | 69 : public IPC::Sender, |
69 public base::RefCountedThreadSafe<GpuChannelHost> { | 70 public base::RefCountedThreadSafe<GpuChannelHost> { |
70 public: | 71 public: |
(...skipping 30 matching lines...) Expand all Loading... |
101 int32_t stream_id, | 102 int32_t stream_id, |
102 int32_t put_offset, | 103 int32_t put_offset, |
103 uint32_t flush_count, | 104 uint32_t flush_count, |
104 const std::vector<ui::LatencyInfo>& latency_info, | 105 const std::vector<ui::LatencyInfo>& latency_info, |
105 bool put_offset_changed, | 106 bool put_offset_changed, |
106 bool do_flush); | 107 bool do_flush); |
107 | 108 |
108 void FlushPendingStream(int32_t stream_id); | 109 void FlushPendingStream(int32_t stream_id); |
109 | 110 |
110 // Create and connect to a command buffer in the GPU process. | 111 // Create and connect to a command buffer in the GPU process. |
111 scoped_ptr<CommandBufferProxyImpl> CreateCommandBuffer( | 112 std::unique_ptr<CommandBufferProxyImpl> CreateCommandBuffer( |
112 gpu::SurfaceHandle surface_handle, | 113 gpu::SurfaceHandle surface_handle, |
113 const gfx::Size& size, | 114 const gfx::Size& size, |
114 CommandBufferProxyImpl* share_group, | 115 CommandBufferProxyImpl* share_group, |
115 int32_t stream_id, | 116 int32_t stream_id, |
116 gpu::GpuStreamPriority stream_priority, | 117 gpu::GpuStreamPriority stream_priority, |
117 const std::vector<int32_t>& attribs, | 118 const std::vector<int32_t>& attribs, |
118 const GURL& active_url, | 119 const GURL& active_url, |
119 gfx::GpuPreference gpu_preference); | 120 gfx::GpuPreference gpu_preference); |
120 | 121 |
121 // Destroy a command buffer created by this channel. | 122 // Destroy a command buffer created by this channel. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 base::AtomicSequenceNumber next_image_id_; | 283 base::AtomicSequenceNumber next_image_id_; |
283 | 284 |
284 // Route IDs are allocated in sequence. | 285 // Route IDs are allocated in sequence. |
285 base::AtomicSequenceNumber next_route_id_; | 286 base::AtomicSequenceNumber next_route_id_; |
286 | 287 |
287 // Stream IDs are allocated in sequence. | 288 // Stream IDs are allocated in sequence. |
288 base::AtomicSequenceNumber next_stream_id_; | 289 base::AtomicSequenceNumber next_stream_id_; |
289 | 290 |
290 // Protects channel_ and stream_flush_info_. | 291 // Protects channel_ and stream_flush_info_. |
291 mutable base::Lock context_lock_; | 292 mutable base::Lock context_lock_; |
292 scoped_ptr<IPC::SyncChannel> channel_; | 293 std::unique_ptr<IPC::SyncChannel> channel_; |
293 base::hash_map<int32_t, StreamFlushInfo> stream_flush_info_; | 294 base::hash_map<int32_t, StreamFlushInfo> stream_flush_info_; |
294 | 295 |
295 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); | 296 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); |
296 }; | 297 }; |
297 | 298 |
298 } // namespace gpu | 299 } // namespace gpu |
299 | 300 |
300 #endif // GPU_IPC_CLIENT_GPU_CHANNEL_HOST_H_ | 301 #endif // GPU_IPC_CLIENT_GPU_CHANNEL_HOST_H_ |
OLD | NEW |