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

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

Issue 1132103008: cc: Remove an unused constructor from TilePriority (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | 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 #include <string> 10 #include <string>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 priority_bin(EVENTUALLY), 44 priority_bin(EVENTUALLY),
45 distance_to_visible(std::numeric_limits<float>::infinity()) {} 45 distance_to_visible(std::numeric_limits<float>::infinity()) {}
46 46
47 TilePriority(TileResolution resolution, 47 TilePriority(TileResolution resolution,
48 PriorityBin bin, 48 PriorityBin bin,
49 float distance_to_visible) 49 float distance_to_visible)
50 : resolution(resolution), 50 : resolution(resolution),
51 priority_bin(bin), 51 priority_bin(bin),
52 distance_to_visible(distance_to_visible) {} 52 distance_to_visible(distance_to_visible) {}
53 53
54 TilePriority(const TilePriority& active, const TilePriority& pending) {
55 if (active.resolution == HIGH_RESOLUTION ||
56 pending.resolution == HIGH_RESOLUTION)
57 resolution = HIGH_RESOLUTION;
58 else if (active.resolution == LOW_RESOLUTION ||
59 pending.resolution == LOW_RESOLUTION)
60 resolution = LOW_RESOLUTION;
61 else
62 resolution = NON_IDEAL_RESOLUTION;
63
64 if (active.priority_bin < pending.priority_bin) {
65 priority_bin = active.priority_bin;
66 distance_to_visible = active.distance_to_visible;
67 } else if (active.priority_bin > pending.priority_bin) {
68 priority_bin = pending.priority_bin;
69 distance_to_visible = pending.distance_to_visible;
70 } else {
71 priority_bin = active.priority_bin;
72 distance_to_visible =
73 std::min(active.distance_to_visible, pending.distance_to_visible);
74 }
75 }
76
77 void AsValueInto(base::trace_event::TracedValue* dict) const; 54 void AsValueInto(base::trace_event::TracedValue* dict) const;
78 55
79 bool operator ==(const TilePriority& other) const {
80 return resolution == other.resolution &&
81 priority_bin == other.priority_bin &&
82 distance_to_visible == other.distance_to_visible;
83 }
84
85 bool operator !=(const TilePriority& other) const {
86 return !(*this == other);
87 }
88
89 bool IsHigherPriorityThan(const TilePriority& other) const { 56 bool IsHigherPriorityThan(const TilePriority& other) const {
90 return priority_bin < other.priority_bin || 57 return priority_bin < other.priority_bin ||
91 (priority_bin == other.priority_bin && 58 (priority_bin == other.priority_bin &&
92 distance_to_visible < other.distance_to_visible); 59 distance_to_visible < other.distance_to_visible);
93 } 60 }
94 61
95 TileResolution resolution; 62 TileResolution resolution;
96 PriorityBin priority_bin; 63 PriorityBin priority_bin;
97 float distance_to_visible; 64 float distance_to_visible;
98 }; 65 };
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 bool operator!=(const GlobalStateThatImpactsTilePriority& other) const { 117 bool operator!=(const GlobalStateThatImpactsTilePriority& other) const {
151 return !(*this == other); 118 return !(*this == other);
152 } 119 }
153 120
154 void AsValueInto(base::trace_event::TracedValue* dict) const; 121 void AsValueInto(base::trace_event::TracedValue* dict) const;
155 }; 122 };
156 123
157 } // namespace cc 124 } // namespace cc
158 125
159 #endif // CC_RESOURCES_TILE_PRIORITY_H_ 126 #endif // CC_RESOURCES_TILE_PRIORITY_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698