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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 void SetMemoryAllocationChangedCallback( | 123 void SetMemoryAllocationChangedCallback( |
124 const MemoryAllocationChangedCallback& callback); | 124 const MemoryAllocationChangedCallback& callback); |
125 void AddDeletionObserver(DeletionObserver* observer); | 125 void AddDeletionObserver(DeletionObserver* observer); |
126 void RemoveDeletionObserver(DeletionObserver* observer); | 126 void RemoveDeletionObserver(DeletionObserver* observer); |
127 | 127 |
128 bool EnsureBackbuffer(); | 128 bool EnsureBackbuffer(); |
129 | 129 |
130 void SetOnConsoleMessageCallback( | 130 void SetOnConsoleMessageCallback( |
131 const GpuConsoleMessageCallback& callback); | 131 const GpuConsoleMessageCallback& callback); |
132 | 132 |
133 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); | 133 typedef base::Callback<void(const std::vector<ui::LatencyInfo>& latency_info)> |
| 134 SwapBuffersCompletionCallback; |
| 135 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info, |
| 136 const SwapBuffersCompletionCallback& callback); |
134 | 137 |
135 // TODO(apatrick): this is a temporary optimization while skia is calling | 138 // TODO(apatrick): this is a temporary optimization while skia is calling |
136 // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6 | 139 // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6 |
137 // ints redundantly when only the error is needed for the | 140 // ints redundantly when only the error is needed for the |
138 // CommandBufferProxyImpl implementation. | 141 // CommandBufferProxyImpl implementation. |
139 virtual gpu::error::Error GetLastError() OVERRIDE; | 142 virtual gpu::error::Error GetLastError() OVERRIDE; |
140 | 143 |
141 GpuChannelHost* channel() const { return channel_; } | 144 GpuChannelHost* channel() const { return channel_; } |
142 | 145 |
143 base::SharedMemoryHandle GetSharedStateHandle() const { | 146 base::SharedMemoryHandle GetSharedStateHandle() const { |
(...skipping 10 matching lines...) Expand all Loading... |
154 // encapsulate the channel; all callers of this function must explicitly | 157 // encapsulate the channel; all callers of this function must explicitly |
155 // verify that the context has not been lost. | 158 // verify that the context has not been lost. |
156 bool Send(IPC::Message* msg); | 159 bool Send(IPC::Message* msg); |
157 | 160 |
158 // Message handlers: | 161 // Message handlers: |
159 void OnUpdateState(const gpu::CommandBuffer::State& state); | 162 void OnUpdateState(const gpu::CommandBuffer::State& state); |
160 void OnDestroyed(gpu::error::ContextLostReason reason); | 163 void OnDestroyed(gpu::error::ContextLostReason reason); |
161 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); | 164 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); |
162 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); | 165 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); |
163 void OnSignalSyncPointAck(uint32 id); | 166 void OnSignalSyncPointAck(uint32 id); |
| 167 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); |
164 | 168 |
165 // Try to read an updated copy of the state from shared memory. | 169 // Try to read an updated copy of the state from shared memory. |
166 void TryUpdateState(); | 170 void TryUpdateState(); |
167 | 171 |
168 // The shared memory area used to update state. | 172 // The shared memory area used to update state. |
169 gpu::CommandBufferSharedState* shared_state() const; | 173 gpu::CommandBufferSharedState* shared_state() const; |
170 | 174 |
171 // Unowned list of DeletionObservers. | 175 // Unowned list of DeletionObservers. |
172 ObserverList<DeletionObserver> deletion_observers_; | 176 ObserverList<DeletionObserver> deletion_observers_; |
173 | 177 |
(...skipping 20 matching lines...) Expand all Loading... |
194 uint32 next_signal_id_; | 198 uint32 next_signal_id_; |
195 SignalTaskMap signal_tasks_; | 199 SignalTaskMap signal_tasks_; |
196 | 200 |
197 // Local cache of id to gpu memory buffer mapping. | 201 // Local cache of id to gpu memory buffer mapping. |
198 GpuMemoryBufferMap gpu_memory_buffers_; | 202 GpuMemoryBufferMap gpu_memory_buffers_; |
199 | 203 |
200 gpu::Capabilities capabilities_; | 204 gpu::Capabilities capabilities_; |
201 | 205 |
202 std::vector<ui::LatencyInfo> latency_info_; | 206 std::vector<ui::LatencyInfo> latency_info_; |
203 | 207 |
| 208 SwapBuffersCompletionCallback swap_buffers_completion_callback_; |
| 209 |
204 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 210 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
205 }; | 211 }; |
206 | 212 |
207 } // namespace content | 213 } // namespace content |
208 | 214 |
209 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 215 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
OLD | NEW |