| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 ~GpuListenerInfo(); | 55 ~GpuListenerInfo(); |
| 56 | 56 |
| 57 base::WeakPtr<IPC::Listener> listener; | 57 base::WeakPtr<IPC::Listener> listener; |
| 58 scoped_refptr<base::MessageLoopProxy> loop; | 58 scoped_refptr<base::MessageLoopProxy> loop; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 class CONTENT_EXPORT GpuChannelHostFactory { | 61 class CONTENT_EXPORT GpuChannelHostFactory { |
| 62 public: | 62 public: |
| 63 typedef base::Callback<void(const gfx::Size)> CreateImageCallback; | 63 typedef base::Callback<void(const gfx::Size)> CreateImageCallback; |
| 64 | 64 |
| 65 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> |
| 66 AllocateGpuMemoryBufferCallback; |
| 67 |
| 65 virtual ~GpuChannelHostFactory() {} | 68 virtual ~GpuChannelHostFactory() {} |
| 66 | 69 |
| 67 virtual bool IsMainThread() = 0; | 70 virtual bool IsMainThread() = 0; |
| 68 virtual base::MessageLoop* GetMainLoop() = 0; | 71 virtual base::MessageLoop* GetMainLoop() = 0; |
| 69 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0; | 72 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0; |
| 70 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0; | 73 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0; |
| 71 virtual bool CreateViewCommandBuffer( | 74 virtual bool CreateViewCommandBuffer( |
| 72 int32 surface_id, | 75 int32 surface_id, |
| 73 const GPUCreateCommandBufferConfig& init_params, | 76 const GPUCreateCommandBufferConfig& init_params, |
| 74 int32 route_id) = 0; | 77 int32 route_id) = 0; |
| 75 virtual void CreateImage( | 78 virtual void CreateImage( |
| 76 gfx::PluginWindowHandle window, | 79 gfx::PluginWindowHandle window, |
| 77 int32 image_id, | 80 int32 image_id, |
| 78 const CreateImageCallback& callback) = 0; | 81 const CreateImageCallback& callback) = 0; |
| 79 virtual void DeleteImage(int32 image_id, int32 sync_point) = 0; | 82 virtual void DeleteImage(int32 image_id, int32 sync_point) = 0; |
| 80 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 83 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
| 81 size_t width, | 84 size_t width, |
| 82 size_t height, | 85 size_t height, |
| 83 unsigned internalformat, | 86 unsigned internalformat, |
| 84 unsigned usage) = 0; | 87 unsigned usage) = 0; |
| 88 virtual void AllocateGpuMemoryBufferAsync( |
| 89 const gfx::GpuMemoryBufferParams& params, |
| 90 const AllocateGpuMemoryBufferCallback& callback) = 0; |
| 85 }; | 91 }; |
| 86 | 92 |
| 87 // Encapsulates an IPC channel between the client and one GPU process. | 93 // Encapsulates an IPC channel between the client and one GPU process. |
| 88 // On the GPU process side there's a corresponding GpuChannel. | 94 // On the GPU process side there's a corresponding GpuChannel. |
| 89 // Every method can be called on any thread with a message loop, except for the | 95 // Every method can be called on any thread with a message loop, except for the |
| 90 // IO thread. | 96 // IO thread. |
| 91 class GpuChannelHost : public IPC::Sender, | 97 class GpuChannelHost : public IPC::Sender, |
| 92 public base::RefCountedThreadSafe<GpuChannelHost> { | 98 public base::RefCountedThreadSafe<GpuChannelHost> { |
| 93 public: | 99 public: |
| 94 // Must be called on the main thread (as defined by the factory). | 100 // Must be called on the main thread (as defined by the factory). |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // Used to look up a proxy from its routing id. | 250 // Used to look up a proxy from its routing id. |
| 245 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; | 251 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; |
| 246 ProxyMap proxies_; | 252 ProxyMap proxies_; |
| 247 | 253 |
| 248 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); | 254 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); |
| 249 }; | 255 }; |
| 250 | 256 |
| 251 } // namespace content | 257 } // namespace content |
| 252 | 258 |
| 253 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ | 259 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
| OLD | NEW |