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

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

Issue 275173002: cc: Add a checkerboard trace event instant to picture layer impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update 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 | « no previous file | 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/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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 color, 230 color,
231 width); 231 width);
232 quad_sink->Append(debug_border_quad.PassAs<DrawQuad>()); 232 quad_sink->Append(debug_border_quad.PassAs<DrawQuad>());
233 } 233 }
234 } 234 }
235 235
236 // Keep track of the tilings that were used so that tilings that are 236 // Keep track of the tilings that were used so that tilings that are
237 // unused can be considered for removal. 237 // unused can be considered for removal.
238 std::vector<PictureLayerTiling*> seen_tilings; 238 std::vector<PictureLayerTiling*> seen_tilings;
239 239
240 bool had_checkerboard_quads = false;
240 for (PictureLayerTilingSet::CoverageIterator iter( 241 for (PictureLayerTilingSet::CoverageIterator iter(
241 tilings_.get(), contents_scale_x(), rect, ideal_contents_scale_); 242 tilings_.get(), contents_scale_x(), rect, ideal_contents_scale_);
242 iter; 243 iter;
243 ++iter) { 244 ++iter) {
244 gfx::Rect geometry_rect = iter.geometry_rect(); 245 gfx::Rect geometry_rect = iter.geometry_rect();
245 gfx::Rect visible_geometry_rect = 246 gfx::Rect visible_geometry_rect =
246 quad_sink->UnoccludedContentRect(geometry_rect, draw_transform()); 247 quad_sink->UnoccludedContentRect(geometry_rect, draw_transform());
247 if (visible_geometry_rect.IsEmpty()) 248 if (visible_geometry_rect.IsEmpty())
248 continue; 249 continue;
249 250
250 append_quads_data->visible_content_area += 251 append_quads_data->visible_content_area +=
251 visible_geometry_rect.width() * visible_geometry_rect.height(); 252 visible_geometry_rect.width() * visible_geometry_rect.height();
252 253
253 if (!*iter || !iter->IsReadyToDraw()) { 254 if (!*iter || !iter->IsReadyToDraw()) {
255 had_checkerboard_quads = true;
254 if (draw_checkerboard_for_missing_tiles()) { 256 if (draw_checkerboard_for_missing_tiles()) {
255 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create(); 257 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create();
256 SkColor color = DebugColors::DefaultCheckerboardColor(); 258 SkColor color = DebugColors::DefaultCheckerboardColor();
257 quad->SetNew( 259 quad->SetNew(
258 shared_quad_state, geometry_rect, visible_geometry_rect, color); 260 shared_quad_state, geometry_rect, visible_geometry_rect, color);
259 quad_sink->Append(quad.PassAs<DrawQuad>()); 261 quad_sink->Append(quad.PassAs<DrawQuad>());
260 } else { 262 } else {
261 SkColor color = SafeOpaqueBackgroundColor(); 263 SkColor color = SafeOpaqueBackgroundColor();
262 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); 264 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
263 quad->SetNew(shared_quad_state, 265 quad->SetNew(shared_quad_state,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 341
340 if (iter->priority(ACTIVE_TREE).resolution != HIGH_RESOLUTION) { 342 if (iter->priority(ACTIVE_TREE).resolution != HIGH_RESOLUTION) {
341 append_quads_data->approximated_visible_content_area += 343 append_quads_data->approximated_visible_content_area +=
342 visible_geometry_rect.width() * visible_geometry_rect.height(); 344 visible_geometry_rect.width() * visible_geometry_rect.height();
343 } 345 }
344 346
345 if (seen_tilings.empty() || seen_tilings.back() != iter.CurrentTiling()) 347 if (seen_tilings.empty() || seen_tilings.back() != iter.CurrentTiling())
346 seen_tilings.push_back(iter.CurrentTiling()); 348 seen_tilings.push_back(iter.CurrentTiling());
347 } 349 }
348 350
351 if (had_checkerboard_quads) {
352 TRACE_EVENT_INSTANT0("cc",
353 "PictureLayerImpl::AppendQuads checkerboard",
354 TRACE_EVENT_SCOPE_THREAD);
355 }
356
349 // Aggressively remove any tilings that are not seen to save memory. Note 357 // Aggressively remove any tilings that are not seen to save memory. Note
350 // that this is at the expense of doing cause more frequent re-painting. A 358 // that this is at the expense of doing cause more frequent re-painting. A
351 // better scheme would be to maintain a tighter visible_content_rect for the 359 // better scheme would be to maintain a tighter visible_content_rect for the
352 // finer tilings. 360 // finer tilings.
353 CleanUpTilingsOnActiveLayer(seen_tilings); 361 CleanUpTilingsOnActiveLayer(seen_tilings);
354 } 362 }
355 363
356 void PictureLayerImpl::DidUnregisterLayer() { 364 void PictureLayerImpl::DidUnregisterLayer() {
357 layer_needs_to_register_itself_ = true; 365 layer_needs_to_register_itself_ = true;
358 } 366 }
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 return iterator_index_ < iterators_.size(); 1574 return iterator_index_ < iterators_.size();
1567 } 1575 }
1568 1576
1569 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( 1577 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType(
1570 PictureLayerTiling::TilingEvictionTileIterator* it) const { 1578 PictureLayerTiling::TilingEvictionTileIterator* it) const {
1571 return it->get_type() == iteration_stage_ && 1579 return it->get_type() == iteration_stage_ &&
1572 (**it)->required_for_activation() == required_for_activation_; 1580 (**it)->required_for_activation() == required_for_activation_;
1573 } 1581 }
1574 1582
1575 } // namespace cc 1583 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698