| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 GpuListenerInfo(); | 51 GpuListenerInfo(); |
| 52 ~GpuListenerInfo(); | 52 ~GpuListenerInfo(); |
| 53 | 53 |
| 54 base::WeakPtr<IPC::Listener> listener; | 54 base::WeakPtr<IPC::Listener> listener; |
| 55 scoped_refptr<base::MessageLoopProxy> loop; | 55 scoped_refptr<base::MessageLoopProxy> loop; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 class CONTENT_EXPORT GpuChannelHostFactory { | 58 class CONTENT_EXPORT GpuChannelHostFactory { |
| 59 public: | 59 public: |
| 60 typedef base::Callback<void(const gfx::Size)> CreateImageCallback; | 60 typedef base::Callback<void(const gfx::Size)> CreateImageCallback; |
| 61 typedef base::Closure CreateSurfaceTextureCallback; |
| 61 | 62 |
| 62 virtual ~GpuChannelHostFactory() {} | 63 virtual ~GpuChannelHostFactory() {} |
| 63 | 64 |
| 64 virtual bool IsMainThread() = 0; | 65 virtual bool IsMainThread() = 0; |
| 65 virtual base::MessageLoop* GetMainLoop() = 0; | 66 virtual base::MessageLoop* GetMainLoop() = 0; |
| 66 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0; | 67 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0; |
| 67 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0; | 68 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0; |
| 68 virtual int32 CreateViewCommandBuffer( | 69 virtual int32 CreateViewCommandBuffer( |
| 69 int32 surface_id, const GPUCreateCommandBufferConfig& init_params) = 0; | 70 int32 surface_id, const GPUCreateCommandBufferConfig& init_params) = 0; |
| 70 virtual void CreateImage( | 71 virtual void CreateImage( |
| 71 gfx::PluginWindowHandle window, | 72 gfx::PluginWindowHandle window, |
| 72 int32 image_id, | 73 int32 image_id, |
| 73 const CreateImageCallback& callback) = 0; | 74 const CreateImageCallback& callback) = 0; |
| 74 virtual void DeleteImage(int32 image_id, int32 sync_point) = 0; | 75 virtual void DeleteImage(int32 image_id, int32 sync_point) = 0; |
| 75 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 76 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
| 76 size_t width, | 77 size_t width, |
| 77 size_t height, | 78 size_t height, |
| 78 unsigned internalformat) = 0; | 79 unsigned internalformat) = 0; |
| 80 virtual void CreateSurfaceTexture( |
| 81 int32 surface_texture_id, |
| 82 int32 process_handle, |
| 83 const CreateSurfaceTextureCallback& callback) = 0; |
| 79 }; | 84 }; |
| 80 | 85 |
| 81 // Encapsulates an IPC channel between the client and one GPU process. | 86 // Encapsulates an IPC channel between the client and one GPU process. |
| 82 // On the GPU process side there's a corresponding GpuChannel. | 87 // On the GPU process side there's a corresponding GpuChannel. |
| 83 // Every method can be called on any thread with a message loop, except for the | 88 // Every method can be called on any thread with a message loop, except for the |
| 84 // IO thread. | 89 // IO thread. |
| 85 class GpuChannelHost : public IPC::Sender, | 90 class GpuChannelHost : public IPC::Sender, |
| 86 public base::RefCountedThreadSafe<GpuChannelHost> { | 91 public base::RefCountedThreadSafe<GpuChannelHost> { |
| 87 public: | 92 public: |
| 88 // Must be called on the main thread (as defined by the factory). | 93 // Must be called on the main thread (as defined by the factory). |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // Used to look up a proxy from its routing id. | 236 // Used to look up a proxy from its routing id. |
| 232 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; | 237 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; |
| 233 ProxyMap proxies_; | 238 ProxyMap proxies_; |
| 234 | 239 |
| 235 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); | 240 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); |
| 236 }; | 241 }; |
| 237 | 242 |
| 238 } // namespace content | 243 } // namespace content |
| 239 | 244 |
| 240 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ | 245 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
| OLD | NEW |