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> |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void SetSurfaceVisible(bool visible) override; | 120 void SetSurfaceVisible(bool visible) override; |
121 uint32 CreateStreamTexture(uint32 texture_id) override; | 121 uint32 CreateStreamTexture(uint32 texture_id) override; |
122 void SetLock(base::Lock* lock) override; | 122 void SetLock(base::Lock* lock) override; |
123 bool IsGpuChannelLost() override; | 123 bool IsGpuChannelLost() override; |
124 gpu::CommandBufferNamespace GetNamespaceID() const override; | 124 gpu::CommandBufferNamespace GetNamespaceID() const override; |
125 uint64_t GetCommandBufferID() const override; | 125 uint64_t GetCommandBufferID() const override; |
126 | 126 |
127 bool ProduceFrontBuffer(const gpu::Mailbox& mailbox); | 127 bool ProduceFrontBuffer(const gpu::Mailbox& mailbox); |
128 void SetContextLostCallback(const base::Closure& callback); | 128 void SetContextLostCallback(const base::Closure& callback); |
129 | 129 |
130 typedef base::Callback<void(const gpu::MemoryAllocation&)> | |
131 MemoryAllocationChangedCallback; | |
132 void SetMemoryAllocationChangedCallback( | |
133 const MemoryAllocationChangedCallback& callback); | |
134 void AddDeletionObserver(DeletionObserver* observer); | 130 void AddDeletionObserver(DeletionObserver* observer); |
135 void RemoveDeletionObserver(DeletionObserver* observer); | 131 void RemoveDeletionObserver(DeletionObserver* observer); |
136 | 132 |
137 bool EnsureBackbuffer(); | 133 bool EnsureBackbuffer(); |
138 | 134 |
139 void SetOnConsoleMessageCallback( | 135 void SetOnConsoleMessageCallback( |
140 const GpuConsoleMessageCallback& callback); | 136 const GpuConsoleMessageCallback& callback); |
141 | 137 |
142 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); | 138 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
143 using SwapBuffersCompletionCallback = | 139 using SwapBuffersCompletionCallback = |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // Send an IPC message over the GPU channel. This is private to fully | 175 // Send an IPC message over the GPU channel. This is private to fully |
180 // encapsulate the channel; all callers of this function must explicitly | 176 // encapsulate the channel; all callers of this function must explicitly |
181 // verify that the context has not been lost. | 177 // verify that the context has not been lost. |
182 bool Send(IPC::Message* msg); | 178 bool Send(IPC::Message* msg); |
183 | 179 |
184 // Message handlers: | 180 // Message handlers: |
185 void OnUpdateState(const gpu::CommandBuffer::State& state); | 181 void OnUpdateState(const gpu::CommandBuffer::State& state); |
186 void OnDestroyed(gpu::error::ContextLostReason reason, | 182 void OnDestroyed(gpu::error::ContextLostReason reason, |
187 gpu::error::Error error); | 183 gpu::error::Error error); |
188 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); | 184 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); |
189 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); | |
190 void OnSignalSyncPointAck(uint32 id); | 185 void OnSignalSyncPointAck(uint32 id); |
191 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, | 186 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, |
192 gfx::SwapResult result); | 187 gfx::SwapResult result); |
193 void OnUpdateVSyncParameters(base::TimeTicks timebase, | 188 void OnUpdateVSyncParameters(base::TimeTicks timebase, |
194 base::TimeDelta interval); | 189 base::TimeDelta interval); |
195 | 190 |
196 // Try to read an updated copy of the state from shared memory. | 191 // Try to read an updated copy of the state from shared memory. |
197 void TryUpdateState(); | 192 void TryUpdateState(); |
198 | 193 |
199 // The shared memory area used to update state. | 194 // The shared memory area used to update state. |
(...skipping 15 matching lines...) Expand all Loading... |
215 GpuChannelHost* channel_; | 210 GpuChannelHost* channel_; |
216 const uint64_t command_buffer_id_; | 211 const uint64_t command_buffer_id_; |
217 const int32 route_id_; | 212 const int32 route_id_; |
218 const int32 stream_id_; | 213 const int32 stream_id_; |
219 uint32 flush_count_; | 214 uint32 flush_count_; |
220 int32 last_put_offset_; | 215 int32 last_put_offset_; |
221 int32 last_barrier_put_offset_; | 216 int32 last_barrier_put_offset_; |
222 | 217 |
223 base::Closure context_lost_callback_; | 218 base::Closure context_lost_callback_; |
224 | 219 |
225 MemoryAllocationChangedCallback memory_allocation_changed_callback_; | |
226 | |
227 GpuConsoleMessageCallback console_message_callback_; | 220 GpuConsoleMessageCallback console_message_callback_; |
228 | 221 |
229 // Tasks to be invoked in SignalSyncPoint responses. | 222 // Tasks to be invoked in SignalSyncPoint responses. |
230 uint32 next_signal_id_; | 223 uint32 next_signal_id_; |
231 SignalTaskMap signal_tasks_; | 224 SignalTaskMap signal_tasks_; |
232 | 225 |
233 gpu::Capabilities capabilities_; | 226 gpu::Capabilities capabilities_; |
234 | 227 |
235 std::vector<ui::LatencyInfo> latency_info_; | 228 std::vector<ui::LatencyInfo> latency_info_; |
236 | 229 |
237 SwapBuffersCompletionCallback swap_buffers_completion_callback_; | 230 SwapBuffersCompletionCallback swap_buffers_completion_callback_; |
238 UpdateVSyncParametersCallback update_vsync_parameters_completion_callback_; | 231 UpdateVSyncParametersCallback update_vsync_parameters_completion_callback_; |
239 | 232 |
240 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 233 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
241 }; | 234 }; |
242 | 235 |
243 } // namespace content | 236 } // namespace content |
244 | 237 |
245 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 238 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
OLD | NEW |