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 "gpu/ipc/command_buffer_proxy.h" | 12 #include "gpu/ipc/command_buffer_proxy.h" |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
20 #include "content/common/gpu/gpu_memory_allocation.h" | 20 #include "content/common/gpu/gpu_memory_allocation.h" |
21 #include "content/common/gpu/gpu_memory_allocation.h" | |
22 #include "gpu/command_buffer/common/command_buffer.h" | 21 #include "gpu/command_buffer/common/command_buffer.h" |
23 #include "gpu/command_buffer/common/command_buffer_shared.h" | 22 #include "gpu/command_buffer/common/command_buffer_shared.h" |
23 #include "gpu/command_buffer/common/gpu_control.h" | |
24 #include "ipc/ipc_listener.h" | 24 #include "ipc/ipc_listener.h" |
25 #include "media/video/video_decode_accelerator.h" | 25 #include "media/video/video_decode_accelerator.h" |
26 #include "ui/base/latency_info.h" | 26 #include "ui/base/latency_info.h" |
27 | 27 |
28 struct GPUCommandBufferConsoleMessage; | 28 struct GPUCommandBufferConsoleMessage; |
29 | 29 |
30 namespace base { | 30 namespace base { |
31 class SharedMemory; | 31 class SharedMemory; |
32 } | 32 } |
33 | 33 |
34 namespace gpu { | 34 namespace gpu { |
35 struct Mailbox; | 35 struct Mailbox; |
36 } | 36 } |
37 | 37 |
38 namespace content { | 38 namespace content { |
39 class GpuChannelHost; | 39 class GpuChannelHost; |
40 | 40 |
41 // Client side proxy that forwards messages synchronously to a | 41 // Client side proxy that forwards messages synchronously to a |
42 // CommandBufferStub. | 42 // CommandBufferStub. |
43 class CommandBufferProxyImpl | 43 class CommandBufferProxyImpl |
44 : public CommandBufferProxy, | 44 : public CommandBufferProxy, |
45 public gpu::GpuControl, | |
no sievers
2013/08/13 00:45:43
I *thought* the concern of routing everything thro
reveman
2013/08/13 01:48:26
I like having a *Service class that can be shared
| |
45 public IPC::Listener, | 46 public IPC::Listener, |
46 public base::SupportsWeakPtr<CommandBufferProxyImpl> { | 47 public base::SupportsWeakPtr<CommandBufferProxyImpl> { |
47 public: | 48 public: |
48 class DeletionObserver { | 49 class DeletionObserver { |
49 public: | 50 public: |
50 // Called during the destruction of the CommandBufferProxyImpl. | 51 // Called during the destruction of the CommandBufferProxyImpl. |
51 virtual void OnWillDeleteImpl() = 0; | 52 virtual void OnWillDeleteImpl() = 0; |
52 | 53 |
53 protected: | 54 protected: |
54 virtual ~DeletionObserver() {} | 55 virtual ~DeletionObserver() {} |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 virtual gpu::Buffer CreateTransferBuffer(size_t size, | 93 virtual gpu::Buffer CreateTransferBuffer(size_t size, |
93 int32* id) OVERRIDE; | 94 int32* id) OVERRIDE; |
94 virtual void DestroyTransferBuffer(int32 id) OVERRIDE; | 95 virtual void DestroyTransferBuffer(int32 id) OVERRIDE; |
95 virtual gpu::Buffer GetTransferBuffer(int32 id) OVERRIDE; | 96 virtual gpu::Buffer GetTransferBuffer(int32 id) OVERRIDE; |
96 virtual void SetToken(int32 token) OVERRIDE; | 97 virtual void SetToken(int32 token) OVERRIDE; |
97 virtual void SetParseError(gpu::error::Error error) OVERRIDE; | 98 virtual void SetParseError(gpu::error::Error error) OVERRIDE; |
98 virtual void SetContextLostReason( | 99 virtual void SetContextLostReason( |
99 gpu::error::ContextLostReason reason) OVERRIDE; | 100 gpu::error::ContextLostReason reason) OVERRIDE; |
100 virtual uint32 InsertSyncPoint() OVERRIDE; | 101 virtual uint32 InsertSyncPoint() OVERRIDE; |
101 | 102 |
103 // GpuControl implementation: | |
104 virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer( | |
105 size_t width, | |
106 size_t height, | |
107 unsigned internalformat, | |
108 int32* id) OVERRIDE; | |
109 virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE; | |
110 | |
102 void SetMemoryAllocationChangedCallback( | 111 void SetMemoryAllocationChangedCallback( |
103 const base::Callback<void(const GpuMemoryAllocationForRenderer&)>& | 112 const base::Callback<void(const GpuMemoryAllocationForRenderer&)>& |
104 callback); | 113 callback); |
105 | 114 |
106 void AddDeletionObserver(DeletionObserver* observer); | 115 void AddDeletionObserver(DeletionObserver* observer); |
107 void RemoveDeletionObserver(DeletionObserver* observer); | 116 void RemoveDeletionObserver(DeletionObserver* observer); |
108 | 117 |
109 bool DiscardBackbuffer(); | 118 bool DiscardBackbuffer(); |
110 bool EnsureBackbuffer(); | 119 bool EnsureBackbuffer(); |
111 | 120 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 // Tasks to be invoked in SignalSyncPoint responses. | 211 // Tasks to be invoked in SignalSyncPoint responses. |
203 uint32 next_signal_id_; | 212 uint32 next_signal_id_; |
204 SignalTaskMap signal_tasks_; | 213 SignalTaskMap signal_tasks_; |
205 | 214 |
206 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 215 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
207 }; | 216 }; |
208 | 217 |
209 } // namespace content | 218 } // namespace content |
210 | 219 |
211 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 220 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
OLD | NEW |