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

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

Issue 397443002: [not for review] Add Draw entries to window Performance Timeline Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git pull of third_party/WebKit Created 6 years, 5 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 <iostream>
8 #include <limits> 9 #include <limits>
9 10
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
12 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
13 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
14 #include "base/stl_util.h" 15 #include "base/stl_util.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
16 #include "cc/animation/animation_id_provider.h" 17 #include "cc/animation/animation_id_provider.h"
17 #include "cc/animation/scroll_offset_animation_curve.h" 18 #include "cc/animation/scroll_offset_animation_curve.h"
18 #include "cc/animation/scrollbar_animation_controller.h" 19 #include "cc/animation/scrollbar_animation_controller.h"
19 #include "cc/animation/timing_function.h" 20 #include "cc/animation/timing_function.h"
20 #include "cc/base/latency_info_swap_promise_monitor.h" 21 #include "cc/base/latency_info_swap_promise_monitor.h"
21 #include "cc/base/math_util.h" 22 #include "cc/base/math_util.h"
22 #include "cc/base/util.h" 23 #include "cc/base/util.h"
23 #include "cc/debug/benchmark_instrumentation.h" 24 #include "cc/debug/benchmark_instrumentation.h"
24 #include "cc/debug/debug_rect_history.h" 25 #include "cc/debug/debug_rect_history.h"
25 #include "cc/debug/devtools_instrumentation.h" 26 #include "cc/debug/devtools_instrumentation.h"
26 #include "cc/debug/frame_rate_counter.h" 27 #include "cc/debug/frame_rate_counter.h"
27 #include "cc/debug/paint_time_counter.h" 28 #include "cc/debug/paint_time_counter.h"
29 #include "cc/debug/performance_draw_timing_counter.h"
28 #include "cc/debug/rendering_stats_instrumentation.h" 30 #include "cc/debug/rendering_stats_instrumentation.h"
29 #include "cc/debug/traced_value.h" 31 #include "cc/debug/traced_value.h"
30 #include "cc/input/page_scale_animation.h" 32 #include "cc/input/page_scale_animation.h"
31 #include "cc/input/top_controls_manager.h" 33 #include "cc/input/top_controls_manager.h"
32 #include "cc/layers/append_quads_data.h" 34 #include "cc/layers/append_quads_data.h"
33 #include "cc/layers/heads_up_display_layer_impl.h" 35 #include "cc/layers/heads_up_display_layer_impl.h"
34 #include "cc/layers/layer_impl.h" 36 #include "cc/layers/layer_impl.h"
35 #include "cc/layers/layer_iterator.h" 37 #include "cc/layers/layer_iterator.h"
36 #include "cc/layers/painted_scrollbar_layer_impl.h" 38 #include "cc/layers/painted_scrollbar_layer_impl.h"
37 #include "cc/layers/render_surface_impl.h" 39 #include "cc/layers/render_surface_impl.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 root_layer_scroll_offset_delegate_(NULL), 231 root_layer_scroll_offset_delegate_(NULL),
230 settings_(settings), 232 settings_(settings),
231 visible_(true), 233 visible_(true),
232 cached_managed_memory_policy_( 234 cached_managed_memory_policy_(
233 PrioritizedResourceManager::DefaultMemoryAllocationLimit(), 235 PrioritizedResourceManager::DefaultMemoryAllocationLimit(),
234 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 236 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING,
235 ManagedMemoryPolicy::kDefaultNumResourcesLimit), 237 ManagedMemoryPolicy::kDefaultNumResourcesLimit),
236 pinch_gesture_active_(false), 238 pinch_gesture_active_(false),
237 pinch_gesture_end_should_clear_scrolling_layer_(false), 239 pinch_gesture_end_should_clear_scrolling_layer_(false),
238 fps_counter_(FrameRateCounter::Create(proxy_->HasImplThread())), 240 fps_counter_(FrameRateCounter::Create(proxy_->HasImplThread())),
241 draw_counter_(PerformanceDrawTimingCounter::Create()),
239 paint_time_counter_(PaintTimeCounter::Create()), 242 paint_time_counter_(PaintTimeCounter::Create()),
240 memory_history_(MemoryHistory::Create()), 243 memory_history_(MemoryHistory::Create()),
241 debug_rect_history_(DebugRectHistory::Create()), 244 debug_rect_history_(DebugRectHistory::Create()),
242 texture_mailbox_deleter_(new TextureMailboxDeleter( 245 texture_mailbox_deleter_(new TextureMailboxDeleter(
243 proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner() 246 proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner()
244 : proxy_->MainThreadTaskRunner())), 247 : proxy_->MainThreadTaskRunner())),
245 max_memory_needed_bytes_(0), 248 max_memory_needed_bytes_(0),
246 zero_budget_(false), 249 zero_budget_(false),
247 device_scale_factor_(1.f), 250 device_scale_factor_(1.f),
248 overhang_ui_resource_id_(0), 251 overhang_ui_resource_id_(0),
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 847
845 contributing_render_pass_id = 848 contributing_render_pass_id =
846 it->NextContributingRenderPassId(contributing_render_pass_id); 849 it->NextContributingRenderPassId(contributing_render_pass_id);
847 } 850 }
848 } 851 }
849 852
850 AppendQuadsForLayer(target_render_pass, 853 AppendQuadsForLayer(target_render_pass,
851 *it, 854 *it,
852 occlusion_tracker, 855 occlusion_tracker,
853 &append_quads_data); 856 &append_quads_data);
857
858 const std::vector<std::pair<int64_t, gfx::Rect> > &vec =
enne (OOO) 2014/07/22 20:44:26 This block of code could probably just get moved i
859 it->draw_frame_request_rects();
860 if (vec.size()) {
enne (OOO) 2014/07/22 20:44:26 style nit: early out here and continue rather than
Mike B 2014/07/25 23:09:41 Hm, to do that I need to make it a function I can
861 gfx::Rect viewport = it->visible_content_rect();
enne (OOO) 2014/07/22 20:44:26 bikeshed: This isn't the viewport, it's the viewpo
Mike B 2014/07/25 23:09:41 Gotcha, I'm just creating that variable to print o
862 std::cout << "[LayerTreeHostImpl] it->id() " << it->id()
863 << " it->visible_content_rect = ["
864 << viewport.x() << ", " << viewport.y() << ", "
865 << viewport.right() << ", " << viewport.bottom() << "]"
866 << std::endl;
867 for (size_t i = 0; i < vec.size(); ++i) {
868 int64_t rect_id = vec[i].first;
869 bool intersects = it->visible_content_rect().Intersects(
enne (OOO) 2014/07/22 20:44:26 visible content rect is in content space (aka laye
Mike B 2014/07/25 23:09:41 Done.
870 vec[i].second);
871 std::cout << "[LayerTreeHostImpl] Target " << rect_id
872 << (intersects ? " Intersects " : " Misses ") << " - ["
873 << vec[i].second.x() << ", " << vec[i].second.y() << ", "
874 << vec[i].second.width() << ", " << vec[i].second.height()
875 << "]" << std::endl;
876 if (intersects) {
877 uncommitted_draw_frame_ids_.push_back(
enne (OOO) 2014/07/22 20:44:26 This should live on the frame data too and not be
878 std::make_pair(active_tree_->source_frame_number(), rect_id));
enne (OOO) 2014/07/22 20:44:26 How does performance timeline handle getting the s
Mike B 2014/07/25 23:09:41 It gets 2 entries that have the same source frame
879 }
880 }
881 }
854 } 882 }
855
856 ++layers_drawn; 883 ++layers_drawn;
857 } 884 }
858 885
859 rendering_stats_instrumentation_->AddVisibleContentArea( 886 rendering_stats_instrumentation_->AddVisibleContentArea(
860 append_quads_data.visible_content_area); 887 append_quads_data.visible_content_area);
861 rendering_stats_instrumentation_->AddApproximatedVisibleContentArea( 888 rendering_stats_instrumentation_->AddApproximatedVisibleContentArea(
862 append_quads_data.approximated_visible_content_area); 889 append_quads_data.approximated_visible_content_area);
863 890
864 num_missing_tiles += append_quads_data.num_missing_tiles; 891 num_missing_tiles += append_quads_data.num_missing_tiles;
865 num_incomplete_tiles += append_quads_data.num_incomplete_tiles; 892 num_incomplete_tiles += append_quads_data.num_incomplete_tiles;
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 1445
1419 void LayerTreeHostImpl::DrawLayers(FrameData* frame, 1446 void LayerTreeHostImpl::DrawLayers(FrameData* frame,
1420 base::TimeTicks frame_begin_time) { 1447 base::TimeTicks frame_begin_time) {
1421 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); 1448 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers");
1422 DCHECK(CanDraw()); 1449 DCHECK(CanDraw());
1423 1450
1424 if (frame->has_no_damage) { 1451 if (frame->has_no_damage) {
1425 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoDamage", TRACE_EVENT_SCOPE_THREAD); 1452 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoDamage", TRACE_EVENT_SCOPE_THREAD);
1426 DCHECK(!output_surface_->capabilities() 1453 DCHECK(!output_surface_->capabilities()
1427 .draw_and_swap_full_viewport_every_frame); 1454 .draw_and_swap_full_viewport_every_frame);
1455 uncommitted_draw_frame_ids_.clear();
1428 return; 1456 return;
1429 } 1457 }
1430 1458
1431 DCHECK(!frame->render_passes.empty()); 1459 DCHECK(!frame->render_passes.empty());
1432 1460
1433 fps_counter_->SaveTimeStamp(frame_begin_time, 1461 fps_counter_->SaveTimeStamp(frame_begin_time,
1434 !output_surface_->context_provider()); 1462 !output_surface_->context_provider());
1435 bool on_main_thread = false; 1463 bool on_main_thread = false;
1436 rendering_stats_instrumentation_->IncrementFrameCount( 1464 rendering_stats_instrumentation_->IncrementFrameCount(
1437 1, on_main_thread); 1465 1, on_main_thread);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 renderer_->DrawFrame(&frame->render_passes, 1535 renderer_->DrawFrame(&frame->render_passes,
1508 device_scale_factor_, 1536 device_scale_factor_,
1509 DeviceViewport(), 1537 DeviceViewport(),
1510 DeviceClip(), 1538 DeviceClip(),
1511 false); 1539 false);
1512 } 1540 }
1513 // The render passes should be consumed by the renderer. 1541 // The render passes should be consumed by the renderer.
1514 DCHECK(frame->render_passes.empty()); 1542 DCHECK(frame->render_passes.empty());
1515 frame->render_passes_by_id.clear(); 1543 frame->render_passes_by_id.clear();
1516 1544
1545 draw_counter_->SaveTimeStamps(CurrentFrameTimeTicks(),
1546 uncommitted_draw_frame_ids_);
1547 uncommitted_draw_frame_ids_.clear();
1548
1517 // The next frame should start by assuming nothing has changed, and changes 1549 // The next frame should start by assuming nothing has changed, and changes
1518 // are noted as they occur. 1550 // are noted as they occur.
1519 // TODO(boliu): If we did a temporary software renderer frame, propogate the 1551 // TODO(boliu): If we did a temporary software renderer frame, propogate the
1520 // damage forward to the next frame. 1552 // damage forward to the next frame.
1521 for (size_t i = 0; i < frame->render_surface_layer_list->size(); i++) { 1553 for (size_t i = 0; i < frame->render_surface_layer_list->size(); i++) {
1522 (*frame->render_surface_layer_list)[i]->render_surface()->damage_tracker()-> 1554 (*frame->render_surface_layer_list)[i]->render_surface()->damage_tracker()->
1523 DidDrawDamagedArea(); 1555 DidDrawDamagedArea();
1524 } 1556 }
1525 active_tree_->root_layer()->ResetAllChangeTrackingForSubtree(); 1557 active_tree_->root_layer()->ResetAllChangeTrackingForSubtree();
1526 1558
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
3258 } 3290 }
3259 3291
3260 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3292 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3261 std::vector<PictureLayerImpl*>::iterator it = 3293 std::vector<PictureLayerImpl*>::iterator it =
3262 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3294 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3263 DCHECK(it != picture_layers_.end()); 3295 DCHECK(it != picture_layers_.end());
3264 picture_layers_.erase(it); 3296 picture_layers_.erase(it);
3265 } 3297 }
3266 3298
3267 } // namespace cc 3299 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698