| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1713 } | 1713 } |
| 1714 | 1714 |
| 1715 { | 1715 { |
| 1716 TRACE_EVENT0("cc", "DrawLayers.FrameViewerTracing"); | 1716 TRACE_EVENT0("cc", "DrawLayers.FrameViewerTracing"); |
| 1717 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( | 1717 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( |
| 1718 frame_viewer_instrumentation::kCategoryLayerTree, | 1718 frame_viewer_instrumentation::kCategoryLayerTree, |
| 1719 "cc::LayerTreeHostImpl", id_, AsValueWithFrame(frame)); | 1719 "cc::LayerTreeHostImpl", id_, AsValueWithFrame(frame)); |
| 1720 } | 1720 } |
| 1721 | 1721 |
| 1722 const DrawMode draw_mode = GetDrawMode(); | 1722 const DrawMode draw_mode = GetDrawMode(); |
| 1723 ResourceId evict_resource_id = 0U; |
| 1723 | 1724 |
| 1724 // Because the contents of the HUD depend on everything else in the frame, the | 1725 // Because the contents of the HUD depend on everything else in the frame, the |
| 1725 // contents of its texture are updated as the last thing before the frame is | 1726 // contents of its texture are updated as the last thing before the frame is |
| 1726 // drawn. | 1727 // drawn. |
| 1727 if (active_tree_->hud_layer()) { | 1728 if (active_tree_->hud_layer()) { |
| 1728 TRACE_EVENT0("cc", "DrawLayers.UpdateHudTexture"); | 1729 TRACE_EVENT0("cc", "DrawLayers.UpdateHudTexture"); |
| 1729 active_tree_->hud_layer()->UpdateHudTexture( | 1730 // For Ganesh backed HUD, a context loss may cause the drawing canvas to be |
| 1731 // invalid, return the resource id to evicted from quadlist. |
| 1732 evict_resource_id = active_tree_->hud_layer()->UpdateHudTexture( |
| 1730 draw_mode, resource_provider_.get(), | 1733 draw_mode, resource_provider_.get(), |
| 1731 layer_tree_frame_sink_->context_provider()); | 1734 layer_tree_frame_sink_->context_provider()); |
| 1735 if (evict_resource_id != 0) |
| 1736 active_tree_->hud_layer()->EvictHudQuad(frame->render_passes); |
| 1732 } | 1737 } |
| 1733 | 1738 |
| 1734 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); | 1739 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); |
| 1735 metadata.may_contain_video = frame->may_contain_video; | 1740 metadata.may_contain_video = frame->may_contain_video; |
| 1736 metadata.activation_dependencies = std::move(frame->activation_dependencies); | 1741 metadata.activation_dependencies = std::move(frame->activation_dependencies); |
| 1737 active_tree()->FinishSwapPromises(&metadata); | 1742 active_tree()->FinishSwapPromises(&metadata); |
| 1738 for (auto& latency : metadata.latency_info) { | 1743 for (auto& latency : metadata.latency_info) { |
| 1739 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", | 1744 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", |
| 1740 TRACE_ID_DONT_MANGLE(latency.trace_id()), | 1745 TRACE_ID_DONT_MANGLE(latency.trace_id()), |
| 1741 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 1746 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
| (...skipping 2674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4416 | 4421 |
| 4417 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | 4422 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { |
| 4418 if (!element_id) | 4423 if (!element_id) |
| 4419 return; | 4424 return; |
| 4420 if (ScrollbarAnimationController* animation_controller = | 4425 if (ScrollbarAnimationController* animation_controller = |
| 4421 ScrollbarAnimationControllerForElementId(element_id)) | 4426 ScrollbarAnimationControllerForElementId(element_id)) |
| 4422 animation_controller->DidScrollUpdate(); | 4427 animation_controller->DidScrollUpdate(); |
| 4423 } | 4428 } |
| 4424 | 4429 |
| 4425 } // namespace cc | 4430 } // namespace cc |
| OLD | NEW |