| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 virtual ~GpuChannelHostFactory() {} | 68 virtual ~GpuChannelHostFactory() {} |
| 69 | 69 |
| 70 virtual bool IsMainThread() = 0; | 70 virtual bool IsMainThread() = 0; |
| 71 virtual base::MessageLoop* GetMainLoop() = 0; | 71 virtual base::MessageLoop* GetMainLoop() = 0; |
| 72 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0; | 72 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0; |
| 73 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0; | 73 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0; |
| 74 virtual CreateCommandBufferResult CreateViewCommandBuffer( | 74 virtual CreateCommandBufferResult CreateViewCommandBuffer( |
| 75 int32 surface_id, | 75 int32 surface_id, |
| 76 const GPUCreateCommandBufferConfig& init_params, | 76 const GPUCreateCommandBufferConfig& init_params, |
| 77 int32 route_id) = 0; | 77 int32 route_id) = 0; |
| 78 virtual void WaitForPendingGpuMemoryBufferUsageToComplete( |
| 79 const base::Closure& callback) = 0; |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 // Encapsulates an IPC channel between the client and one GPU process. | 82 // Encapsulates an IPC channel between the client and one GPU process. |
| 81 // On the GPU process side there's a corresponding GpuChannel. | 83 // On the GPU process side there's a corresponding GpuChannel. |
| 82 // Every method can be called on any thread with a message loop, except for the | 84 // Every method can be called on any thread with a message loop, except for the |
| 83 // IO thread. | 85 // IO thread. |
| 84 class GpuChannelHost : public IPC::Sender, | 86 class GpuChannelHost : public IPC::Sender, |
| 85 public base::RefCountedThreadSafe<GpuChannelHost> { | 87 public base::RefCountedThreadSafe<GpuChannelHost> { |
| 86 public: | 88 public: |
| 87 // Must be called on the main thread (as defined by the factory). | 89 // Must be called on the main thread (as defined by the factory). |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // closed. Returns an invalid handle on failure. | 156 // closed. Returns an invalid handle on failure. |
| 155 gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuProcess( | 157 gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuProcess( |
| 156 gfx::GpuMemoryBufferHandle source_handle); | 158 gfx::GpuMemoryBufferHandle source_handle); |
| 157 | 159 |
| 158 // Reserve one unused image ID. | 160 // Reserve one unused image ID. |
| 159 int32 ReserveImageId(); | 161 int32 ReserveImageId(); |
| 160 | 162 |
| 161 // Generate a route ID guaranteed to be unique for this channel. | 163 // Generate a route ID guaranteed to be unique for this channel. |
| 162 int32 GenerateRouteID(); | 164 int32 GenerateRouteID(); |
| 163 | 165 |
| 166 void WaitForPendingGpuMemoryBufferUsageToComplete( |
| 167 const base::Closure& callback); |
| 168 |
| 164 private: | 169 private: |
| 165 friend class base::RefCountedThreadSafe<GpuChannelHost>; | 170 friend class base::RefCountedThreadSafe<GpuChannelHost>; |
| 166 GpuChannelHost(GpuChannelHostFactory* factory, | 171 GpuChannelHost(GpuChannelHostFactory* factory, |
| 167 const gpu::GPUInfo& gpu_info, | 172 const gpu::GPUInfo& gpu_info, |
| 168 cc::GpuMemoryBufferManager* gpu_memory_buffer_manager); | 173 cc::GpuMemoryBufferManager* gpu_memory_buffer_manager); |
| 169 ~GpuChannelHost() override; | 174 ~GpuChannelHost() override; |
| 170 void Connect(const IPC::ChannelHandle& channel_handle, | 175 void Connect(const IPC::ChannelHandle& channel_handle, |
| 171 base::WaitableEvent* shutdown_event); | 176 base::WaitableEvent* shutdown_event); |
| 172 | 177 |
| 173 // A filter used internally to route incoming messages from the IO thread | 178 // A filter used internally to route incoming messages from the IO thread |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // Used to look up a proxy from its routing id. | 246 // Used to look up a proxy from its routing id. |
| 242 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; | 247 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; |
| 243 ProxyMap proxies_; | 248 ProxyMap proxies_; |
| 244 | 249 |
| 245 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); | 250 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); |
| 246 }; | 251 }; |
| 247 | 252 |
| 248 } // namespace content | 253 } // namespace content |
| 249 | 254 |
| 250 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ | 255 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
| OLD | NEW |