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; |
38 class WaitableEvent; | 39 class WaitableEvent; |
39 } | 40 } |
40 | 41 |
41 namespace IPC { | 42 namespace IPC { |
42 class SyncMessageFilter; | 43 class SyncMessageFilter; |
43 } | 44 } |
44 | 45 |
45 namespace media { | 46 namespace media { |
46 class VideoDecodeAccelerator; | 47 class VideoDecodeAccelerator; |
47 class VideoEncodeAccelerator; | 48 class VideoEncodeAccelerator; |
48 } | 49 } |
49 | 50 |
50 namespace gpu { | 51 namespace gpu { |
51 class GpuMemoryBufferManager; | 52 class GpuMemoryBufferManager; |
52 } | 53 } |
53 | 54 |
54 namespace content { | 55 namespace content { |
55 class CommandBufferProxyImpl; | 56 class CommandBufferProxyImpl; |
56 class GpuChannelHost; | 57 class GpuChannelHost; |
57 | 58 |
58 struct GpuListenerInfo { | 59 struct GpuListenerInfo { |
59 GpuListenerInfo(); | 60 GpuListenerInfo(); |
60 ~GpuListenerInfo(); | 61 ~GpuListenerInfo(); |
61 | 62 |
62 base::WeakPtr<IPC::Listener> listener; | 63 base::WeakPtr<IPC::Listener> listener; |
63 scoped_refptr<base::SingleThreadTaskRunner> task_runner; | 64 scoped_refptr<base::MessageLoopProxy> loop; |
64 }; | 65 }; |
65 | 66 |
66 struct ProxyFlushInfo { | 67 struct ProxyFlushInfo { |
67 ProxyFlushInfo(); | 68 ProxyFlushInfo(); |
68 ~ProxyFlushInfo(); | 69 ~ProxyFlushInfo(); |
69 | 70 |
70 bool flush_pending; | 71 bool flush_pending; |
71 int route_id; | 72 int route_id; |
72 int32 put_offset; | 73 int32 put_offset; |
73 unsigned int flush_count; | 74 unsigned int flush_count; |
74 std::vector<ui::LatencyInfo> latency_info; | 75 std::vector<ui::LatencyInfo> latency_info; |
75 }; | 76 }; |
76 | 77 |
77 class CONTENT_EXPORT GpuChannelHostFactory { | 78 class CONTENT_EXPORT GpuChannelHostFactory { |
78 public: | 79 public: |
79 virtual ~GpuChannelHostFactory() {} | 80 virtual ~GpuChannelHostFactory() {} |
80 | 81 |
81 virtual bool IsMainThread() = 0; | 82 virtual bool IsMainThread() = 0; |
82 virtual scoped_refptr<base::SingleThreadTaskRunner> | 83 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0; |
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::SingleThreadTaskRunner> task_runner); | 210 scoped_refptr<base::MessageLoopProxy> loop); |
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 |