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

Side by Side Diff: cc/layers/picture_layer.cc

Issue 474783002: HUD: Show first paint invalidation in red (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compilefix Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/picture_layer.h ('k') | cc/layers/picture_layer_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layers/picture_layer.h" 5 #include "cc/layers/picture_layer.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "cc/debug/debug_rect_history.h"
8 #include "cc/layers/content_layer_client.h" 9 #include "cc/layers/content_layer_client.h"
9 #include "cc/layers/picture_layer_impl.h" 10 #include "cc/layers/picture_layer_impl.h"
10 #include "cc/trees/layer_tree_impl.h" 11 #include "cc/trees/layer_tree_impl.h"
11 #include "third_party/skia/include/core/SkPictureRecorder.h" 12 #include "third_party/skia/include/core/SkPictureRecorder.h"
12 #include "ui/gfx/rect_conversions.h" 13 #include "ui/gfx/rect_conversions.h"
13 14
14 namespace cc { 15 namespace cc {
15 16
16 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { 17 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) {
17 return make_scoped_refptr(new PictureLayer(client)); 18 return make_scoped_refptr(new PictureLayer(client));
18 } 19 }
19 20
20 PictureLayer::PictureLayer(ContentLayerClient* client) 21 PictureLayer::PictureLayer(ContentLayerClient* client)
21 : client_(client), 22 : client_(client),
22 pile_(make_scoped_refptr(new PicturePile())), 23 pile_(make_scoped_refptr(new PicturePile())),
23 instrumentation_object_tracker_(id()), 24 instrumentation_object_tracker_(id()),
25 includes_first_paint_invalidation_(false),
26 is_mask_(false),
24 update_source_frame_number_(-1), 27 update_source_frame_number_(-1),
25 can_use_lcd_text_last_frame_(can_use_lcd_text()) { 28 can_use_lcd_text_last_frame_(can_use_lcd_text()) {
26 } 29 }
27 30
28 PictureLayer::~PictureLayer() { 31 PictureLayer::~PictureLayer() {
29 } 32 }
30 33
31 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { 34 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
32 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); 35 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>();
33 } 36 }
(...skipping 12 matching lines...) Expand all
46 // TODO(ernstm): This DCHECK is only valid as long as the pile's tiling_rect 49 // TODO(ernstm): This DCHECK is only valid as long as the pile's tiling_rect
47 // is identical to the layer_rect. 50 // is identical to the layer_rect.
48 // If update called, then pile size must match bounds pushed to impl layer. 51 // If update called, then pile size must match bounds pushed to impl layer.
49 DCHECK_EQ(layer_impl->bounds().ToString(), pile_->tiling_size().ToString()); 52 DCHECK_EQ(layer_impl->bounds().ToString(), pile_->tiling_size().ToString());
50 } 53 }
51 54
52 // Unlike other properties, invalidation must always be set on layer_impl. 55 // Unlike other properties, invalidation must always be set on layer_impl.
53 // See PictureLayerImpl::PushPropertiesTo for more details. 56 // See PictureLayerImpl::PushPropertiesTo for more details.
54 layer_impl->invalidation_.Clear(); 57 layer_impl->invalidation_.Clear();
55 layer_impl->invalidation_.Swap(&pile_invalidation_); 58 layer_impl->invalidation_.Swap(&pile_invalidation_);
59 layer_impl->debug_invalidation_.clear();
60 layer_impl->debug_invalidation_.swap(debug_invalidation_);
56 layer_impl->pile_ = PicturePileImpl::CreateFromOther(pile_.get()); 61 layer_impl->pile_ = PicturePileImpl::CreateFromOther(pile_.get());
57 } 62 }
58 63
59 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { 64 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) {
60 Layer::SetLayerTreeHost(host); 65 Layer::SetLayerTreeHost(host);
61 if (host) { 66 if (host) {
62 pile_->SetMinContentsScale(host->settings().minimum_contents_scale); 67 pile_->SetMinContentsScale(host->settings().minimum_contents_scale);
63 pile_->SetTileGridSize(host->settings().default_tile_size); 68 pile_->SetTileGridSize(host->settings().default_tile_size);
64 pile_->set_slow_down_raster_scale_factor( 69 pile_->set_slow_down_raster_scale_factor(
65 host->debug_state().slow_down_raster_scale_factor); 70 host->debug_state().slow_down_raster_scale_factor);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 "source_frame_number", 108 "source_frame_number",
104 layer_tree_host()->source_frame_number()); 109 layer_tree_host()->source_frame_number());
105 devtools_instrumentation::ScopedLayerTreeTask update_layer( 110 devtools_instrumentation::ScopedLayerTreeTask update_layer(
106 devtools_instrumentation::kUpdateLayer, id(), layer_tree_host()->id()); 111 devtools_instrumentation::kUpdateLayer, id(), layer_tree_host()->id());
107 112
108 // Calling paint in WebKit can sometimes cause invalidations, so save 113 // Calling paint in WebKit can sometimes cause invalidations, so save
109 // off the invalidation prior to calling update. 114 // off the invalidation prior to calling update.
110 pending_invalidation_.Swap(&pile_invalidation_); 115 pending_invalidation_.Swap(&pile_invalidation_);
111 pending_invalidation_.Clear(); 116 pending_invalidation_.Clear();
112 117
118 bool is_tracing;
119 TRACE_EVENT_CATEGORY_GROUP_ENABLED(
120 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT(
121 "devtools.timeline.layers"),
122 &is_tracing);
123 if (is_tracing || layer_tree_host()->debug_state().ShowHudInfo()) {
124 scoped_refptr<LayerDebugInfo> debug_info = TakeDebugInfo();
125 if (debug_info.get()) {
126 debug_invalidation_ = debug_info->GetInvalidationRects(this);
127 }
128 }
129
113 if (layer_tree_host()->settings().record_full_layer) { 130 if (layer_tree_host()->settings().record_full_layer) {
114 // Workaround for http://crbug.com/235910 - to retain backwards compat 131 // Workaround for http://crbug.com/235910 - to retain backwards compat
115 // the full page content must always be provided in the picture layer. 132 // the full page content must always be provided in the picture layer.
116 visible_layer_rect = gfx::Rect(layer_size); 133 visible_layer_rect = gfx::Rect(layer_size);
117 } 134 }
118 135
119 // UpdateAndExpandInvalidation will give us an invalidation that covers 136 // UpdateAndExpandInvalidation will give us an invalidation that covers
120 // anything not explicitly recorded in this frame. We give this region 137 // anything not explicitly recorded in this frame. We give this region
121 // to the impl side so that it drops tiles that may not have a recording 138 // to the impl side so that it drops tiles that may not have a recording
122 // for them. 139 // for them.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 220
204 bool PictureLayer::HasDrawableContent() const { 221 bool PictureLayer::HasDrawableContent() const {
205 return client_ && Layer::HasDrawableContent(); 222 return client_ && Layer::HasDrawableContent();
206 } 223 }
207 224
208 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { 225 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) {
209 benchmark->RunOnLayer(this); 226 benchmark->RunOnLayer(this);
210 } 227 }
211 228
212 } // namespace cc 229 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer.h ('k') | cc/layers/picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698