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

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

Issue 884243004: cc: Record frame timing composite events in the tracker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 device_scale_factor_(1.f), 222 device_scale_factor_(1.f),
223 resourceless_software_draw_(false), 223 resourceless_software_draw_(false),
224 begin_impl_frame_interval_(BeginFrameArgs::DefaultInterval()), 224 begin_impl_frame_interval_(BeginFrameArgs::DefaultInterval()),
225 animation_registrar_(AnimationRegistrar::Create()), 225 animation_registrar_(AnimationRegistrar::Create()),
226 rendering_stats_instrumentation_(rendering_stats_instrumentation), 226 rendering_stats_instrumentation_(rendering_stats_instrumentation),
227 micro_benchmark_controller_(this), 227 micro_benchmark_controller_(this),
228 shared_bitmap_manager_(shared_bitmap_manager), 228 shared_bitmap_manager_(shared_bitmap_manager),
229 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), 229 gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
230 id_(id), 230 id_(id),
231 requires_high_res_to_draw_(false), 231 requires_high_res_to_draw_(false),
232 is_likely_to_require_a_draw_(false) { 232 is_likely_to_require_a_draw_(false),
233 frame_timing_tracker_(FrameTimingTracker::Create()) {
233 DCHECK(proxy_->IsImplThread()); 234 DCHECK(proxy_->IsImplThread());
234 DidVisibilityChange(this, visible_); 235 DidVisibilityChange(this, visible_);
235 animation_registrar_->set_supports_scroll_animations( 236 animation_registrar_->set_supports_scroll_animations(
236 proxy_->SupportsImplScrolling()); 237 proxy_->SupportsImplScrolling());
237 238
238 SetDebugState(settings.initial_debug_state); 239 SetDebugState(settings.initial_debug_state);
239 240
240 // LTHI always has an active tree. 241 // LTHI always has an active tree.
241 active_tree_ = LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>(), 242 active_tree_ = LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>(),
242 new SyncedElasticOverscroll); 243 new SyncedElasticOverscroll);
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 795
795 contributing_render_pass_id = 796 contributing_render_pass_id =
796 it->NextContributingRenderPassId(contributing_render_pass_id); 797 it->NextContributingRenderPassId(contributing_render_pass_id);
797 } 798 }
798 } 799 }
799 800
800 AppendQuadsForLayer(target_render_pass, 801 AppendQuadsForLayer(target_render_pass,
801 *it, 802 *it,
802 occlusion_tracker, 803 occlusion_tracker,
803 &append_quads_data); 804 &append_quads_data);
805
806 // For layers that represent themselves, add composite frame timing
807 // requests if the visible rect intersects the requested rect.
808 for (const auto& request : it->frame_timing_requests()) {
809 const gfx::Rect& request_content_rect =
810 it->LayerRectToContentRect(request.rect());
811 if (request_content_rect.Intersects(it->visible_content_rect())) {
812 frame->composite_events.push_back(
813 FrameTimingTracker::FrameAndRectIds(
814 active_tree_->source_frame_number(), request.id()));
815 }
816 }
804 } 817 }
805 818
806 ++layers_drawn; 819 ++layers_drawn;
807 } 820 }
808 821
809 rendering_stats_instrumentation_->AddVisibleContentArea( 822 rendering_stats_instrumentation_->AddVisibleContentArea(
810 append_quads_data.visible_content_area); 823 append_quads_data.visible_content_area);
811 rendering_stats_instrumentation_->AddApproximatedVisibleContentArea( 824 rendering_stats_instrumentation_->AddApproximatedVisibleContentArea(
812 append_quads_data.approximated_visible_content_area); 825 append_quads_data.approximated_visible_content_area);
813 826
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 1432
1420 static void LayerTreeHostImplDidBeginTracingCallback(LayerImpl* layer) { 1433 static void LayerTreeHostImplDidBeginTracingCallback(LayerImpl* layer) {
1421 layer->DidBeginTracing(); 1434 layer->DidBeginTracing();
1422 } 1435 }
1423 1436
1424 void LayerTreeHostImpl::DrawLayers(FrameData* frame, 1437 void LayerTreeHostImpl::DrawLayers(FrameData* frame,
1425 base::TimeTicks frame_begin_time) { 1438 base::TimeTicks frame_begin_time) {
1426 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); 1439 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers");
1427 DCHECK(CanDraw()); 1440 DCHECK(CanDraw());
1428 1441
1442 if (!frame->composite_events.empty()) {
1443 frame_timing_tracker_->SaveTimeStamps(frame_begin_time,
1444 frame->composite_events);
1445 }
1446
1429 if (frame->has_no_damage) { 1447 if (frame->has_no_damage) {
1430 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoDamage", TRACE_EVENT_SCOPE_THREAD); 1448 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoDamage", TRACE_EVENT_SCOPE_THREAD);
1431 DCHECK(!output_surface_->capabilities() 1449 DCHECK(!output_surface_->capabilities()
1432 .draw_and_swap_full_viewport_every_frame); 1450 .draw_and_swap_full_viewport_every_frame);
1433 return; 1451 return;
1434 } 1452 }
1435 1453
1436 DCHECK(!frame->render_passes.empty()); 1454 DCHECK(!frame->render_passes.empty());
1437 1455
1438 fps_counter_->SaveTimeStamp(frame_begin_time, 1456 fps_counter_->SaveTimeStamp(frame_begin_time,
(...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after
3447 } 3465 }
3448 3466
3449 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3467 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3450 std::vector<PictureLayerImpl*>::iterator it = 3468 std::vector<PictureLayerImpl*>::iterator it =
3451 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3469 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3452 DCHECK(it != picture_layers_.end()); 3470 DCHECK(it != picture_layers_.end());
3453 picture_layers_.erase(it); 3471 picture_layers_.erase(it);
3454 } 3472 }
3455 3473
3456 } // namespace cc 3474 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698