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 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 5 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 bool handled = true; | 45 bool handled = true; |
46 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message) | 46 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message) |
47 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed); | 47 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed); |
48 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage); | 48 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ConsoleMsg, OnConsoleMessage); |
49 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetMemoryAllocation, | 49 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetMemoryAllocation, |
50 OnSetMemoryAllocation); | 50 OnSetMemoryAllocation); |
51 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPointAck, | 51 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPointAck, |
52 OnSignalSyncPointAck); | 52 OnSignalSyncPointAck); |
53 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SwapBuffersCompleted, | 53 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SwapBuffersCompleted, |
54 OnSwapBuffersCompleted); | 54 OnSwapBuffersCompleted); |
55 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_PageFlipCompleted, | |
56 OnPageFlipCompleted); | |
55 IPC_MESSAGE_UNHANDLED(handled = false) | 57 IPC_MESSAGE_UNHANDLED(handled = false) |
56 IPC_END_MESSAGE_MAP() | 58 IPC_END_MESSAGE_MAP() |
57 | 59 |
58 DCHECK(handled); | 60 DCHECK(handled); |
59 return handled; | 61 return handled; |
60 } | 62 } |
61 | 63 |
62 void CommandBufferProxyImpl::OnChannelError() { | 64 void CommandBufferProxyImpl::OnChannelError() { |
63 OnDestroyed(gpu::error::kUnknown); | 65 OnDestroyed(gpu::error::kUnknown); |
64 } | 66 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 const std::vector<ui::LatencyInfo>& latency_info) { | 197 const std::vector<ui::LatencyInfo>& latency_info) { |
196 for (size_t i = 0; i < latency_info.size(); i++) | 198 for (size_t i = 0; i < latency_info.size(); i++) |
197 latency_info_.push_back(latency_info[i]); | 199 latency_info_.push_back(latency_info[i]); |
198 } | 200 } |
199 | 201 |
200 void CommandBufferProxyImpl::SetSwapBuffersCompletionCallback( | 202 void CommandBufferProxyImpl::SetSwapBuffersCompletionCallback( |
201 const SwapBuffersCompletionCallback& callback) { | 203 const SwapBuffersCompletionCallback& callback) { |
202 swap_buffers_completion_callback_ = callback; | 204 swap_buffers_completion_callback_ = callback; |
203 } | 205 } |
204 | 206 |
207 void CommandBufferProxyImpl::SetPageFlipCompletionCallback( | |
208 const PageFlipCompletionCallback& callback) { | |
209 page_flip_completion_callback_ = callback; | |
210 } | |
211 | |
205 void CommandBufferProxyImpl::WaitForTokenInRange(int32 start, int32 end) { | 212 void CommandBufferProxyImpl::WaitForTokenInRange(int32 start, int32 end) { |
206 TRACE_EVENT2("gpu", | 213 TRACE_EVENT2("gpu", |
207 "CommandBufferProxyImpl::WaitForToken", | 214 "CommandBufferProxyImpl::WaitForToken", |
208 "start", | 215 "start", |
209 start, | 216 start, |
210 "end", | 217 "end", |
211 end); | 218 end); |
212 TryUpdateState(); | 219 TryUpdateState(); |
213 if (!InRange(start, end, last_state_.token) && | 220 if (!InRange(start, end, last_state_.token) && |
214 last_state_.error == gpu::error::kNoError) { | 221 last_state_.error == gpu::error::kNoError) { |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
531 if (!swap_buffers_completion_callback_.is_null()) { | 538 if (!swap_buffers_completion_callback_.is_null()) { |
532 if (!ui::LatencyInfo::Verify( | 539 if (!ui::LatencyInfo::Verify( |
533 latency_info, "CommandBufferProxyImpl::OnSwapBuffersCompleted")) { | 540 latency_info, "CommandBufferProxyImpl::OnSwapBuffersCompleted")) { |
534 swap_buffers_completion_callback_.Run(std::vector<ui::LatencyInfo>()); | 541 swap_buffers_completion_callback_.Run(std::vector<ui::LatencyInfo>()); |
535 return; | 542 return; |
536 } | 543 } |
537 swap_buffers_completion_callback_.Run(latency_info); | 544 swap_buffers_completion_callback_.Run(latency_info); |
538 } | 545 } |
539 } | 546 } |
540 | 547 |
548 void CommandBufferProxyImpl::OnPageFlipCompleted() { | |
549 if (!page_flip_completion_callback_.is_null()) { | |
550 page_flip_completion_callback_.Run(); | |
brianderson
2014/12/10 22:48:05
It would be really nice to pipe latency_info along
| |
551 } | |
552 } | |
553 | |
541 } // namespace content | 554 } // namespace content |
OLD | NEW |