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

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

Issue 502453003: cc: Remove tiles from recycle tree that were deleted on active. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: don't maintain recycled twin Created 6 years, 3 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
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_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 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_layer_tiling.h" 5 #include "cc/resources/picture_layer_tiling.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 10
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 tile->SetPriority(tree, priority); 600 tile->SetPriority(tree, priority);
601 } 601 }
602 602
603 // Update iteration rects. 603 // Update iteration rects.
604 current_visible_rect_ = visible_rect_in_content_space; 604 current_visible_rect_ = visible_rect_in_content_space;
605 current_skewport_rect_ = skewport; 605 current_skewport_rect_ = skewport;
606 current_soon_border_rect_ = soon_border_rect; 606 current_soon_border_rect_ = soon_border_rect;
607 current_eventually_rect_ = eventually_rect; 607 current_eventually_rect_ = eventually_rect;
608 } 608 }
609 609
610 void PictureLayerTiling::RemoveTileAt(int i, int j) {
611 TileMapKey key(i, j);
612 TileMap::iterator found = tiles_.find(key);
613 if (found == tiles_.end())
614 return;
615 ReleaseTile(found->second.get(), client_->GetTree());
616 tiles_.erase(found);
617 }
618
610 void PictureLayerTiling::SetLiveTilesRect( 619 void PictureLayerTiling::SetLiveTilesRect(
611 const gfx::Rect& new_live_tiles_rect) { 620 const gfx::Rect& new_live_tiles_rect) {
612 DCHECK(new_live_tiles_rect.IsEmpty() || 621 DCHECK(new_live_tiles_rect.IsEmpty() ||
613 gfx::Rect(tiling_size()).Contains(new_live_tiles_rect)) 622 gfx::Rect(tiling_size()).Contains(new_live_tiles_rect))
614 << "tiling_size: " << tiling_size().ToString() 623 << "tiling_size: " << tiling_size().ToString()
615 << " new_live_tiles_rect: " << new_live_tiles_rect.ToString(); 624 << " new_live_tiles_rect: " << new_live_tiles_rect.ToString();
616 if (live_tiles_rect_ == new_live_tiles_rect) 625 if (live_tiles_rect_ == new_live_tiles_rect)
617 return; 626 return;
618 627
619 // Iterate to delete all tiles outside of our new live_tiles rect. 628 // Iterate to delete all tiles outside of our new live_tiles rect.
629 PictureLayerTiling* recycled_twin = client_->GetRecycledTwinTiling(this);
620 for (TilingData::DifferenceIterator iter(&tiling_data_, 630 for (TilingData::DifferenceIterator iter(&tiling_data_,
621 live_tiles_rect_, 631 live_tiles_rect_,
622 new_live_tiles_rect); 632 new_live_tiles_rect);
623 iter; 633 iter;
624 ++iter) { 634 ++iter) {
625 TileMapKey key(iter.index()); 635 TileMapKey key(iter.index());
626 TileMap::iterator found = tiles_.find(key); 636 TileMap::iterator found = tiles_.find(key);
627 // If the tile was outside of the recorded region, it won't exist even 637 // If the tile was outside of the recorded region, it won't exist even
628 // though it was in the live rect. 638 // though it was in the live rect.
629 if (found != tiles_.end()) { 639 if (found != tiles_.end()) {
630 ReleaseTile(found->second.get(), client_->GetTree()); 640 ReleaseTile(found->second.get(), client_->GetTree());
631 tiles_.erase(found); 641 tiles_.erase(found);
642 if (recycled_twin)
643 recycled_twin->RemoveTileAt(iter.index_x(), iter.index_y());
632 } 644 }
633 } 645 }
634 646
635 const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this); 647 const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this);
636 648
637 // Iterate to allocate new tiles for all regions with newly exposed area. 649 // Iterate to allocate new tiles for all regions with newly exposed area.
638 for (TilingData::DifferenceIterator iter(&tiling_data_, 650 for (TilingData::DifferenceIterator iter(&tiling_data_,
639 new_live_tiles_rect, 651 new_live_tiles_rect,
640 live_tiles_rect_); 652 live_tiles_rect_);
641 iter; 653 iter;
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 DCHECK(*this); 1101 DCHECK(*this);
1090 do { 1102 do {
1091 ++current_eviction_tiles_index_; 1103 ++current_eviction_tiles_index_;
1092 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && 1104 } while (current_eviction_tiles_index_ != eviction_tiles_->size() &&
1093 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); 1105 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources());
1094 1106
1095 return *this; 1107 return *this;
1096 } 1108 }
1097 1109
1098 } // namespace cc 1110 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698