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 22 matching lines...) Expand all Loading... |
172 // encapsulate the channel; all callers of this function must explicitly | 174 // encapsulate the channel; all callers of this function must explicitly |
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 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); | 181 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); |
180 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); | 182 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); |
181 void OnSignalSyncPointAck(uint32 id); | 183 void OnSignalSyncPointAck(uint32 id); |
182 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); | 184 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, |
| 185 gfx::SwapResult result); |
183 void OnUpdateVSyncParameters(base::TimeTicks timebase, | 186 void OnUpdateVSyncParameters(base::TimeTicks timebase, |
184 base::TimeDelta interval); | 187 base::TimeDelta interval); |
185 | 188 |
186 // Try to read an updated copy of the state from shared memory. | 189 // Try to read an updated copy of the state from shared memory. |
187 void TryUpdateState(); | 190 void TryUpdateState(); |
188 | 191 |
189 // The shared memory area used to update state. | 192 // The shared memory area used to update state. |
190 gpu::CommandBufferSharedState* shared_state() const; | 193 gpu::CommandBufferSharedState* shared_state() const; |
191 | 194 |
192 base::Lock* lock_; | 195 base::Lock* lock_; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 230 |
228 SwapBuffersCompletionCallback swap_buffers_completion_callback_; | 231 SwapBuffersCompletionCallback swap_buffers_completion_callback_; |
229 UpdateVSyncParametersCallback update_vsync_parameters_completion_callback_; | 232 UpdateVSyncParametersCallback update_vsync_parameters_completion_callback_; |
230 | 233 |
231 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 234 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
232 }; | 235 }; |
233 | 236 |
234 } // namespace content | 237 } // namespace content |
235 | 238 |
236 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 239 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
OLD | NEW |