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_COMMAND_BUFFER_PROXY_IMPL_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "content/common/gpu/gpu_memory_allocation.h" | 18 #include "content/common/gpu/gpu_memory_allocation.h" |
19 #include "content/common/gpu/gpu_memory_allocation.h" | |
20 #include "gpu/command_buffer/common/command_buffer.h" | 19 #include "gpu/command_buffer/common/command_buffer.h" |
21 #include "gpu/command_buffer/common/command_buffer_shared.h" | 20 #include "gpu/command_buffer/common/command_buffer_shared.h" |
22 #include "gpu/command_buffer/common/gpu_control.h" | 21 #include "gpu/command_buffer/common/gpu_control.h" |
23 #include "ipc/ipc_listener.h" | 22 #include "ipc/ipc_listener.h" |
24 #include "media/video/video_decode_accelerator.h" | 23 #include "media/video/video_decode_accelerator.h" |
25 #include "ui/events/latency_info.h" | 24 #include "ui/events/latency_info.h" |
26 | 25 |
27 struct GPUCommandBufferConsoleMessage; | 26 struct GPUCommandBufferConsoleMessage; |
28 | 27 |
29 namespace base { | 28 namespace base { |
30 class SharedMemory; | 29 class SharedMemory; |
31 } | 30 } |
32 | 31 |
| 32 namespace gfx { |
| 33 class GpuMemoryBuffer; |
| 34 } |
| 35 |
33 namespace gpu { | 36 namespace gpu { |
34 struct Mailbox; | 37 struct Mailbox; |
35 } | 38 } |
36 | 39 |
37 namespace content { | 40 namespace content { |
38 class GpuChannelHost; | 41 class GpuChannelHost; |
39 | 42 |
40 // Client side proxy that forwards messages synchronously to a | 43 // Client side proxy that forwards messages synchronously to a |
41 // CommandBufferStub. | 44 // CommandBufferStub. |
42 class CommandBufferProxyImpl | 45 class CommandBufferProxyImpl |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // CommandBufferProxyImpl implementation. | 141 // CommandBufferProxyImpl implementation. |
139 virtual gpu::error::Error GetLastError() OVERRIDE; | 142 virtual gpu::error::Error GetLastError() OVERRIDE; |
140 | 143 |
141 void SendManagedMemoryStats(const GpuManagedMemoryStats& stats); | 144 void SendManagedMemoryStats(const GpuManagedMemoryStats& stats); |
142 | 145 |
143 GpuChannelHost* channel() const { return channel_; } | 146 GpuChannelHost* channel() const { return channel_; } |
144 | 147 |
145 private: | 148 private: |
146 typedef std::map<int32, gpu::Buffer> TransferBufferMap; | 149 typedef std::map<int32, gpu::Buffer> TransferBufferMap; |
147 typedef base::hash_map<uint32, base::Closure> SignalTaskMap; | 150 typedef base::hash_map<uint32, base::Closure> SignalTaskMap; |
| 151 typedef std::map<int32, gfx::GpuMemoryBuffer*> GpuMemoryBufferMap; |
148 | 152 |
149 // Send an IPC message over the GPU channel. This is private to fully | 153 // Send an IPC message over the GPU channel. This is private to fully |
150 // encapsulate the channel; all callers of this function must explicitly | 154 // encapsulate the channel; all callers of this function must explicitly |
151 // verify that the context has not been lost. | 155 // verify that the context has not been lost. |
152 bool Send(IPC::Message* msg); | 156 bool Send(IPC::Message* msg); |
153 | 157 |
154 // Message handlers: | 158 // Message handlers: |
155 void OnUpdateState(const gpu::CommandBuffer::State& state); | 159 void OnUpdateState(const gpu::CommandBuffer::State& state); |
156 void OnDestroyed(gpu::error::ContextLostReason reason); | 160 void OnDestroyed(gpu::error::ContextLostReason reason); |
157 void OnEchoAck(); | 161 void OnEchoAck(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 199 |
196 base::Callback<void(const GpuMemoryAllocationForRenderer&)> | 200 base::Callback<void(const GpuMemoryAllocationForRenderer&)> |
197 memory_allocation_changed_callback_; | 201 memory_allocation_changed_callback_; |
198 | 202 |
199 GpuConsoleMessageCallback console_message_callback_; | 203 GpuConsoleMessageCallback console_message_callback_; |
200 | 204 |
201 // Tasks to be invoked in SignalSyncPoint responses. | 205 // Tasks to be invoked in SignalSyncPoint responses. |
202 uint32 next_signal_id_; | 206 uint32 next_signal_id_; |
203 SignalTaskMap signal_tasks_; | 207 SignalTaskMap signal_tasks_; |
204 | 208 |
| 209 // Local cache of id to gpu memory buffer mapping. |
| 210 GpuMemoryBufferMap gpu_memory_buffers_; |
| 211 |
205 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 212 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
206 }; | 213 }; |
207 | 214 |
208 } // namespace content | 215 } // namespace content |
209 | 216 |
210 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 217 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
OLD | NEW |