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

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

Issue 294163009: cc: Expand invalidation to full tile when recording is missing for the tile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | cc/resources/picture_pile_base.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_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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 int round_up_to = avoid_pow2 ? 56 : 64; 646 int round_up_to = avoid_pow2 ? 56 : 64;
647 width = RoundUp(width, round_up_to); 647 width = RoundUp(width, round_up_to);
648 height = RoundUp(height, round_up_to); 648 height = RoundUp(height, round_up_to);
649 return gfx::Size(width, height); 649 return gfx::Size(width, height);
650 } 650 }
651 651
652 return default_tile_size; 652 return default_tile_size;
653 } 653 }
654 654
655 void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) { 655 void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
656 TRACE_EVENT0("cc", "SyncFromActiveLayer");
656 DCHECK(!other->needs_post_commit_initialization_); 657 DCHECK(!other->needs_post_commit_initialization_);
657 DCHECK(other->tilings_); 658 DCHECK(other->tilings_);
658 659
659 UpdateLCDTextStatus(other->is_using_lcd_text_); 660 UpdateLCDTextStatus(other->is_using_lcd_text_);
660 661
661 if (!DrawsContent()) { 662 if (!DrawsContent()) {
662 RemoveAllTilings(); 663 RemoveAllTilings();
663 return; 664 return;
664 } 665 }
665 666
666 raster_page_scale_ = other->raster_page_scale_; 667 raster_page_scale_ = other->raster_page_scale_;
667 raster_device_scale_ = other->raster_device_scale_; 668 raster_device_scale_ = other->raster_device_scale_;
668 raster_source_scale_ = other->raster_source_scale_; 669 raster_source_scale_ = other->raster_source_scale_;
669 raster_contents_scale_ = other->raster_contents_scale_; 670 raster_contents_scale_ = other->raster_contents_scale_;
670 low_res_raster_contents_scale_ = other->low_res_raster_contents_scale_; 671 low_res_raster_contents_scale_ = other->low_res_raster_contents_scale_;
671 672
672 // Add synthetic invalidations for any recordings that were dropped. As 673 // Add synthetic invalidations to drop tiles from the active twin's tiling
673 // tiles are updated to point to this new pile, this will force the dropping 674 // that we may not have recordings for. As tiles are updated to point to this
674 // of tiles that can no longer be rastered. This is not ideal, but is a 675 // new pile, this will force the dropping of tiles that can no longer be
675 // trade-off for memory (use the same pile as much as possible, by switching 676 // rastered.
676 // during DidBecomeActive) and for time (don't bother checking every tile 677 // This is not ideal, as our pile may be able to raster the tiles, but
677 // during activation to see if the new pile can still raster it). 678 // checking this is expensive.
678 for (int x = 0; x < pile_->num_tiles_x(); ++x) { 679 // 1. To find all the recorded pile tiles and build a region is more costly
679 for (int y = 0; y < pile_->num_tiles_y(); ++y) { 680 // (up to 5-6x more costly in some experiments).
680 bool previously_had = other->pile_->HasRecordingAt(x, y); 681 // 2. To check every raster tile and verify that the pile can record it before
681 bool now_has = pile_->HasRecordingAt(x, y); 682 // we activate and drop the active pile is much more expensive.
682 if (now_has || !previously_had) 683 // 3. But we want to use the same pile for all of the tilings to avoid having
683 continue; 684 // to keep around old piles of recordings.
684 gfx::Rect layer_rect = pile_->tile_bounds(x, y); 685 // This causes tiles outside the recorded viewport to be always dropped, but
685 invalidation_.Union(layer_rect); 686 // we expect these to be far from the viewport, since they were outside of the
686 } 687 // recording interest rect, so re-rastering those tiles is the tradeoff for
687 } 688 // speed here.
689 Region outside_recorded_viewport = Region(pile_->tiling_rect());
690 outside_recorded_viewport.Subtract(pile_->recorded_viewport());
691 invalidation_.Union(outside_recorded_viewport);
enne (OOO) 2014/05/27 21:09:22 There's a performance bug here. As the comment on
688 692
689 // Union in the other newly exposed regions as invalid. 693 // Union in the other newly exposed regions as invalid.
690 Region difference_region = Region(gfx::Rect(bounds())); 694 Region difference_region = Region(gfx::Rect(bounds()));
691 difference_region.Subtract(gfx::Rect(other->bounds())); 695 difference_region.Subtract(gfx::Rect(other->bounds()));
692 invalidation_.Union(difference_region); 696 invalidation_.Union(difference_region);
693 697
694 bool synced_high_res_tiling = false; 698 bool synced_high_res_tiling = false;
695 if (CanHaveTilings()) { 699 if (CanHaveTilings()) {
696 synced_high_res_tiling = tilings_->SyncTilings( 700 synced_high_res_tiling = tilings_->SyncTilings(
697 *other->tilings_, bounds(), invalidation_, MinimumContentsScale()); 701 *other->tilings_, bounds(), invalidation_, MinimumContentsScale());
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 return iterator_index_ < iterators_.size(); 1574 return iterator_index_ < iterators_.size();
1571 } 1575 }
1572 1576
1573 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( 1577 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType(
1574 PictureLayerTiling::TilingEvictionTileIterator* it) const { 1578 PictureLayerTiling::TilingEvictionTileIterator* it) const {
1575 return it->get_type() == iteration_stage_ && 1579 return it->get_type() == iteration_stage_ &&
1576 (**it)->required_for_activation() == required_for_activation_; 1580 (**it)->required_for_activation() == required_for_activation_;
1577 } 1581 }
1578 1582
1579 } // namespace cc 1583 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resources/picture_pile_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698