| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 void RetireSyncPoint(uint32_t sync_point) override; | 113 void RetireSyncPoint(uint32_t sync_point) override; |
| 114 void SignalSyncPoint(uint32 sync_point, | 114 void SignalSyncPoint(uint32 sync_point, |
| 115 const base::Closure& callback) override; | 115 const base::Closure& callback) override; |
| 116 void SignalQuery(uint32 query, const base::Closure& callback) override; | 116 void SignalQuery(uint32 query, const base::Closure& callback) override; |
| 117 void SetSurfaceVisible(bool visible) override; | 117 void SetSurfaceVisible(bool visible) override; |
| 118 uint32 CreateStreamTexture(uint32 texture_id) override; | 118 uint32 CreateStreamTexture(uint32 texture_id) override; |
| 119 void SetLock(base::Lock* lock) override; | 119 void SetLock(base::Lock* lock) override; |
| 120 | 120 |
| 121 int GetRouteID() const; | 121 int GetRouteID() const; |
| 122 bool ProduceFrontBuffer(const gpu::Mailbox& mailbox); | 122 bool ProduceFrontBuffer(const gpu::Mailbox& mailbox); |
| 123 void SetChannelErrorCallback(const base::Closure& callback); | 123 void SetContextLostCallback(const base::Closure& callback); |
| 124 | 124 |
| 125 typedef base::Callback<void(const gpu::MemoryAllocation&)> | 125 typedef base::Callback<void(const gpu::MemoryAllocation&)> |
| 126 MemoryAllocationChangedCallback; | 126 MemoryAllocationChangedCallback; |
| 127 void SetMemoryAllocationChangedCallback( | 127 void SetMemoryAllocationChangedCallback( |
| 128 const MemoryAllocationChangedCallback& callback); | 128 const MemoryAllocationChangedCallback& callback); |
| 129 void AddDeletionObserver(DeletionObserver* observer); | 129 void AddDeletionObserver(DeletionObserver* observer); |
| 130 void RemoveDeletionObserver(DeletionObserver* observer); | 130 void RemoveDeletionObserver(DeletionObserver* observer); |
| 131 | 131 |
| 132 bool EnsureBackbuffer(); | 132 bool EnsureBackbuffer(); |
| 133 | 133 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 lock_->AssertAcquired(); | 168 lock_->AssertAcquired(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 // Send an IPC message over the GPU channel. This is private to fully | 171 // Send an IPC message over the GPU channel. This is private to fully |
| 172 // encapsulate the channel; all callers of this function must explicitly | 172 // encapsulate the channel; all callers of this function must explicitly |
| 173 // verify that the context has not been lost. | 173 // verify that the context has not been lost. |
| 174 bool Send(IPC::Message* msg); | 174 bool Send(IPC::Message* msg); |
| 175 | 175 |
| 176 // Message handlers: | 176 // Message handlers: |
| 177 void OnUpdateState(const gpu::CommandBuffer::State& state); | 177 void OnUpdateState(const gpu::CommandBuffer::State& state); |
| 178 void OnDestroyed(gpu::error::ContextLostReason reason); | 178 void OnDestroyed(gpu::error::ContextLostReason reason, |
| 179 gpu::error::Error error); |
| 179 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); | 180 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); |
| 180 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); | 181 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); |
| 181 void OnSignalSyncPointAck(uint32 id); | 182 void OnSignalSyncPointAck(uint32 id); |
| 182 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); | 183 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); |
| 183 void OnUpdateVSyncParameters(base::TimeTicks timebase, | 184 void OnUpdateVSyncParameters(base::TimeTicks timebase, |
| 184 base::TimeDelta interval); | 185 base::TimeDelta interval); |
| 185 | 186 |
| 186 // Try to read an updated copy of the state from shared memory. | 187 // Try to read an updated copy of the state from shared memory. |
| 187 void TryUpdateState(); | 188 void TryUpdateState(); |
| 188 | 189 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 201 scoped_ptr<base::SharedMemory> shared_state_shm_; | 202 scoped_ptr<base::SharedMemory> shared_state_shm_; |
| 202 | 203 |
| 203 // |*this| is owned by |*channel_| and so is always outlived by it, so using a | 204 // |*this| is owned by |*channel_| and so is always outlived by it, so using a |
| 204 // raw pointer is ok. | 205 // raw pointer is ok. |
| 205 GpuChannelHost* channel_; | 206 GpuChannelHost* channel_; |
| 206 int route_id_; | 207 int route_id_; |
| 207 unsigned int flush_count_; | 208 unsigned int flush_count_; |
| 208 int32 last_put_offset_; | 209 int32 last_put_offset_; |
| 209 int32 last_barrier_put_offset_; | 210 int32 last_barrier_put_offset_; |
| 210 | 211 |
| 211 base::Closure channel_error_callback_; | 212 base::Closure context_lost_callback_; |
| 212 | 213 |
| 213 MemoryAllocationChangedCallback memory_allocation_changed_callback_; | 214 MemoryAllocationChangedCallback memory_allocation_changed_callback_; |
| 214 | 215 |
| 215 GpuConsoleMessageCallback console_message_callback_; | 216 GpuConsoleMessageCallback console_message_callback_; |
| 216 | 217 |
| 217 // Tasks to be invoked in SignalSyncPoint responses. | 218 // Tasks to be invoked in SignalSyncPoint responses. |
| 218 uint32 next_signal_id_; | 219 uint32 next_signal_id_; |
| 219 SignalTaskMap signal_tasks_; | 220 SignalTaskMap signal_tasks_; |
| 220 | 221 |
| 221 // Local cache of id to gpu memory buffer mapping. | 222 // Local cache of id to gpu memory buffer mapping. |
| 222 GpuMemoryBufferMap gpu_memory_buffers_; | 223 GpuMemoryBufferMap gpu_memory_buffers_; |
| 223 | 224 |
| 224 gpu::Capabilities capabilities_; | 225 gpu::Capabilities capabilities_; |
| 225 | 226 |
| 226 std::vector<ui::LatencyInfo> latency_info_; | 227 std::vector<ui::LatencyInfo> latency_info_; |
| 227 | 228 |
| 228 SwapBuffersCompletionCallback swap_buffers_completion_callback_; | 229 SwapBuffersCompletionCallback swap_buffers_completion_callback_; |
| 229 UpdateVSyncParametersCallback update_vsync_parameters_completion_callback_; | 230 UpdateVSyncParametersCallback update_vsync_parameters_completion_callback_; |
| 230 | 231 |
| 231 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 232 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
| 232 }; | 233 }; |
| 233 | 234 |
| 234 } // namespace content | 235 } // namespace content |
| 235 | 236 |
| 236 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 237 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
| OLD | NEW |