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 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 virtual ~GpuChannelHostFactory() {} | 83 virtual ~GpuChannelHostFactory() {} |
84 | 84 |
85 virtual bool IsMainThread() = 0; | 85 virtual bool IsMainThread() = 0; |
86 virtual scoped_refptr<base::SingleThreadTaskRunner> | 86 virtual scoped_refptr<base::SingleThreadTaskRunner> |
87 GetIOThreadTaskRunner() = 0; | 87 GetIOThreadTaskRunner() = 0; |
88 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0; | 88 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0; |
89 virtual CreateCommandBufferResult CreateViewCommandBuffer( | 89 virtual CreateCommandBufferResult CreateViewCommandBuffer( |
90 int32 surface_id, | 90 int32 surface_id, |
91 const GPUCreateCommandBufferConfig& init_params, | 91 const GPUCreateCommandBufferConfig& init_params, |
92 int32 route_id) = 0; | 92 int32 route_id) = 0; |
93 virtual bool CreateStreamTexture(int32 image_id, | |
94 int32 route_id, | |
95 int32 stream_id) = 0; | |
reveman
2015/06/29 16:02:01
hm, could this be part of the GpuControl interface
sivag
2015/06/30 11:17:17
As of now we have the CreateStreamTextureImage(int
sivag
2015/07/16 14:24:58
Done.
| |
93 }; | 96 }; |
94 | 97 |
95 // Encapsulates an IPC channel between the client and one GPU process. | 98 // Encapsulates an IPC channel between the client and one GPU process. |
96 // On the GPU process side there's a corresponding GpuChannel. | 99 // On the GPU process side there's a corresponding GpuChannel. |
97 // Every method can be called on any thread with a message loop, except for the | 100 // Every method can be called on any thread with a message loop, except for the |
98 // IO thread. | 101 // IO thread. |
99 class GpuChannelHost : public IPC::Sender, | 102 class GpuChannelHost : public IPC::Sender, |
100 public base::RefCountedThreadSafe<GpuChannelHost> { | 103 public base::RefCountedThreadSafe<GpuChannelHost> { |
101 public: | 104 public: |
102 // Must be called on the main thread (as defined by the factory). | 105 // Must be called on the main thread (as defined by the factory). |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuProcess( | 190 gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuProcess( |
188 const gfx::GpuMemoryBufferHandle& source_handle, | 191 const gfx::GpuMemoryBufferHandle& source_handle, |
189 bool* requires_sync_point); | 192 bool* requires_sync_point); |
190 | 193 |
191 // Reserve one unused image ID. | 194 // Reserve one unused image ID. |
192 int32 ReserveImageId(); | 195 int32 ReserveImageId(); |
193 | 196 |
194 // Generate a route ID guaranteed to be unique for this channel. | 197 // Generate a route ID guaranteed to be unique for this channel. |
195 int32 GenerateRouteID(); | 198 int32 GenerateRouteID(); |
196 | 199 |
200 unsigned CreateStreamTexture(int32 image_id); | |
201 | |
197 private: | 202 private: |
198 friend class base::RefCountedThreadSafe<GpuChannelHost>; | 203 friend class base::RefCountedThreadSafe<GpuChannelHost>; |
199 GpuChannelHost(GpuChannelHostFactory* factory, | 204 GpuChannelHost(GpuChannelHostFactory* factory, |
200 const gpu::GPUInfo& gpu_info, | 205 const gpu::GPUInfo& gpu_info, |
201 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); | 206 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); |
202 ~GpuChannelHost() override; | 207 ~GpuChannelHost() override; |
203 void Connect(const IPC::ChannelHandle& channel_handle, | 208 void Connect(const IPC::ChannelHandle& channel_handle, |
204 base::WaitableEvent* shutdown_event); | 209 base::WaitableEvent* shutdown_event); |
205 bool InternalSend(IPC::Message* msg); | 210 bool InternalSend(IPC::Message* msg); |
206 void InternalFlush(); | 211 void InternalFlush(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 base::AtomicSequenceNumber next_route_id_; | 276 base::AtomicSequenceNumber next_route_id_; |
272 | 277 |
273 // Protects channel_ and proxies_. | 278 // Protects channel_ and proxies_. |
274 mutable base::Lock context_lock_; | 279 mutable base::Lock context_lock_; |
275 scoped_ptr<IPC::SyncChannel> channel_; | 280 scoped_ptr<IPC::SyncChannel> channel_; |
276 // Used to look up a proxy from its routing id. | 281 // Used to look up a proxy from its routing id. |
277 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; | 282 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; |
278 ProxyMap proxies_; | 283 ProxyMap proxies_; |
279 ProxyFlushInfo flush_info_; | 284 ProxyFlushInfo flush_info_; |
280 | 285 |
286 int command_buffer_routing_id_; | |
287 | |
281 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); | 288 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); |
282 }; | 289 }; |
283 | 290 |
284 } // namespace content | 291 } // namespace content |
285 | 292 |
286 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ | 293 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
OLD | NEW |