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

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

Issue 60353002: cc: add DevTools instrumentation for impl-side frames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Insturment tree activation instead of commit for linking main thread frames to imple-side ones Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('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.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <stack> 8 #include <stack>
9 #include <string> 9 #include <string>
10 10
11 #include "base/atomic_sequence_num.h"
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/command_line.h" 13 #include "base/command_line.h"
13 #include "base/debug/trace_event.h" 14 #include "base/debug/trace_event.h"
14 #include "base/lazy_instance.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/stl_util.h" 17 #include "base/stl_util.h"
18 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
19 #include "base/synchronization/lock.h"
20 #include "cc/animation/animation_registrar.h" 19 #include "cc/animation/animation_registrar.h"
21 #include "cc/animation/layer_animation_controller.h" 20 #include "cc/animation/layer_animation_controller.h"
22 #include "cc/base/math_util.h" 21 #include "cc/base/math_util.h"
23 #include "cc/debug/devtools_instrumentation.h" 22 #include "cc/debug/devtools_instrumentation.h"
24 #include "cc/debug/overdraw_metrics.h" 23 #include "cc/debug/overdraw_metrics.h"
25 #include "cc/debug/rendering_stats_instrumentation.h" 24 #include "cc/debug/rendering_stats_instrumentation.h"
26 #include "cc/input/top_controls_manager.h" 25 #include "cc/input/top_controls_manager.h"
27 #include "cc/layers/heads_up_display_layer.h" 26 #include "cc/layers/heads_up_display_layer.h"
28 #include "cc/layers/heads_up_display_layer_impl.h" 27 #include "cc/layers/heads_up_display_layer_impl.h"
29 #include "cc/layers/layer.h" 28 #include "cc/layers/layer.h"
30 #include "cc/layers/layer_iterator.h" 29 #include "cc/layers/layer_iterator.h"
31 #include "cc/layers/painted_scrollbar_layer.h" 30 #include "cc/layers/painted_scrollbar_layer.h"
32 #include "cc/layers/render_surface.h" 31 #include "cc/layers/render_surface.h"
33 #include "cc/resources/prioritized_resource_manager.h" 32 #include "cc/resources/prioritized_resource_manager.h"
34 #include "cc/resources/ui_resource_request.h" 33 #include "cc/resources/ui_resource_request.h"
35 #include "cc/trees/layer_tree_host_client.h" 34 #include "cc/trees/layer_tree_host_client.h"
36 #include "cc/trees/layer_tree_host_common.h" 35 #include "cc/trees/layer_tree_host_common.h"
37 #include "cc/trees/layer_tree_host_impl.h" 36 #include "cc/trees/layer_tree_host_impl.h"
38 #include "cc/trees/layer_tree_impl.h" 37 #include "cc/trees/layer_tree_impl.h"
39 #include "cc/trees/occlusion_tracker.h" 38 #include "cc/trees/occlusion_tracker.h"
40 #include "cc/trees/single_thread_proxy.h" 39 #include "cc/trees/single_thread_proxy.h"
41 #include "cc/trees/thread_proxy.h" 40 #include "cc/trees/thread_proxy.h"
42 #include "cc/trees/tree_synchronizer.h" 41 #include "cc/trees/tree_synchronizer.h"
43 #include "ui/gfx/size_conversions.h" 42 #include "ui/gfx/size_conversions.h"
44 43
45 namespace { 44 namespace {
46 static base::LazyInstance<base::Lock>::Leaky 45 static base::StaticAtomicSequenceNumber s_layer_tree_host_sequence_number;
47 s_next_tree_id_lock = LAZY_INSTANCE_INITIALIZER;
48
49 inline int GetNextTreeId() {
50 static int s_next_tree_id = 1;
51 base::AutoLock lock(s_next_tree_id_lock.Get());
52 return s_next_tree_id++;
53 }
54 } 46 }
55 47
56 namespace cc { 48 namespace cc {
57 49
58 RendererCapabilities::RendererCapabilities() 50 RendererCapabilities::RendererCapabilities()
59 : best_texture_format(RGBA_8888), 51 : best_texture_format(RGBA_8888),
60 using_partial_swap(false), 52 using_partial_swap(false),
61 using_set_visibility(false), 53 using_set_visibility(false),
62 using_egl_image(false), 54 using_egl_image(false),
63 allow_partial_texture_updates(false), 55 allow_partial_texture_updates(false),
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 visible_(true), 110 visible_(true),
119 page_scale_factor_(1.f), 111 page_scale_factor_(1.f),
120 min_page_scale_factor_(1.f), 112 min_page_scale_factor_(1.f),
121 max_page_scale_factor_(1.f), 113 max_page_scale_factor_(1.f),
122 trigger_idle_updates_(true), 114 trigger_idle_updates_(true),
123 background_color_(SK_ColorWHITE), 115 background_color_(SK_ColorWHITE),
124 has_transparent_background_(false), 116 has_transparent_background_(false),
125 partial_texture_update_requests_(0), 117 partial_texture_update_requests_(0),
126 in_paint_layer_contents_(false), 118 in_paint_layer_contents_(false),
127 total_frames_used_for_lcd_text_metrics_(0), 119 total_frames_used_for_lcd_text_metrics_(0),
128 tree_id_(GetNextTreeId()), 120 id_(s_layer_tree_host_sequence_number.GetNext() + 1),
alph 2013/11/15 23:46:15 nit: why not keep inline GetNextTreeId hiding +1 l
129 next_commit_forces_redraw_(false), 121 next_commit_forces_redraw_(false),
130 shared_bitmap_manager_(manager) { 122 shared_bitmap_manager_(manager) {
131 if (settings_.accelerated_animation_enabled) 123 if (settings_.accelerated_animation_enabled)
132 animation_registrar_ = AnimationRegistrar::Create(); 124 animation_registrar_ = AnimationRegistrar::Create();
133 rendering_stats_instrumentation_->set_record_rendering_stats( 125 rendering_stats_instrumentation_->set_record_rendering_stats(
134 debug_state_.RecordRenderingStats()); 126 debug_state_.RecordRenderingStats());
135 } 127 }
136 128
137 bool LayerTreeHost::InitializeThreaded( 129 bool LayerTreeHost::InitializeThreaded(
138 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 130 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 408
417 if (new_impl_tree_has_no_evicted_resources) { 409 if (new_impl_tree_has_no_evicted_resources) {
418 if (sync_tree->ContentsTexturesPurged()) 410 if (sync_tree->ContentsTexturesPurged())
419 sync_tree->ResetContentsTexturesPurged(); 411 sync_tree->ResetContentsTexturesPurged();
420 } 412 }
421 413
422 if (!settings_.impl_side_painting) { 414 if (!settings_.impl_side_painting) {
423 // If we're not in impl-side painting, the tree is immediately 415 // If we're not in impl-side painting, the tree is immediately
424 // considered active. 416 // considered active.
425 sync_tree->DidBecomeActive(); 417 sync_tree->DidBecomeActive();
418 devtools_instrumentation::didActivateLayerTree(id_, source_frame_number_);
426 } 419 }
427 420
428 source_frame_number_++; 421 source_frame_number_++;
429 } 422 }
430 423
431 void LayerTreeHost::WillCommit() { 424 void LayerTreeHost::WillCommit() {
432 client_->WillCommit(); 425 client_->WillCommit();
433 } 426 }
434 427
435 void LayerTreeHost::UpdateHudLayer() { 428 void LayerTreeHost::UpdateHudLayer() {
(...skipping 18 matching lines...) Expand all
454 } 447 }
455 448
456 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( 449 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl(
457 LayerTreeHostImplClient* client) { 450 LayerTreeHostImplClient* client) {
458 DCHECK(proxy_->IsImplThread()); 451 DCHECK(proxy_->IsImplThread());
459 scoped_ptr<LayerTreeHostImpl> host_impl = 452 scoped_ptr<LayerTreeHostImpl> host_impl =
460 LayerTreeHostImpl::Create(settings_, 453 LayerTreeHostImpl::Create(settings_,
461 client, 454 client,
462 proxy_.get(), 455 proxy_.get(),
463 rendering_stats_instrumentation_.get(), 456 rendering_stats_instrumentation_.get(),
464 shared_bitmap_manager_); 457 shared_bitmap_manager_,
458 id_);
465 shared_bitmap_manager_ = NULL; 459 shared_bitmap_manager_ = NULL;
466 if (settings_.calculate_top_controls_position && 460 if (settings_.calculate_top_controls_position &&
467 host_impl->top_controls_manager()) { 461 host_impl->top_controls_manager()) {
468 top_controls_manager_weak_ptr_ = 462 top_controls_manager_weak_ptr_ =
469 host_impl->top_controls_manager()->AsWeakPtr(); 463 host_impl->top_controls_manager()->AsWeakPtr();
470 } 464 }
471 input_handler_weak_ptr_ = host_impl->AsWeakPtr(); 465 input_handler_weak_ptr_ = host_impl->AsWeakPtr();
472 return host_impl.Pass(); 466 return host_impl.Pass();
473 } 467 }
474 468
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 1252
1259 bool LayerTreeHost::ScheduleMicroBenchmark( 1253 bool LayerTreeHost::ScheduleMicroBenchmark(
1260 const std::string& benchmark_name, 1254 const std::string& benchmark_name,
1261 scoped_ptr<base::Value> value, 1255 scoped_ptr<base::Value> value,
1262 const MicroBenchmark::DoneCallback& callback) { 1256 const MicroBenchmark::DoneCallback& callback) {
1263 return micro_benchmark_controller_.ScheduleRun( 1257 return micro_benchmark_controller_.ScheduleRun(
1264 benchmark_name, value.Pass(), callback); 1258 benchmark_name, value.Pass(), callback);
1265 } 1259 }
1266 1260
1267 } // namespace cc 1261 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698