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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1694 } | 1694 } |
| 1695 | 1695 |
| 1696 { | 1696 { |
| 1697 TRACE_EVENT0("cc", "DrawLayers.FrameViewerTracing"); | 1697 TRACE_EVENT0("cc", "DrawLayers.FrameViewerTracing"); |
| 1698 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( | 1698 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( |
| 1699 frame_viewer_instrumentation::kCategoryLayerTree, | 1699 frame_viewer_instrumentation::kCategoryLayerTree, |
| 1700 "cc::LayerTreeHostImpl", id_, AsValueWithFrame(frame)); | 1700 "cc::LayerTreeHostImpl", id_, AsValueWithFrame(frame)); |
| 1701 } | 1701 } |
| 1702 | 1702 |
| 1703 const DrawMode draw_mode = GetDrawMode(); | 1703 const DrawMode draw_mode = GetDrawMode(); |
| 1704 uint32_t evict_res_id = 0U; | |
|
vmpstr
2017/06/30 23:16:51
ResourceId? also evict_resource_id.
sohan
2017/07/04 16:51:13
Done.
| |
| 1704 | 1705 |
| 1705 // Because the contents of the HUD depend on everything else in the frame, the | 1706 // Because the contents of the HUD depend on everything else in the frame, the |
| 1706 // contents of its texture are updated as the last thing before the frame is | 1707 // contents of its texture are updated as the last thing before the frame is |
| 1707 // drawn. | 1708 // drawn. |
| 1708 if (active_tree_->hud_layer()) { | 1709 if (active_tree_->hud_layer()) { |
| 1709 TRACE_EVENT0("cc", "DrawLayers.UpdateHudTexture"); | 1710 TRACE_EVENT0("cc", "DrawLayers.UpdateHudTexture"); |
| 1710 active_tree_->hud_layer()->UpdateHudTexture( | 1711 // For Ganesh backed HUD, a context loss may cause the drawing canvas to be |
| 1712 // invalid, return the resource id to evicted from quadlist. | |
| 1713 evict_res_id = active_tree_->hud_layer()->UpdateHudTexture( | |
| 1711 draw_mode, resource_provider_.get(), | 1714 draw_mode, resource_provider_.get(), |
| 1712 layer_tree_frame_sink_->context_provider()); | 1715 layer_tree_frame_sink_->context_provider()); |
| 1713 } | 1716 } |
| 1714 | 1717 |
| 1715 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); | 1718 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); |
| 1716 metadata.may_contain_video = frame->may_contain_video; | 1719 metadata.may_contain_video = frame->may_contain_video; |
| 1717 metadata.activation_dependencies = std::move(frame->activation_dependencies); | 1720 metadata.activation_dependencies = std::move(frame->activation_dependencies); |
| 1718 active_tree()->FinishSwapPromises(&metadata); | 1721 active_tree()->FinishSwapPromises(&metadata); |
| 1719 for (auto& latency : metadata.latency_info) { | 1722 for (auto& latency : metadata.latency_info) { |
| 1720 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", | 1723 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", |
| 1721 TRACE_ID_DONT_MANGLE(latency.trace_id()), | 1724 TRACE_ID_DONT_MANGLE(latency.trace_id()), |
| 1722 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 1725 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
| 1723 "step", "SwapBuffers"); | 1726 "step", "SwapBuffers"); |
| 1724 // Only add the latency component once for renderer swap, not the browser | 1727 // Only add the latency component once for renderer swap, not the browser |
| 1725 // swap. | 1728 // swap. |
| 1726 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, | 1729 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, |
| 1727 nullptr)) { | 1730 nullptr)) { |
| 1728 latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, | 1731 latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, |
| 1729 0, 0); | 1732 0, 0); |
| 1730 } | 1733 } |
| 1731 } | 1734 } |
| 1732 | 1735 |
| 1733 // Collect all resource ids in the render passes into a single array. | 1736 // Collect all resource ids in the render passes into a single array. |
| 1734 ResourceProvider::ResourceIdArray resources; | 1737 ResourceProvider::ResourceIdArray resources; |
| 1735 for (const auto& render_pass : frame->render_passes) { | 1738 for (const auto& render_pass : frame->render_passes) { |
| 1736 for (auto* quad : render_pass->quad_list) { | 1739 for (auto* quad : render_pass->quad_list) { |
| 1737 for (ResourceId resource_id : quad->resources) | 1740 for (ResourceId resource_id : quad->resources) { |
| 1738 resources.push_back(resource_id); | 1741 if (resource_id != evict_res_id) { |
|
vmpstr
2017/06/30 23:16:51
This doesn't look right.
The resource should not
sohan
2017/07/04 16:51:13
Yeah this is kinda odd.
The problem is for HUD lay
| |
| 1742 resources.push_back(resource_id); | |
| 1743 } | |
| 1744 } | |
| 1739 } | 1745 } |
| 1740 } | 1746 } |
| 1741 | 1747 |
| 1742 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, | 1748 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, |
| 1743 frame->begin_frame_ack.sequence_number); | 1749 frame->begin_frame_ack.sequence_number); |
| 1744 metadata.begin_frame_ack = frame->begin_frame_ack; | 1750 metadata.begin_frame_ack = frame->begin_frame_ack; |
| 1745 | 1751 |
| 1746 CompositorFrame compositor_frame; | 1752 CompositorFrame compositor_frame; |
| 1747 compositor_frame.metadata = std::move(metadata); | 1753 compositor_frame.metadata = std::move(metadata); |
| 1748 resource_provider_->PrepareSendToParent(resources, | 1754 resource_provider_->PrepareSendToParent(resources, |
| (...skipping 2565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4314 | 4320 |
| 4315 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | 4321 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { |
| 4316 if (!element_id) | 4322 if (!element_id) |
| 4317 return; | 4323 return; |
| 4318 if (ScrollbarAnimationController* animation_controller = | 4324 if (ScrollbarAnimationController* animation_controller = |
| 4319 ScrollbarAnimationControllerForElementId(element_id)) | 4325 ScrollbarAnimationControllerForElementId(element_id)) |
| 4320 animation_controller->DidScrollUpdate(); | 4326 animation_controller->DidScrollUpdate(); |
| 4321 } | 4327 } |
| 4322 | 4328 |
| 4323 } // namespace cc | 4329 } // namespace cc |
| OLD | NEW |