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

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

Issue 377793003: Consider occluded tiles during eviction with occluded as Tile property. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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/picture_layer_impl_unittest.cc ('k') | cc/resources/tile.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/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 17 matching lines...) Expand all
28 explicit TileEvictionOrder(TreePriority tree_priority) 28 explicit TileEvictionOrder(TreePriority tree_priority)
29 : tree_priority_(tree_priority) {} 29 : tree_priority_(tree_priority) {}
30 ~TileEvictionOrder() {} 30 ~TileEvictionOrder() {}
31 31
32 bool operator()(const Tile* a, const Tile* b) { 32 bool operator()(const Tile* a, const Tile* b) {
33 const TilePriority& a_priority = 33 const TilePriority& a_priority =
34 a->priority_for_tree_priority(tree_priority_); 34 a->priority_for_tree_priority(tree_priority_);
35 const TilePriority& b_priority = 35 const TilePriority& b_priority =
36 b->priority_for_tree_priority(tree_priority_); 36 b->priority_for_tree_priority(tree_priority_);
37 37
38 if (a_priority.priority_bin == b_priority.priority_bin && 38 // Evict a before b if their priority bins differ and a has the higher
39 a->required_for_activation() != b->required_for_activation()) { 39 // priority bin.
40 if (a_priority.priority_bin != b_priority.priority_bin)
41 return a_priority.priority_bin > b_priority.priority_bin;
42
43 // Or if a is not required and b is required.
44 if (a->required_for_activation() != b->required_for_activation())
40 return b->required_for_activation(); 45 return b->required_for_activation();
41 } 46
42 return b_priority.IsHigherPriorityThan(a_priority); 47 // Or if a is occluded and b is unoccluded.
48 bool a_is_occluded = a->is_occluded_for_tree_priority(tree_priority_);
49 bool b_is_occluded = b->is_occluded_for_tree_priority(tree_priority_);
50 if (a_is_occluded != b_is_occluded)
51 return a_is_occluded;
52
53 // Or if a is farther away from visible.
54 return a_priority.distance_to_visible > b_priority.distance_to_visible;
43 } 55 }
44 56
45 private: 57 private:
46 TreePriority tree_priority_; 58 TreePriority tree_priority_;
47 }; 59 };
48 } // namespace 60 } // namespace
49 61
50 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create( 62 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create(
51 float contents_scale, 63 float contents_scale,
52 const gfx::Size& layer_bounds, 64 const gfx::Size& layer_bounds,
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 tiling_->UpdateEvictionCacheIfNeeded(tree_priority_); 979 tiling_->UpdateEvictionCacheIfNeeded(tree_priority_);
968 tile_iterator_ = tiling_->eviction_tiles_cache_.begin(); 980 tile_iterator_ = tiling_->eviction_tiles_cache_.begin();
969 is_valid_ = true; 981 is_valid_ = true;
970 if (tile_iterator_ != tiling_->eviction_tiles_cache_.end() && 982 if (tile_iterator_ != tiling_->eviction_tiles_cache_.end() &&
971 !(*tile_iterator_)->HasResources()) { 983 !(*tile_iterator_)->HasResources()) {
972 ++(*this); 984 ++(*this);
973 } 985 }
974 } 986 }
975 987
976 } // namespace cc 988 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/resources/tile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698