OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 } | 1633 } |
1634 | 1634 |
1635 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { | 1635 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { |
1636 ResetRequiresHighResToDraw(); | 1636 ResetRequiresHighResToDraw(); |
1637 if (frame.has_no_damage) { | 1637 if (frame.has_no_damage) { |
1638 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); | 1638 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); |
1639 return false; | 1639 return false; |
1640 } | 1640 } |
1641 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); | 1641 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); |
1642 active_tree()->FinishSwapPromises(&metadata); | 1642 active_tree()->FinishSwapPromises(&metadata); |
1643 for (size_t i = 0; i < metadata.latency_info.size(); i++) { | 1643 for (auto& latency : metadata.latency_info) { |
1644 TRACE_EVENT_FLOW_STEP0( | 1644 TRACE_EVENT_FLOW_STEP0( |
1645 "input,benchmark", | 1645 "input,benchmark", |
1646 "LatencyInfo.Flow", | 1646 "LatencyInfo.Flow", |
1647 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), | 1647 TRACE_ID_DONT_MANGLE(latency.trace_id), |
1648 "SwapBuffers"); | 1648 "SwapBuffers"); |
| 1649 // Only add the latency component once for renderer swap, not the browser |
| 1650 // swap. |
| 1651 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, |
| 1652 0, nullptr)) { |
| 1653 latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, |
| 1654 0, 0); |
| 1655 } |
1649 } | 1656 } |
1650 renderer_->SwapBuffers(metadata); | 1657 renderer_->SwapBuffers(metadata); |
1651 return true; | 1658 return true; |
1652 } | 1659 } |
1653 | 1660 |
1654 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { | 1661 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { |
1655 // Sample the frame time now. This time will be used for updating animations | 1662 // Sample the frame time now. This time will be used for updating animations |
1656 // when we draw. | 1663 // when we draw. |
1657 UpdateCurrentBeginFrameArgs(args); | 1664 UpdateCurrentBeginFrameArgs(args); |
1658 // Cache the begin impl frame interval | 1665 // Cache the begin impl frame interval |
(...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3495 (*it)->OnSetNeedsRedrawOnImpl(); | 3502 (*it)->OnSetNeedsRedrawOnImpl(); |
3496 } | 3503 } |
3497 | 3504 |
3498 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { | 3505 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { |
3499 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3506 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3500 for (; it != swap_promise_monitor_.end(); it++) | 3507 for (; it != swap_promise_monitor_.end(); it++) |
3501 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); | 3508 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); |
3502 } | 3509 } |
3503 | 3510 |
3504 } // namespace cc | 3511 } // namespace cc |
OLD | NEW |