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

Side by Side Diff: cc/resources/tile_priority.h

Issue 16959022: cc: Make tiles that are not required by trees NEVER_BIN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« cc/resources/tile_manager.cc ('K') | « cc/resources/tile_manager.cc ('k') | 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 #ifndef CC_RESOURCES_TILE_PRIORITY_H_ 5 #ifndef CC_RESOURCES_TILE_PRIORITY_H_
6 #define CC_RESOURCES_TILE_PRIORITY_H_ 6 #define CC_RESOURCES_TILE_PRIORITY_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <limits> 9 #include <limits>
10 10
(...skipping 27 matching lines...) Expand all
38 NON_IDEAL_RESOLUTION = 2, 38 NON_IDEAL_RESOLUTION = 2,
39 }; 39 };
40 scoped_ptr<base::Value> TileResolutionAsValue( 40 scoped_ptr<base::Value> TileResolutionAsValue(
41 TileResolution resolution); 41 TileResolution resolution);
42 42
43 struct CC_EXPORT TilePriority { 43 struct CC_EXPORT TilePriority {
44 TilePriority() 44 TilePriority()
45 : resolution(NON_IDEAL_RESOLUTION), 45 : resolution(NON_IDEAL_RESOLUTION),
46 required_for_activation(false), 46 required_for_activation(false),
47 time_to_visible_in_seconds(std::numeric_limits<float>::infinity()), 47 time_to_visible_in_seconds(std::numeric_limits<float>::infinity()),
48 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()) {} 48 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()),
49 required_by_tree(false) {}
49 50
50 TilePriority(TileResolution resolution, 51 TilePriority(TileResolution resolution,
51 float time_to_visible_in_seconds, 52 float time_to_visible_in_seconds,
52 float distance_to_visible_in_pixels) 53 float distance_to_visible_in_pixels)
53 : resolution(resolution), 54 : resolution(resolution),
54 required_for_activation(false), 55 required_for_activation(false),
55 time_to_visible_in_seconds(time_to_visible_in_seconds), 56 time_to_visible_in_seconds(time_to_visible_in_seconds),
56 distance_to_visible_in_pixels(distance_to_visible_in_pixels) {} 57 distance_to_visible_in_pixels(distance_to_visible_in_pixels),
58 required_by_tree(true) {}
57 59
58 TilePriority(const TilePriority& active, const TilePriority& pending) { 60 TilePriority(const TilePriority& active, const TilePriority& pending) {
59 if (active.resolution == HIGH_RESOLUTION || 61 if (active.resolution == HIGH_RESOLUTION ||
60 pending.resolution == HIGH_RESOLUTION) 62 pending.resolution == HIGH_RESOLUTION)
61 resolution = HIGH_RESOLUTION; 63 resolution = HIGH_RESOLUTION;
62 else if (active.resolution == LOW_RESOLUTION || 64 else if (active.resolution == LOW_RESOLUTION ||
63 pending.resolution == LOW_RESOLUTION) 65 pending.resolution == LOW_RESOLUTION)
64 resolution = LOW_RESOLUTION; 66 resolution = LOW_RESOLUTION;
65 else 67 else
66 resolution = NON_IDEAL_RESOLUTION; 68 resolution = NON_IDEAL_RESOLUTION;
67 69
68 required_for_activation = 70 required_for_activation =
69 active.required_for_activation || pending.required_for_activation; 71 active.required_for_activation || pending.required_for_activation;
70 72
71 time_to_visible_in_seconds = 73 time_to_visible_in_seconds =
72 std::min(active.time_to_visible_in_seconds, 74 std::min(active.time_to_visible_in_seconds,
73 pending.time_to_visible_in_seconds); 75 pending.time_to_visible_in_seconds);
74 distance_to_visible_in_pixels = 76 distance_to_visible_in_pixels =
75 std::min(active.distance_to_visible_in_pixels, 77 std::min(active.distance_to_visible_in_pixels,
76 pending.distance_to_visible_in_pixels); 78 pending.distance_to_visible_in_pixels);
79
80 required_by_tree =
81 active.required_by_tree || pending.required_by_tree;
77 } 82 }
78 void set_current_screen_quad(const gfx::QuadF& q) { current_screen_quad = q; } 83 void set_current_screen_quad(const gfx::QuadF& q) { current_screen_quad = q; }
79 84
80 scoped_ptr<base::Value> AsValue() const; 85 scoped_ptr<base::Value> AsValue() const;
81 86
82 static inline float manhattanDistance(const gfx::RectF& a, 87 static inline float manhattanDistance(const gfx::RectF& a,
83 const gfx::RectF& b) { 88 const gfx::RectF& b) {
84 // Compute the union explicitly. 89 // Compute the union explicitly.
85 gfx::RectF c = gfx::RectF( 90 gfx::RectF c = gfx::RectF(
86 std::min(a.x(), b.x()), 91 std::min(a.x(), b.x()),
(...skipping 25 matching lines...) Expand all
112 } 117 }
113 118
114 bool operator !=(const TilePriority& other) const { 119 bool operator !=(const TilePriority& other) const {
115 return !(*this == other); 120 return !(*this == other);
116 } 121 }
117 122
118 TileResolution resolution; 123 TileResolution resolution;
119 bool required_for_activation; 124 bool required_for_activation;
120 float time_to_visible_in_seconds; 125 float time_to_visible_in_seconds;
121 float distance_to_visible_in_pixels; 126 float distance_to_visible_in_pixels;
127 bool required_by_tree;
122 128
123 private: 129 private:
124 gfx::QuadF current_screen_quad; 130 gfx::QuadF current_screen_quad;
125 }; 131 };
126 132
127 enum TileMemoryLimitPolicy { 133 enum TileMemoryLimitPolicy {
128 // Nothing. 134 // Nothing.
129 ALLOW_NOTHING, 135 ALLOW_NOTHING,
130 136
131 // You might be made visible, but you're not being interacted with. 137 // You might be made visible, but you're not being interacted with.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 size_t unused_memory_limit_in_bytes; 171 size_t unused_memory_limit_in_bytes;
166 172
167 TreePriority tree_priority; 173 TreePriority tree_priority;
168 174
169 scoped_ptr<base::Value> AsValue() const; 175 scoped_ptr<base::Value> AsValue() const;
170 }; 176 };
171 177
172 } // namespace cc 178 } // namespace cc
173 179
174 #endif // CC_RESOURCES_TILE_PRIORITY_H_ 180 #endif // CC_RESOURCES_TILE_PRIORITY_H_
OLDNEW
« cc/resources/tile_manager.cc ('K') | « cc/resources/tile_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698