| 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 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { | 1645 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { |
| 1646 ResetRequiresHighResToDraw(); | 1646 ResetRequiresHighResToDraw(); |
| 1647 if (frame.has_no_damage) { | 1647 if (frame.has_no_damage) { |
| 1648 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); | 1648 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); |
| 1649 return false; | 1649 return false; |
| 1650 } | 1650 } |
| 1651 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); | 1651 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); |
| 1652 active_tree()->FinishSwapPromises(&metadata); | 1652 active_tree()->FinishSwapPromises(&metadata); |
| 1653 for (size_t i = 0; i < metadata.latency_info.size(); i++) { | 1653 for (auto& latency : metadata.latency_info) { |
| 1654 TRACE_EVENT_FLOW_STEP0( | 1654 TRACE_EVENT_FLOW_STEP0( |
| 1655 "input,benchmark", | 1655 "input,benchmark", |
| 1656 "LatencyInfo.Flow", | 1656 "LatencyInfo.Flow", |
| 1657 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), | 1657 TRACE_ID_DONT_MANGLE(latency.trace_id), |
| 1658 "SwapBuffers"); | 1658 "SwapBuffers"); |
| 1659 // Only add the latency component once for renderer swap, not the browser |
| 1660 // swap. |
| 1661 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, |
| 1662 0, nullptr)) { |
| 1663 latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, |
| 1664 0, 0); |
| 1665 } |
| 1659 } | 1666 } |
| 1660 renderer_->SwapBuffers(metadata); | 1667 renderer_->SwapBuffers(metadata); |
| 1661 return true; | 1668 return true; |
| 1662 } | 1669 } |
| 1663 | 1670 |
| 1664 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { | 1671 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { |
| 1665 // Sample the frame time now. This time will be used for updating animations | 1672 // Sample the frame time now. This time will be used for updating animations |
| 1666 // when we draw. | 1673 // when we draw. |
| 1667 UpdateCurrentBeginFrameArgs(args); | 1674 UpdateCurrentBeginFrameArgs(args); |
| 1668 // Cache the begin impl frame interval | 1675 // Cache the begin impl frame interval |
| (...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3505 (*it)->OnSetNeedsRedrawOnImpl(); | 3512 (*it)->OnSetNeedsRedrawOnImpl(); |
| 3506 } | 3513 } |
| 3507 | 3514 |
| 3508 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { | 3515 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { |
| 3509 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3516 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
| 3510 for (; it != swap_promise_monitor_.end(); it++) | 3517 for (; it != swap_promise_monitor_.end(); it++) |
| 3511 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); | 3518 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); |
| 3512 } | 3519 } |
| 3513 | 3520 |
| 3514 } // namespace cc | 3521 } // namespace cc |
| OLD | NEW |