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