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

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

Issue 375923005: cc: Explicitly invalidate all dropped recordings on the main thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: invalid-resize: resizedeletestiles 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl.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 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 "cc/layers/content_layer_client.h" 7 #include "cc/layers/content_layer_client.h"
8 #include "cc/layers/picture_layer_impl.h" 8 #include "cc/layers/picture_layer_impl.h"
9 #include "cc/trees/layer_tree_impl.h" 9 #include "cc/trees/layer_tree_impl.h"
10 #include "third_party/skia/include/core/SkPictureRecorder.h" 10 #include "third_party/skia/include/core/SkPictureRecorder.h"
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 38
39 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { 39 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) {
40 Layer::PushPropertiesTo(base_layer); 40 Layer::PushPropertiesTo(base_layer);
41 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); 41 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer);
42 42
43 if (layer_impl->bounds().IsEmpty()) { 43 if (layer_impl->bounds().IsEmpty()) {
44 // Update may not get called for an empty layer, so resize here instead. 44 // Update may not get called for an empty layer, so resize here instead.
45 // Using layer_impl because either bounds() or paint_properties().bounds 45 // Using layer_impl because either bounds() or paint_properties().bounds
46 // may disagree and either one could have been pushed to layer_impl. 46 // may disagree and either one could have been pushed to layer_impl.
47 pile_->SetTilingRect(gfx::Rect()); 47 pile_->SetEmptyBounds();
48 } else if (update_source_frame_number_ == 48 } else if (update_source_frame_number_ ==
49 layer_tree_host()->source_frame_number()) { 49 layer_tree_host()->source_frame_number()) {
50 // TODO(ernstm): This DCHECK is only valid as long as the pile's tiling_rect 50 // TODO(ernstm): This DCHECK is only valid as long as the pile's tiling_rect
51 // is identical to the layer_rect. 51 // is identical to the layer_rect.
52 // If update called, then pile size must match bounds pushed to impl layer. 52 // If update called, then pile size must match bounds pushed to impl layer.
53 DCHECK_EQ(layer_impl->bounds().ToString(), 53 DCHECK_EQ(layer_impl->bounds().ToString(),
54 pile_->tiling_rect().size().ToString()); 54 pile_->tiling_rect().size().ToString());
55 } 55 }
56 56
57 layer_impl->SetIsMask(is_mask_); 57 layer_impl->SetIsMask(is_mask_);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Only early out if the visible content rect of this layer hasn't changed. 102 // Only early out if the visible content rect of this layer hasn't changed.
103 return updated; 103 return updated;
104 } 104 }
105 105
106 TRACE_EVENT1("cc", "PictureLayer::Update", 106 TRACE_EVENT1("cc", "PictureLayer::Update",
107 "source_frame_number", 107 "source_frame_number",
108 layer_tree_host()->source_frame_number()); 108 layer_tree_host()->source_frame_number());
109 devtools_instrumentation::ScopedLayerTreeTask update_layer( 109 devtools_instrumentation::ScopedLayerTreeTask update_layer(
110 devtools_instrumentation::kUpdateLayer, id(), layer_tree_host()->id()); 110 devtools_instrumentation::kUpdateLayer, id(), layer_tree_host()->id());
111 111
112 pile_->SetTilingRect(layer_rect);
113
114 // Calling paint in WebKit can sometimes cause invalidations, so save 112 // Calling paint in WebKit can sometimes cause invalidations, so save
115 // off the invalidation prior to calling update. 113 // off the invalidation prior to calling update.
116 pending_invalidation_.Swap(&pile_invalidation_); 114 pending_invalidation_.Swap(&pile_invalidation_);
117 pending_invalidation_.Clear(); 115 pending_invalidation_.Clear();
118 116
119 if (layer_tree_host()->settings().record_full_layer) { 117 if (layer_tree_host()->settings().record_full_layer) {
120 // Workaround for http://crbug.com/235910 - to retain backwards compat 118 // Workaround for http://crbug.com/235910 - to retain backwards compat
121 // the full page content must always be provided in the picture layer. 119 // the full page content must always be provided in the picture layer.
122 visible_layer_rect = gfx::Rect(bounds()); 120 visible_layer_rect = gfx::Rect(bounds());
123 } 121 }
124 122
125 // UpdateAndExpandInvalidation will give us an invalidation that covers 123 // UpdateAndExpandInvalidation will give us an invalidation that covers
126 // anything not explicitly recorded in this frame. We give this region 124 // anything not explicitly recorded in this frame. We give this region
127 // to the impl side so that it drops tiles that may not have a recording 125 // to the impl side so that it drops tiles that may not have a recording
128 // for them. 126 // for them.
129 DCHECK(client_); 127 DCHECK(client_);
130 updated |= 128 updated |=
131 pile_->UpdateAndExpandInvalidation(client_, 129 pile_->UpdateAndExpandInvalidation(client_,
132 &pile_invalidation_, 130 &pile_invalidation_,
133 SafeOpaqueBackgroundColor(), 131 SafeOpaqueBackgroundColor(),
134 contents_opaque(), 132 contents_opaque(),
135 client_->FillsBoundsCompletely(), 133 client_->FillsBoundsCompletely(),
134 layer_rect,
136 visible_layer_rect, 135 visible_layer_rect,
137 update_source_frame_number_, 136 update_source_frame_number_,
138 RecordingMode(), 137 RecordingMode(),
139 rendering_stats_instrumentation()); 138 rendering_stats_instrumentation());
140 last_updated_visible_content_rect_ = visible_content_rect(); 139 last_updated_visible_content_rect_ = visible_content_rect();
141 140
142 if (updated) { 141 if (updated) {
143 SetNeedsPushProperties(); 142 SetNeedsPushProperties();
144 } else { 143 } else {
145 // If this invalidation did not affect the pile, then it can be cleared as 144 // If this invalidation did not affect the pile, then it can be cleared as
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 200
202 bool PictureLayer::IsSuitableForGpuRasterization() const { 201 bool PictureLayer::IsSuitableForGpuRasterization() const {
203 return pile_->is_suitable_for_gpu_rasterization(); 202 return pile_->is_suitable_for_gpu_rasterization();
204 } 203 }
205 204
206 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { 205 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) {
207 benchmark->RunOnLayer(this); 206 benchmark->RunOnLayer(this);
208 } 207 }
209 208
210 } // namespace cc 209 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698