| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 scroll_on_main_thread); | 158 scroll_on_main_thread); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace | 162 } // namespace |
| 163 | 163 |
| 164 DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer, | 164 DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer, |
| 165 "Scheduling.%s.PendingTreeDuration"); | 165 "Scheduling.%s.PendingTreeDuration"); |
| 166 | 166 |
| 167 LayerTreeHostImpl::FrameData::FrameData() | 167 LayerTreeHostImpl::FrameData::FrameData() |
| 168 : render_surface_layer_list(nullptr), has_no_damage(false) {} | 168 : render_surface_layer_list(nullptr), |
| 169 has_no_damage(false), |
| 170 may_contain_video(false) {} |
| 169 | 171 |
| 170 LayerTreeHostImpl::FrameData::~FrameData() {} | 172 LayerTreeHostImpl::FrameData::~FrameData() {} |
| 171 | 173 |
| 172 std::unique_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( | 174 std::unique_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( |
| 173 const LayerTreeSettings& settings, | 175 const LayerTreeSettings& settings, |
| 174 LayerTreeHostImplClient* client, | 176 LayerTreeHostImplClient* client, |
| 175 TaskRunnerProvider* task_runner_provider, | 177 TaskRunnerProvider* task_runner_provider, |
| 176 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 178 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 177 SharedBitmapManager* shared_bitmap_manager, | 179 SharedBitmapManager* shared_bitmap_manager, |
| 178 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 180 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 contributing_render_pass, | 907 contributing_render_pass, |
| 906 &append_quads_data); | 908 &append_quads_data); |
| 907 } else if (it.represents_itself() && !it->visible_layer_rect().IsEmpty()) { | 909 } else if (it.represents_itself() && !it->visible_layer_rect().IsEmpty()) { |
| 908 bool occluded = | 910 bool occluded = |
| 909 it->draw_properties().occlusion_in_content_space.IsOccluded( | 911 it->draw_properties().occlusion_in_content_space.IsOccluded( |
| 910 it->visible_layer_rect()); | 912 it->visible_layer_rect()); |
| 911 if (!occluded && it->WillDraw(draw_mode, resource_provider_.get())) { | 913 if (!occluded && it->WillDraw(draw_mode, resource_provider_.get())) { |
| 912 DCHECK_EQ(active_tree_.get(), it->layer_tree_impl()); | 914 DCHECK_EQ(active_tree_.get(), it->layer_tree_impl()); |
| 913 | 915 |
| 914 frame->will_draw_layers.push_back(*it); | 916 frame->will_draw_layers.push_back(*it); |
| 917 if (it->may_contain_video()) |
| 918 frame->may_contain_video = true; |
| 915 | 919 |
| 916 it->AppendQuads(target_render_pass, &append_quads_data); | 920 it->AppendQuads(target_render_pass, &append_quads_data); |
| 917 } | 921 } |
| 918 | 922 |
| 919 ++layers_drawn; | 923 ++layers_drawn; |
| 920 } | 924 } |
| 921 | 925 |
| 922 rendering_stats_instrumentation_->AddVisibleContentArea( | 926 rendering_stats_instrumentation_->AddVisibleContentArea( |
| 923 append_quads_data.visible_layer_area); | 927 append_quads_data.visible_layer_area); |
| 924 rendering_stats_instrumentation_->AddApproximatedVisibleContentArea( | 928 rendering_stats_instrumentation_->AddApproximatedVisibleContentArea( |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 | 1097 |
| 1094 // This will cause NotifyTileStateChanged() to be called for any tiles that | 1098 // This will cause NotifyTileStateChanged() to be called for any tiles that |
| 1095 // completed, which will add damage for visible tiles to the frame for them so | 1099 // completed, which will add damage for visible tiles to the frame for them so |
| 1096 // they appear as part of the current frame being drawn. | 1100 // they appear as part of the current frame being drawn. |
| 1097 tile_manager_.Flush(); | 1101 tile_manager_.Flush(); |
| 1098 | 1102 |
| 1099 frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList(); | 1103 frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList(); |
| 1100 frame->render_passes.clear(); | 1104 frame->render_passes.clear(); |
| 1101 frame->will_draw_layers.clear(); | 1105 frame->will_draw_layers.clear(); |
| 1102 frame->has_no_damage = false; | 1106 frame->has_no_damage = false; |
| 1107 frame->may_contain_video = false; |
| 1103 | 1108 |
| 1104 if (active_tree_->RootRenderSurface()) { | 1109 if (active_tree_->RootRenderSurface()) { |
| 1105 gfx::Rect device_viewport_damage_rect = viewport_damage_rect_; | 1110 gfx::Rect device_viewport_damage_rect = viewport_damage_rect_; |
| 1106 viewport_damage_rect_ = gfx::Rect(); | 1111 viewport_damage_rect_ = gfx::Rect(); |
| 1107 | 1112 |
| 1108 active_tree_->RootRenderSurface()->damage_tracker()->AddDamageNextUpdate( | 1113 active_tree_->RootRenderSurface()->damage_tracker()->AddDamageNextUpdate( |
| 1109 device_viewport_damage_rect); | 1114 device_viewport_damage_rect); |
| 1110 } | 1115 } |
| 1111 | 1116 |
| 1112 DrawResult draw_result = CalculateRenderPasses(frame); | 1117 DrawResult draw_result = CalculateRenderPasses(frame); |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1817 return renderer_->Capabilities(); | 1822 return renderer_->Capabilities(); |
| 1818 } | 1823 } |
| 1819 | 1824 |
| 1820 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { | 1825 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { |
| 1821 ResetRequiresHighResToDraw(); | 1826 ResetRequiresHighResToDraw(); |
| 1822 if (frame.has_no_damage) { | 1827 if (frame.has_no_damage) { |
| 1823 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); | 1828 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); |
| 1824 return false; | 1829 return false; |
| 1825 } | 1830 } |
| 1826 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); | 1831 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); |
| 1832 metadata.may_contain_video = frame.may_contain_video; |
| 1827 active_tree()->FinishSwapPromises(&metadata); | 1833 active_tree()->FinishSwapPromises(&metadata); |
| 1828 for (auto& latency : metadata.latency_info) { | 1834 for (auto& latency : metadata.latency_info) { |
| 1829 TRACE_EVENT_WITH_FLOW1("input,benchmark", | 1835 TRACE_EVENT_WITH_FLOW1("input,benchmark", |
| 1830 "LatencyInfo.Flow", | 1836 "LatencyInfo.Flow", |
| 1831 TRACE_ID_DONT_MANGLE(latency.trace_id()), | 1837 TRACE_ID_DONT_MANGLE(latency.trace_id()), |
| 1832 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 1838 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
| 1833 "step", "SwapBuffers"); | 1839 "step", "SwapBuffers"); |
| 1834 // Only add the latency component once for renderer swap, not the browser | 1840 // Only add the latency component once for renderer swap, not the browser |
| 1835 // swap. | 1841 // swap. |
| 1836 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, | 1842 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, |
| (...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4050 return task_runner_provider_->HasImplThread(); | 4056 return task_runner_provider_->HasImplThread(); |
| 4051 } | 4057 } |
| 4052 | 4058 |
| 4053 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4059 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 4054 // In single threaded mode we skip the pending tree and commit directly to the | 4060 // In single threaded mode we skip the pending tree and commit directly to the |
| 4055 // active tree. | 4061 // active tree. |
| 4056 return !task_runner_provider_->HasImplThread(); | 4062 return !task_runner_provider_->HasImplThread(); |
| 4057 } | 4063 } |
| 4058 | 4064 |
| 4059 } // namespace cc | 4065 } // namespace cc |
| OLD | NEW |