Chromium Code Reviews| 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, | |
|
jdduke (slow)
2015/02/11 23:22:02
This seems like a common operation (adding a comon
Yufeng Shen (Slow to review)
2015/02/12 02:59:02
will do a follow up for this.
| |
| 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 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3508 } | 3515 } |
| 3509 | 3516 |
| 3510 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3517 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
| 3511 std::vector<PictureLayerImpl*>::iterator it = | 3518 std::vector<PictureLayerImpl*>::iterator it = |
| 3512 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3519 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
| 3513 DCHECK(it != picture_layers_.end()); | 3520 DCHECK(it != picture_layers_.end()); |
| 3514 picture_layers_.erase(it); | 3521 picture_layers_.erase(it); |
| 3515 } | 3522 } |
| 3516 | 3523 |
| 3517 } // namespace cc | 3524 } // namespace cc |
| OLD | NEW |