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 "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
15 #include "base/containers/scoped_ptr_hash_map.h" | 15 #include "base/containers/scoped_ptr_hash_map.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
19 #include "gpu/command_buffer/client/gpu_control.h" | 19 #include "gpu/command_buffer/client/gpu_control.h" |
20 #include "gpu/command_buffer/common/command_buffer.h" | 20 #include "gpu/command_buffer/common/command_buffer.h" |
21 #include "gpu/command_buffer/common/command_buffer_shared.h" | 21 #include "gpu/command_buffer/common/command_buffer_shared.h" |
22 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | 22 #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
23 #include "ipc/ipc_listener.h" | 23 #include "ipc/ipc_listener.h" |
24 #include "ui/events/latency_info.h" | 24 #include "ui/events/latency_info.h" |
| 25 #include "ui/gfx/swap_result.h" |
25 | 26 |
26 struct GPUCommandBufferConsoleMessage; | 27 struct GPUCommandBufferConsoleMessage; |
27 | 28 |
28 namespace base { | 29 namespace base { |
29 class SharedMemory; | 30 class SharedMemory; |
30 } | 31 } |
31 | 32 |
32 namespace gpu { | 33 namespace gpu { |
33 struct Mailbox; | 34 struct Mailbox; |
34 } | 35 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 void AddDeletionObserver(DeletionObserver* observer); | 130 void AddDeletionObserver(DeletionObserver* observer); |
130 void RemoveDeletionObserver(DeletionObserver* observer); | 131 void RemoveDeletionObserver(DeletionObserver* observer); |
131 | 132 |
132 bool EnsureBackbuffer(); | 133 bool EnsureBackbuffer(); |
133 | 134 |
134 void SetOnConsoleMessageCallback( | 135 void SetOnConsoleMessageCallback( |
135 const GpuConsoleMessageCallback& callback); | 136 const GpuConsoleMessageCallback& callback); |
136 | 137 |
137 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); | 138 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
138 using SwapBuffersCompletionCallback = | 139 using SwapBuffersCompletionCallback = |
139 base::Callback<void(const std::vector<ui::LatencyInfo>& latency_info)>; | 140 base::Callback<void(const std::vector<ui::LatencyInfo>& latency_info, |
| 141 gfx::SwapResult result)>; |
140 void SetSwapBuffersCompletionCallback( | 142 void SetSwapBuffersCompletionCallback( |
141 const SwapBuffersCompletionCallback& callback); | 143 const SwapBuffersCompletionCallback& callback); |
142 | 144 |
143 using UpdateVSyncParametersCallback = | 145 using UpdateVSyncParametersCallback = |
144 base::Callback<void(base::TimeTicks timebase, base::TimeDelta interval)>; | 146 base::Callback<void(base::TimeTicks timebase, base::TimeDelta interval)>; |
145 void SetUpdateVSyncParametersCallback( | 147 void SetUpdateVSyncParametersCallback( |
146 const UpdateVSyncParametersCallback& callback); | 148 const UpdateVSyncParametersCallback& callback); |
147 | 149 |
148 // TODO(apatrick): this is a temporary optimization while skia is calling | 150 // TODO(apatrick): this is a temporary optimization while skia is calling |
149 // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6 | 151 // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6 |
(...skipping 23 matching lines...) Expand all Loading... |
173 // verify that the context has not been lost. | 175 // verify that the context has not been lost. |
174 bool Send(IPC::Message* msg); | 176 bool Send(IPC::Message* msg); |
175 | 177 |
176 // Message handlers: | 178 // Message handlers: |
177 void OnUpdateState(const gpu::CommandBuffer::State& state); | 179 void OnUpdateState(const gpu::CommandBuffer::State& state); |
178 void OnDestroyed(gpu::error::ContextLostReason reason, | 180 void OnDestroyed(gpu::error::ContextLostReason reason, |
179 gpu::error::Error error); | 181 gpu::error::Error error); |
180 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); | 182 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); |
181 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); | 183 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); |
182 void OnSignalSyncPointAck(uint32 id); | 184 void OnSignalSyncPointAck(uint32 id); |
183 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); | 185 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, |
| 186 gfx::SwapResult result); |
184 void OnUpdateVSyncParameters(base::TimeTicks timebase, | 187 void OnUpdateVSyncParameters(base::TimeTicks timebase, |
185 base::TimeDelta interval); | 188 base::TimeDelta interval); |
186 | 189 |
187 // Try to read an updated copy of the state from shared memory. | 190 // Try to read an updated copy of the state from shared memory. |
188 void TryUpdateState(); | 191 void TryUpdateState(); |
189 | 192 |
190 // The shared memory area used to update state. | 193 // The shared memory area used to update state. |
191 gpu::CommandBufferSharedState* shared_state() const; | 194 gpu::CommandBufferSharedState* shared_state() const; |
192 | 195 |
193 base::Lock* lock_; | 196 base::Lock* lock_; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 231 |
229 SwapBuffersCompletionCallback swap_buffers_completion_callback_; | 232 SwapBuffersCompletionCallback swap_buffers_completion_callback_; |
230 UpdateVSyncParametersCallback update_vsync_parameters_completion_callback_; | 233 UpdateVSyncParametersCallback update_vsync_parameters_completion_callback_; |
231 | 234 |
232 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 235 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
233 }; | 236 }; |
234 | 237 |
235 } // namespace content | 238 } // namespace content |
236 | 239 |
237 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 240 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
OLD | NEW |