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

Side by Side Diff: cc/tiled_layer.cc

Issue 12095053: cc: Avoid expensive RenderingStats collection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 7 years, 10 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/tiled_layer.h ('k') | cc/tiled_layer_unittest.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/tiled_layer.h" 5 #include "cc/tiled_layer.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 tile->dirtyRect.Union(bound); 302 tile->dirtyRect.Union(bound);
303 } 303 }
304 } 304 }
305 305
306 // Returns true if tile is dirty and only part of it needs to be updated. 306 // Returns true if tile is dirty and only part of it needs to be updated.
307 bool TiledLayer::tileOnlyNeedsPartialUpdate(UpdatableTile* tile) 307 bool TiledLayer::tileOnlyNeedsPartialUpdate(UpdatableTile* tile)
308 { 308 {
309 return !tile->dirtyRect.Contains(m_tiler->tileRect(tile)) && tile->managedRe source()->haveBackingTexture(); 309 return !tile->dirtyRect.Contains(m_tiler->tileRect(tile)) && tile->managedRe source()->haveBackingTexture();
310 } 310 }
311 311
312 bool TiledLayer::updateTiles(int left, int top, int right, int bottom, ResourceU pdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats, boo l& didPaint) 312 bool TiledLayer::updateTiles(int left, int top, int right, int bottom, ResourceU pdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats* stats, boo l& didPaint)
313 { 313 {
314 didPaint = false; 314 didPaint = false;
315 createUpdaterIfNeeded(); 315 createUpdaterIfNeeded();
316 316
317 bool ignoreOcclusions = !occlusion; 317 bool ignoreOcclusions = !occlusion;
318 if (!haveTexturesForTiles(left, top, right, bottom, ignoreOcclusions)) { 318 if (!haveTexturesForTiles(left, top, right, bottom, ignoreOcclusions)) {
319 m_failedUpdate = true; 319 m_failedUpdate = true;
320 return false; 320 return false;
321 } 321 }
322 322
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 } 420 }
421 } 421 }
422 422
423 paintRect.Union(tile->dirtyRect); 423 paintRect.Union(tile->dirtyRect);
424 tile->markForUpdate(); 424 tile->markForUpdate();
425 } 425 }
426 } 426 }
427 return paintRect; 427 return paintRect;
428 } 428 }
429 429
430 void TiledLayer::updateTileTextures(const gfx::Rect& paintRect, int left, int to p, int right, int bottom, ResourceUpdateQueue& queue, const OcclusionTracker* oc clusion, RenderingStats& stats) 430 void TiledLayer::updateTileTextures(const gfx::Rect& paintRect, int left, int to p, int right, int bottom, ResourceUpdateQueue& queue, const OcclusionTracker* oc clusion, RenderingStats* stats)
431 { 431 {
432 // The updateRect should be in layer space. So we have to convert the paintR ect from content space to layer space. 432 // The updateRect should be in layer space. So we have to convert the paintR ect from content space to layer space.
433 float widthScale = bounds().width() / static_cast<float>(contentBounds().wid th()); 433 float widthScale = bounds().width() / static_cast<float>(contentBounds().wid th());
434 float heightScale = bounds().height() / static_cast<float>(contentBounds().h eight()); 434 float heightScale = bounds().height() / static_cast<float>(contentBounds().h eight());
435 m_updateRect = gfx::ScaleRect(paintRect, widthScale, heightScale); 435 m_updateRect = gfx::ScaleRect(paintRect, widthScale, heightScale);
436 436
437 // Calling prepareToUpdate() calls into WebKit to paint, which may have the side 437 // Calling prepareToUpdate() calls into WebKit to paint, which may have the side
438 // effect of disabling compositing, which causes our reference to the textur e updater to be deleted. 438 // effect of disabling compositing, which causes our reference to the textur e updater to be deleted.
439 // However, we can't free the memory backing the SkCanvas until the paint fi nishes, 439 // However, we can't free the memory backing the SkCanvas until the paint fi nishes,
440 // so we grab a local reference here to hold the updater alive until the pai nt completes. 440 // so we grab a local reference here to hold the updater alive until the pai nt completes.
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 gfx::Rect bound = visibleContentRect(); 633 gfx::Rect bound = visibleContentRect();
634 bound.Inset(-m_tiler->tileSize().width() * maxPredictiveTilesCount, 634 bound.Inset(-m_tiler->tileSize().width() * maxPredictiveTilesCount,
635 -m_tiler->tileSize().height() * maxPredictiveTilesCount); 635 -m_tiler->tileSize().height() * maxPredictiveTilesCount);
636 bound.Intersect(gfx::Rect(gfx::Point(), contentBounds())); 636 bound.Intersect(gfx::Rect(gfx::Point(), contentBounds()));
637 m_predictedVisibleRect.Intersect(bound); 637 m_predictedVisibleRect.Intersect(bound);
638 } 638 }
639 m_previousContentBounds = contentBounds(); 639 m_previousContentBounds = contentBounds();
640 m_previousVisibleRect = visibleContentRect(); 640 m_previousVisibleRect = visibleContentRect();
641 } 641 }
642 642
643 void TiledLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl usion, RenderingStats& stats) 643 void TiledLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl usion, RenderingStats* stats)
644 { 644 {
645 DCHECK(!m_skipsDraw && !m_failedUpdate); // Did resetUpdateState get skipped ? 645 DCHECK(!m_skipsDraw && !m_failedUpdate); // Did resetUpdateState get skipped ?
646 646
647 { 647 {
648 base::AutoReset<bool> ignoreSetNeedsCommit(&m_ignoreSetNeedsCommit, true ); 648 base::AutoReset<bool> ignoreSetNeedsCommit(&m_ignoreSetNeedsCommit, true );
649 649
650 ContentsScalingLayer::update(queue, occlusion, stats); 650 ContentsScalingLayer::update(queue, occlusion, stats);
651 updateBounds(); 651 updateBounds();
652 } 652 }
653 653
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 gfx::Rect prepaintRect = visibleContentRect(); 774 gfx::Rect prepaintRect = visibleContentRect();
775 prepaintRect.Inset(-m_tiler->tileSize().width() * prepaintColumns, 775 prepaintRect.Inset(-m_tiler->tileSize().width() * prepaintColumns,
776 -m_tiler->tileSize().height() * prepaintRows); 776 -m_tiler->tileSize().height() * prepaintRows);
777 gfx::Rect contentRect(gfx::Point(), contentBounds()); 777 gfx::Rect contentRect(gfx::Point(), contentBounds());
778 prepaintRect.Intersect(contentRect); 778 prepaintRect.Intersect(contentRect);
779 779
780 return prepaintRect; 780 return prepaintRect;
781 } 781 }
782 782
783 } // namespace cc 783 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiled_layer.h ('k') | cc/tiled_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698