Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2140783002: services/ui: Detect when a video is playing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tot merge Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1808 return renderer_->Capabilities(); 1813 return renderer_->Capabilities();
1809 } 1814 }
1810 1815
1811 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { 1816 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) {
1812 ResetRequiresHighResToDraw(); 1817 ResetRequiresHighResToDraw();
1813 if (frame.has_no_damage) { 1818 if (frame.has_no_damage) {
1814 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); 1819 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS);
1815 return false; 1820 return false;
1816 } 1821 }
1817 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); 1822 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata();
1823 metadata.may_contain_video = frame.may_contain_video;
1818 active_tree()->FinishSwapPromises(&metadata); 1824 active_tree()->FinishSwapPromises(&metadata);
1819 for (auto& latency : metadata.latency_info) { 1825 for (auto& latency : metadata.latency_info) {
1820 TRACE_EVENT_WITH_FLOW1("input,benchmark", 1826 TRACE_EVENT_WITH_FLOW1("input,benchmark",
1821 "LatencyInfo.Flow", 1827 "LatencyInfo.Flow",
1822 TRACE_ID_DONT_MANGLE(latency.trace_id()), 1828 TRACE_ID_DONT_MANGLE(latency.trace_id()),
1823 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, 1829 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT,
1824 "step", "SwapBuffers"); 1830 "step", "SwapBuffers");
1825 // Only add the latency component once for renderer swap, not the browser 1831 // Only add the latency component once for renderer swap, not the browser
1826 // swap. 1832 // swap.
1827 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 1833 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT,
(...skipping 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after
4036 return task_runner_provider_->HasImplThread(); 4042 return task_runner_provider_->HasImplThread();
4037 } 4043 }
4038 4044
4039 bool LayerTreeHostImpl::CommitToActiveTree() const { 4045 bool LayerTreeHostImpl::CommitToActiveTree() const {
4040 // In single threaded mode we skip the pending tree and commit directly to the 4046 // In single threaded mode we skip the pending tree and commit directly to the
4041 // active tree. 4047 // active tree.
4042 return !task_runner_provider_->HasImplThread(); 4048 return !task_runner_provider_->HasImplThread();
4043 } 4049 }
4044 4050
4045 } // namespace cc 4051 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698