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

Side by Side Diff: cc/resources/picture_pile.cc

Issue 222903005: cc: Let skia veto gpu rasterization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 8 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/resources/picture_pile.h ('k') | no next file » | 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/resources/picture_pile.h" 5 #include "cc/resources/picture_pile.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 135
136 *record_rects = vertical_clustering; 136 *record_rects = vertical_clustering;
137 return vertical_density; 137 return vertical_density;
138 } 138 }
139 139
140 } // namespace 140 } // namespace
141 141
142 namespace cc { 142 namespace cc {
143 143
144 PicturePile::PicturePile() { 144 PicturePile::PicturePile() : is_suitable_for_gpu_rasterization_(true) {}
145 }
146 145
147 PicturePile::~PicturePile() { 146 PicturePile::~PicturePile() {
148 } 147 }
149 148
150 bool PicturePile::Update(ContentLayerClient* painter, 149 bool PicturePile::Update(ContentLayerClient* painter,
151 SkColor background_color, 150 SkColor background_color,
152 bool contents_opaque, 151 bool contents_opaque,
153 bool contents_fill_bounds_completely, 152 bool contents_fill_bounds_completely,
154 const Region& invalidation, 153 const Region& invalidation,
155 const gfx::Rect& visible_layer_rect, 154 const gfx::Rect& visible_layer_rect,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 { 237 {
239 base::TimeDelta best_duration = base::TimeDelta::Max(); 238 base::TimeDelta best_duration = base::TimeDelta::Max();
240 for (int i = 0; i < repeat_count; i++) { 239 for (int i = 0; i < repeat_count; i++) {
241 base::TimeTicks start_time = stats_instrumentation->StartRecording(); 240 base::TimeTicks start_time = stats_instrumentation->StartRecording();
242 picture = Picture::Create(record_rect, 241 picture = Picture::Create(record_rect,
243 painter, 242 painter,
244 tile_grid_info_, 243 tile_grid_info_,
245 gather_pixel_refs, 244 gather_pixel_refs,
246 num_raster_threads, 245 num_raster_threads,
247 Picture::RECORD_NORMALLY); 246 Picture::RECORD_NORMALLY);
247 // Note the '&&' with previous is-suitable state.
248 // This means that once a picture-pile becomes unsuitable for gpu
249 // rasterization due to some content, it will continue to be unsuitable
250 // even if that content is replaced by gpu-friendly content.
251 // This is an optimization to avoid iterating though all pictures in
252 // the pile after each invalidation.
253 is_suitable_for_gpu_rasterization_ &=
alokp 2014/04/09 18:28:27 enne@: I need to move this flag to the impl thread
enne (OOO) 2014/04/09 18:32:53 PicturePileImpls are never updated, only overwritt
254 picture->IsSuitableForGpuRasterization();
248 base::TimeDelta duration = 255 base::TimeDelta duration =
249 stats_instrumentation->EndRecording(start_time); 256 stats_instrumentation->EndRecording(start_time);
250 best_duration = std::min(duration, best_duration); 257 best_duration = std::min(duration, best_duration);
251 } 258 }
252 int recorded_pixel_count = 259 int recorded_pixel_count =
253 picture->LayerRect().width() * picture->LayerRect().height(); 260 picture->LayerRect().width() * picture->LayerRect().height();
254 stats_instrumentation->AddRecord(best_duration, recorded_pixel_count); 261 stats_instrumentation->AddRecord(best_duration, recorded_pixel_count);
255 } 262 }
256 263
257 bool found_tile_for_recorded_picture = false; 264 bool found_tile_for_recorded_picture = false;
(...skipping 11 matching lines...) Expand all
269 } 276 }
270 DCHECK(found_tile_for_recorded_picture); 277 DCHECK(found_tile_for_recorded_picture);
271 } 278 }
272 279
273 has_any_recordings_ = true; 280 has_any_recordings_ = true;
274 DCHECK(CanRasterSlowTileCheck(recorded_viewport_)); 281 DCHECK(CanRasterSlowTileCheck(recorded_viewport_));
275 return true; 282 return true;
276 } 283 }
277 284
278 } // namespace cc 285 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_pile.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698