| 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 17 matching lines...) Expand all Loading... |
| 28 #include "ui/gfx/gpu_memory_buffer.h" | 28 #include "ui/gfx/gpu_memory_buffer.h" |
| 29 #include "ui/gfx/native_widget_types.h" | 29 #include "ui/gfx/native_widget_types.h" |
| 30 #include "ui/gl/gpu_preference.h" | 30 #include "ui/gl/gpu_preference.h" |
| 31 | 31 |
| 32 class GURL; | 32 class GURL; |
| 33 class TransportTextureService; | 33 class TransportTextureService; |
| 34 struct GPUCreateCommandBufferConfig; | 34 struct GPUCreateCommandBufferConfig; |
| 35 | 35 |
| 36 namespace base { | 36 namespace base { |
| 37 class MessageLoop; | 37 class MessageLoop; |
| 38 class MessageLoopProxy; | |
| 39 class WaitableEvent; | 38 class WaitableEvent; |
| 40 } | 39 } |
| 41 | 40 |
| 42 namespace IPC { | 41 namespace IPC { |
| 43 class SyncMessageFilter; | 42 class SyncMessageFilter; |
| 44 } | 43 } |
| 45 | 44 |
| 46 namespace media { | 45 namespace media { |
| 47 class VideoDecodeAccelerator; | 46 class VideoDecodeAccelerator; |
| 48 class VideoEncodeAccelerator; | 47 class VideoEncodeAccelerator; |
| 49 } | 48 } |
| 50 | 49 |
| 51 namespace gpu { | 50 namespace gpu { |
| 52 class GpuMemoryBufferManager; | 51 class GpuMemoryBufferManager; |
| 53 } | 52 } |
| 54 | 53 |
| 55 namespace content { | 54 namespace content { |
| 56 class CommandBufferProxyImpl; | 55 class CommandBufferProxyImpl; |
| 57 class GpuChannelHost; | 56 class GpuChannelHost; |
| 58 | 57 |
| 59 struct GpuListenerInfo { | 58 struct GpuListenerInfo { |
| 60 GpuListenerInfo(); | 59 GpuListenerInfo(); |
| 61 ~GpuListenerInfo(); | 60 ~GpuListenerInfo(); |
| 62 | 61 |
| 63 base::WeakPtr<IPC::Listener> listener; | 62 base::WeakPtr<IPC::Listener> listener; |
| 64 scoped_refptr<base::MessageLoopProxy> loop; | 63 scoped_refptr<base::SingleThreadTaskRunner> task_runner; |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 struct ProxyFlushInfo { | 66 struct ProxyFlushInfo { |
| 68 ProxyFlushInfo(); | 67 ProxyFlushInfo(); |
| 69 ~ProxyFlushInfo(); | 68 ~ProxyFlushInfo(); |
| 70 | 69 |
| 71 bool flush_pending; | 70 bool flush_pending; |
| 72 int route_id; | 71 int route_id; |
| 73 int32 put_offset; | 72 int32 put_offset; |
| 74 unsigned int flush_count; | 73 unsigned int flush_count; |
| 75 std::vector<ui::LatencyInfo> latency_info; | 74 std::vector<ui::LatencyInfo> latency_info; |
| 76 }; | 75 }; |
| 77 | 76 |
| 78 class CONTENT_EXPORT GpuChannelHostFactory { | 77 class CONTENT_EXPORT GpuChannelHostFactory { |
| 79 public: | 78 public: |
| 80 virtual ~GpuChannelHostFactory() {} | 79 virtual ~GpuChannelHostFactory() {} |
| 81 | 80 |
| 82 virtual bool IsMainThread() = 0; | 81 virtual bool IsMainThread() = 0; |
| 83 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0; | 82 virtual scoped_refptr<base::SingleThreadTaskRunner> |
| 83 GetIOThreadTaskRunner() = 0; |
| 84 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0; | 84 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0; |
| 85 virtual CreateCommandBufferResult CreateViewCommandBuffer( | 85 virtual CreateCommandBufferResult CreateViewCommandBuffer( |
| 86 int32 surface_id, | 86 int32 surface_id, |
| 87 const GPUCreateCommandBufferConfig& init_params, | 87 const GPUCreateCommandBufferConfig& init_params, |
| 88 int32 route_id) = 0; | 88 int32 route_id) = 0; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 // Encapsulates an IPC channel between the client and one GPU process. | 91 // Encapsulates an IPC channel between the client and one GPU process. |
| 92 // On the GPU process side there's a corresponding GpuChannel. | 92 // On the GPU process side there's a corresponding GpuChannel. |
| 93 // Every method can be called on any thread with a message loop, except for the | 93 // Every method can be called on any thread with a message loop, except for the |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // A filter used internally to route incoming messages from the IO thread | 200 // A filter used internally to route incoming messages from the IO thread |
| 201 // to the correct message loop. It also maintains some shared state between | 201 // to the correct message loop. It also maintains some shared state between |
| 202 // all the contexts. | 202 // all the contexts. |
| 203 class MessageFilter : public IPC::MessageFilter { | 203 class MessageFilter : public IPC::MessageFilter { |
| 204 public: | 204 public: |
| 205 MessageFilter(); | 205 MessageFilter(); |
| 206 | 206 |
| 207 // Called on the IO thread. | 207 // Called on the IO thread. |
| 208 void AddRoute(int route_id, | 208 void AddRoute(int route_id, |
| 209 base::WeakPtr<IPC::Listener> listener, | 209 base::WeakPtr<IPC::Listener> listener, |
| 210 scoped_refptr<base::MessageLoopProxy> loop); | 210 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 211 // Called on the IO thread. | 211 // Called on the IO thread. |
| 212 void RemoveRoute(int route_id); | 212 void RemoveRoute(int route_id); |
| 213 | 213 |
| 214 // IPC::MessageFilter implementation | 214 // IPC::MessageFilter implementation |
| 215 // (called on the IO thread): | 215 // (called on the IO thread): |
| 216 bool OnMessageReceived(const IPC::Message& msg) override; | 216 bool OnMessageReceived(const IPC::Message& msg) override; |
| 217 void OnChannelError() override; | 217 void OnChannelError() override; |
| 218 | 218 |
| 219 // The following methods can be called on any thread. | 219 // The following methods can be called on any thread. |
| 220 | 220 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; | 269 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; |
| 270 ProxyMap proxies_; | 270 ProxyMap proxies_; |
| 271 ProxyFlushInfo flush_info_; | 271 ProxyFlushInfo flush_info_; |
| 272 | 272 |
| 273 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); | 273 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 } // namespace content | 276 } // namespace content |
| 277 | 277 |
| 278 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ | 278 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ |
| OLD | NEW |