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

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

Issue 2876033005: Track slow paths in DisplayItemList (Closed)
Patch Set: danakj review Created 3 years, 6 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/blink/web_display_item_list_impl.cc ('k') | cc/paint/display_item_list.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 "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "cc/layers/content_layer_client.h" 9 #include "cc/layers/content_layer_client.h"
10 #include "cc/layers/picture_layer_impl.h" 10 #include "cc/layers/picture_layer_impl.h"
11 #include "cc/layers/recording_source.h" 11 #include "cc/layers/recording_source.h"
12 #include "cc/paint/paint_record.h" 12 #include "cc/paint/paint_record.h"
13 #include "cc/trees/layer_tree_host.h" 13 #include "cc/trees/layer_tree_host.h"
14 #include "cc/trees/layer_tree_impl.h" 14 #include "cc/trees/layer_tree_impl.h"
15 #include "cc/trees/transform_node.h" 15 #include "cc/trees/transform_node.h"
16 #include "ui/gfx/geometry/rect_conversions.h" 16 #include "ui/gfx/geometry/rect_conversions.h"
17 17
18 static constexpr int kMaxNumberOfSlowPathsBeforeVeto = 5;
19
18 namespace cc { 20 namespace cc {
19 21
20 PictureLayer::PictureLayerInputs::PictureLayerInputs() = default; 22 PictureLayer::PictureLayerInputs::PictureLayerInputs() = default;
21 23
22 PictureLayer::PictureLayerInputs::~PictureLayerInputs() = default; 24 PictureLayer::PictureLayerInputs::~PictureLayerInputs() = default;
23 25
24 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { 26 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) {
25 return make_scoped_refptr(new PictureLayer(client)); 27 return make_scoped_refptr(new PictureLayer(client));
26 } 28 }
27 29
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 183
182 return raster_source->GetFlattenedPicture(); 184 return raster_source->GetFlattenedPicture();
183 } 185 }
184 186
185 bool PictureLayer::IsSuitableForGpuRasterization() const { 187 bool PictureLayer::IsSuitableForGpuRasterization() const {
186 // The display list needs to be created (see: UpdateAndExpandInvalidation) 188 // The display list needs to be created (see: UpdateAndExpandInvalidation)
187 // before checking for suitability. There are cases where an update will not 189 // before checking for suitability. There are cases where an update will not
188 // create a display list (e.g., if the size is empty). We return true in these 190 // create a display list (e.g., if the size is empty). We return true in these
189 // cases because the gpu suitability bit sticks false. 191 // cases because the gpu suitability bit sticks false.
190 return !picture_layer_inputs_.display_list || 192 return !picture_layer_inputs_.display_list ||
191 picture_layer_inputs_.display_list->IsSuitableForGpuRasterization(); 193 picture_layer_inputs_.display_list->NumSlowPaths() <=
194 kMaxNumberOfSlowPathsBeforeVeto;
192 } 195 }
193 196
194 void PictureLayer::ClearClient() { 197 void PictureLayer::ClearClient() {
195 picture_layer_inputs_.client = nullptr; 198 picture_layer_inputs_.client = nullptr;
196 UpdateDrawsContent(HasDrawableContent()); 199 UpdateDrawsContent(HasDrawableContent());
197 } 200 }
198 201
199 void PictureLayer::SetNearestNeighbor(bool nearest_neighbor) { 202 void PictureLayer::SetNearestNeighbor(bool nearest_neighbor) {
200 if (picture_layer_inputs_.nearest_neighbor == nearest_neighbor) 203 if (picture_layer_inputs_.nearest_neighbor == nearest_neighbor)
201 return; 204 return;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 return false; 286 return false;
284 287
285 return true; 288 return true;
286 } 289 }
287 290
288 const DisplayItemList* PictureLayer::GetDisplayItemList() { 291 const DisplayItemList* PictureLayer::GetDisplayItemList() {
289 return picture_layer_inputs_.display_list.get(); 292 return picture_layer_inputs_.display_list.get();
290 } 293 }
291 294
292 } // namespace cc 295 } // namespace cc
OLDNEW
« no previous file with comments | « cc/blink/web_display_item_list_impl.cc ('k') | cc/paint/display_item_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698