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

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

Issue 258093005: cc: Record statistics about approximated content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix resolution condition. Created 6 years, 7 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/append_quads_data.h ('k') | cc/trees/layer_tree_host_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_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 for (PictureLayerTilingSet::CoverageIterator iter( 231 for (PictureLayerTilingSet::CoverageIterator iter(
232 tilings_.get(), contents_scale_x(), rect, ideal_contents_scale_); 232 tilings_.get(), contents_scale_x(), rect, ideal_contents_scale_);
233 iter; 233 iter;
234 ++iter) { 234 ++iter) {
235 gfx::Rect geometry_rect = iter.geometry_rect(); 235 gfx::Rect geometry_rect = iter.geometry_rect();
236 gfx::Rect visible_geometry_rect = 236 gfx::Rect visible_geometry_rect =
237 quad_sink->UnoccludedContentRect(geometry_rect, draw_transform()); 237 quad_sink->UnoccludedContentRect(geometry_rect, draw_transform());
238 if (visible_geometry_rect.IsEmpty()) 238 if (visible_geometry_rect.IsEmpty())
239 continue; 239 continue;
240 240
241 append_quads_data->visible_content_area +=
242 visible_geometry_rect.width() * visible_geometry_rect.height();
243
241 if (!*iter || !iter->IsReadyToDraw()) { 244 if (!*iter || !iter->IsReadyToDraw()) {
242 if (draw_checkerboard_for_missing_tiles()) { 245 if (draw_checkerboard_for_missing_tiles()) {
243 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create(); 246 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create();
244 SkColor color = DebugColors::DefaultCheckerboardColor(); 247 SkColor color = DebugColors::DefaultCheckerboardColor();
245 quad->SetNew( 248 quad->SetNew(
246 shared_quad_state, geometry_rect, visible_geometry_rect, color); 249 shared_quad_state, geometry_rect, visible_geometry_rect, color);
247 quad_sink->Append(quad.PassAs<DrawQuad>()); 250 quad_sink->Append(quad.PassAs<DrawQuad>());
248 } else { 251 } else {
249 SkColor color = SafeOpaqueBackgroundColor(); 252 SkColor color = SafeOpaqueBackgroundColor();
250 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); 253 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
251 quad->SetNew(shared_quad_state, 254 quad->SetNew(shared_quad_state,
252 geometry_rect, 255 geometry_rect,
253 visible_geometry_rect, 256 visible_geometry_rect,
254 color, 257 color,
255 false); 258 false);
256 quad_sink->Append(quad.PassAs<DrawQuad>()); 259 quad_sink->Append(quad.PassAs<DrawQuad>());
257 } 260 }
258 261
259 append_quads_data->num_missing_tiles++; 262 append_quads_data->num_missing_tiles++;
260 append_quads_data->had_incomplete_tile = true; 263 append_quads_data->had_incomplete_tile = true;
264 append_quads_data->approximated_visible_content_area +=
265 visible_geometry_rect.width() * visible_geometry_rect.height();
261 continue; 266 continue;
262 } 267 }
263 268
264 const ManagedTileState::TileVersion& tile_version = 269 const ManagedTileState::TileVersion& tile_version =
265 iter->GetTileVersionForDrawing(); 270 iter->GetTileVersionForDrawing();
266 scoped_ptr<DrawQuad> draw_quad; 271 scoped_ptr<DrawQuad> draw_quad;
267 switch (tile_version.mode()) { 272 switch (tile_version.mode()) {
268 case ManagedTileState::TileVersion::RESOURCE_MODE: { 273 case ManagedTileState::TileVersion::RESOURCE_MODE: {
269 gfx::RectF texture_rect = iter.texture_rect(); 274 gfx::RectF texture_rect = iter.texture_rect();
270 gfx::Rect opaque_rect = iter->opaque_rect(); 275 gfx::Rect opaque_rect = iter->opaque_rect();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 tile_version.get_solid_color(), 321 tile_version.get_solid_color(),
317 false); 322 false);
318 draw_quad = quad.PassAs<DrawQuad>(); 323 draw_quad = quad.PassAs<DrawQuad>();
319 break; 324 break;
320 } 325 }
321 } 326 }
322 327
323 DCHECK(draw_quad); 328 DCHECK(draw_quad);
324 quad_sink->Append(draw_quad.Pass()); 329 quad_sink->Append(draw_quad.Pass());
325 330
331 if (iter->priority(ACTIVE_TREE).resolution != HIGH_RESOLUTION) {
332 append_quads_data->approximated_visible_content_area +=
333 visible_geometry_rect.width() * visible_geometry_rect.height();
334 }
335
326 if (seen_tilings.empty() || seen_tilings.back() != iter.CurrentTiling()) 336 if (seen_tilings.empty() || seen_tilings.back() != iter.CurrentTiling())
327 seen_tilings.push_back(iter.CurrentTiling()); 337 seen_tilings.push_back(iter.CurrentTiling());
328 } 338 }
329 339
330 // Aggressively remove any tilings that are not seen to save memory. Note 340 // Aggressively remove any tilings that are not seen to save memory. Note
331 // that this is at the expense of doing cause more frequent re-painting. A 341 // that this is at the expense of doing cause more frequent re-painting. A
332 // better scheme would be to maintain a tighter visible_content_rect for the 342 // better scheme would be to maintain a tighter visible_content_rect for the
333 // finer tilings. 343 // finer tilings.
334 CleanUpTilingsOnActiveLayer(seen_tilings); 344 CleanUpTilingsOnActiveLayer(seen_tilings);
335 } 345 }
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 return iterator_index_ < iterators_.size(); 1527 return iterator_index_ < iterators_.size();
1518 } 1528 }
1519 1529
1520 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( 1530 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType(
1521 PictureLayerTiling::TilingEvictionTileIterator* it) const { 1531 PictureLayerTiling::TilingEvictionTileIterator* it) const {
1522 return it->get_type() == iteration_stage_ && 1532 return it->get_type() == iteration_stage_ &&
1523 (**it)->required_for_activation() == required_for_activation_; 1533 (**it)->required_for_activation() == required_for_activation_;
1524 } 1534 }
1525 1535
1526 } // namespace cc 1536 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/append_quads_data.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698