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

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: test 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_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 <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 required_for_draw_tile_is_top_of_raster_queue_(false) { 232 required_for_draw_tile_is_top_of_raster_queue_(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 const std::vector<FrameTimingRequest>& frame_timing_requests =
809 it->frame_timing_requests();
810 for (const auto& request : frame_timing_requests) {
danakj 2015/02/02 21:19:06 you could just : it->frame_timing_requests()) ? a
vmpstr 2015/02/02 22:32:05 Done.
811 if (request.rect().Intersects(it->visible_content_rect())) {
danakj 2015/02/02 21:19:06 you need to map this VCR to layer space
vmpstr 2015/02/02 22:32:05 Done.
812 current_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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 viewport_damage_rect_ = gfx::Rect(); 1055 viewport_damage_rect_ = gfx::Rect();
1043 1056
1044 active_tree_->root_layer()->render_surface()->damage_tracker()-> 1057 active_tree_->root_layer()->render_surface()->damage_tracker()->
1045 AddDamageNextUpdate(device_viewport_damage_rect); 1058 AddDamageNextUpdate(device_viewport_damage_rect);
1046 } 1059 }
1047 1060
1048 DrawResult draw_result = CalculateRenderPasses(frame); 1061 DrawResult draw_result = CalculateRenderPasses(frame);
1049 if (draw_result != DRAW_SUCCESS) { 1062 if (draw_result != DRAW_SUCCESS) {
1050 DCHECK(!output_surface_->capabilities() 1063 DCHECK(!output_surface_->capabilities()
1051 .draw_and_swap_full_viewport_every_frame); 1064 .draw_and_swap_full_viewport_every_frame);
1065 current_composite_events_.clear();
danakj 2015/02/02 21:19:06 if you make this a member of the |frame| then you
vmpstr 2015/02/02 22:32:05 Done.
1052 return draw_result; 1066 return draw_result;
1053 } 1067 }
1054 1068
1055 // If we return DRAW_SUCCESS, then we expect DrawLayers() to be called before 1069 // If we return DRAW_SUCCESS, then we expect DrawLayers() to be called before
1056 // this function is called again. 1070 // this function is called again.
1057 return draw_result; 1071 return draw_result;
1058 } 1072 }
1059 1073
1060 void LayerTreeHostImpl::EvictTexturesForTesting() { 1074 void LayerTreeHostImpl::EvictTexturesForTesting() {
1061 EnforceManagedMemoryPolicy(ManagedMemoryPolicy(0)); 1075 EnforceManagedMemoryPolicy(ManagedMemoryPolicy(0));
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 1444
1431 static void LayerTreeHostImplDidBeginTracingCallback(LayerImpl* layer) { 1445 static void LayerTreeHostImplDidBeginTracingCallback(LayerImpl* layer) {
1432 layer->DidBeginTracing(); 1446 layer->DidBeginTracing();
1433 } 1447 }
1434 1448
1435 void LayerTreeHostImpl::DrawLayers(FrameData* frame, 1449 void LayerTreeHostImpl::DrawLayers(FrameData* frame,
1436 base::TimeTicks frame_begin_time) { 1450 base::TimeTicks frame_begin_time) {
1437 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); 1451 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers");
1438 DCHECK(CanDraw()); 1452 DCHECK(CanDraw());
1439 1453
1454 if (!current_composite_events_.empty()) {
1455 frame_timing_tracker_->SaveTimeStamps(base::TimeTicks::Now(),
danakj 2015/02/02 21:19:06 should we use the frame time instead of now?
vmpstr 2015/02/02 22:32:05 Done. I think that works. According to the spec, w
1456 current_composite_events_);
1457 current_composite_events_.clear();
1458 }
1459
1440 if (frame->has_no_damage) { 1460 if (frame->has_no_damage) {
1441 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoDamage", TRACE_EVENT_SCOPE_THREAD); 1461 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoDamage", TRACE_EVENT_SCOPE_THREAD);
1442 DCHECK(!output_surface_->capabilities() 1462 DCHECK(!output_surface_->capabilities()
1443 .draw_and_swap_full_viewport_every_frame); 1463 .draw_and_swap_full_viewport_every_frame);
1444 return; 1464 return;
1445 } 1465 }
1446 1466
1447 DCHECK(!frame->render_passes.empty()); 1467 DCHECK(!frame->render_passes.empty());
1448 1468
1449 fps_counter_->SaveTimeStamp(frame_begin_time, 1469 fps_counter_->SaveTimeStamp(frame_begin_time,
(...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after
3458 } 3478 }
3459 3479
3460 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3480 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3461 std::vector<PictureLayerImpl*>::iterator it = 3481 std::vector<PictureLayerImpl*>::iterator it =
3462 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3482 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3463 DCHECK(it != picture_layers_.end()); 3483 DCHECK(it != picture_layers_.end());
3464 picture_layers_.erase(it); 3484 picture_layers_.erase(it);
3465 } 3485 }
3466 3486
3467 } // namespace cc 3487 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698