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/containers/scoped_ptr_hash_map.h" |
15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
18 #include "gpu/command_buffer/client/gpu_control.h" | 19 #include "gpu/command_buffer/client/gpu_control.h" |
19 #include "gpu/command_buffer/common/command_buffer.h" | 20 #include "gpu/command_buffer/common/command_buffer.h" |
20 #include "gpu/command_buffer/common/command_buffer_shared.h" | 21 #include "gpu/command_buffer/common/command_buffer_shared.h" |
21 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | 22 #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
22 #include "ipc/ipc_listener.h" | 23 #include "ipc/ipc_listener.h" |
23 #include "ui/events/latency_info.h" | 24 #include "ui/events/latency_info.h" |
24 | 25 |
25 struct GPUCommandBufferConsoleMessage; | 26 struct GPUCommandBufferConsoleMessage; |
26 | 27 |
27 namespace base { | 28 namespace base { |
28 class SharedMemory; | 29 class SharedMemory; |
29 } | 30 } |
30 | 31 |
31 namespace gfx { | |
32 class GpuMemoryBuffer; | |
33 } | |
34 | |
35 namespace gpu { | 32 namespace gpu { |
36 struct Mailbox; | 33 struct Mailbox; |
37 } | 34 } |
38 | 35 |
39 namespace media { | 36 namespace media { |
40 class VideoDecodeAccelerator; | 37 class VideoDecodeAccelerator; |
41 class VideoEncodeAccelerator; | 38 class VideoEncodeAccelerator; |
42 } | 39 } |
43 | 40 |
44 namespace content { | 41 namespace content { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6 | 137 // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6 |
141 // ints redundantly when only the error is needed for the | 138 // ints redundantly when only the error is needed for the |
142 // CommandBufferProxyImpl implementation. | 139 // CommandBufferProxyImpl implementation. |
143 virtual gpu::error::Error GetLastError() OVERRIDE; | 140 virtual gpu::error::Error GetLastError() OVERRIDE; |
144 | 141 |
145 GpuChannelHost* channel() const { return channel_; } | 142 GpuChannelHost* channel() const { return channel_; } |
146 | 143 |
147 private: | 144 private: |
148 typedef std::map<int32, scoped_refptr<gpu::Buffer> > TransferBufferMap; | 145 typedef std::map<int32, scoped_refptr<gpu::Buffer> > TransferBufferMap; |
149 typedef base::hash_map<uint32, base::Closure> SignalTaskMap; | 146 typedef base::hash_map<uint32, base::Closure> SignalTaskMap; |
150 typedef std::map<int32, gfx::GpuMemoryBuffer*> GpuMemoryBufferMap; | 147 typedef base::ScopedPtrHashMap<int32, gfx::GpuMemoryBuffer> |
| 148 GpuMemoryBufferMap; |
151 | 149 |
152 // Send an IPC message over the GPU channel. This is private to fully | 150 // Send an IPC message over the GPU channel. This is private to fully |
153 // encapsulate the channel; all callers of this function must explicitly | 151 // encapsulate the channel; all callers of this function must explicitly |
154 // verify that the context has not been lost. | 152 // verify that the context has not been lost. |
155 bool Send(IPC::Message* msg); | 153 bool Send(IPC::Message* msg); |
156 | 154 |
157 // Message handlers: | 155 // Message handlers: |
158 void OnUpdateState(const gpu::CommandBuffer::State& state); | 156 void OnUpdateState(const gpu::CommandBuffer::State& state); |
159 void OnDestroyed(gpu::error::ContextLostReason reason); | 157 void OnDestroyed(gpu::error::ContextLostReason reason); |
160 void OnEchoAck(); | 158 void OnEchoAck(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 GpuMemoryBufferMap gpu_memory_buffers_; | 199 GpuMemoryBufferMap gpu_memory_buffers_; |
202 | 200 |
203 gpu::Capabilities capabilities_; | 201 gpu::Capabilities capabilities_; |
204 | 202 |
205 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 203 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
206 }; | 204 }; |
207 | 205 |
208 } // namespace content | 206 } // namespace content |
209 | 207 |
210 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 208 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
OLD | NEW |