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

Side by Side Diff: cc/tile_priority.h

Issue 12096112: [cc] Trace detailed tile info when --trace-all-rendered-frames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 10 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
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_TILE_PRIORITY_H_ 5 #ifndef CC_TILE_PRIORITY_H_
6 #define CC_TILE_PRIORITY_H_ 6 #define CC_TILE_PRIORITY_H_
7 7
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "cc/picture_pile.h" 12 #include "cc/picture_pile.h"
13 #include "ui/gfx/quad_f.h"
13 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
14 #include "ui/gfx/size.h" 15 #include "ui/gfx/size.h"
15 16
16 namespace base { 17 namespace base {
17 class Value; 18 class Value;
18 } 19 }
19 20
20 namespace cc { 21 namespace cc {
21 22
22 enum WhichTree { 23 enum WhichTree {
23 // Note: these must be 0 and 1 because we index with them in various places, 24 // Note: these must be 0 and 1 because we index with them in various places,
24 // e.g. in Tile::priority_. 25 // e.g. in Tile::priority_.
25 ACTIVE_TREE = 0, 26 ACTIVE_TREE = 0,
26 PENDING_TREE = 1, 27 PENDING_TREE = 1,
27 NUM_TREES = 2 28 NUM_TREES = 2
28 // Be sure to update WhichTreeAsValue when adding new fields. 29 // Be sure to update WhichTreeAsValue when adding new fields.
29 }; 30 };
30 scoped_ptr<base::Value> WhichTreeAsValue( 31 scoped_ptr<base::Value> WhichTreeAsValue(
31 WhichTree tree); 32 WhichTree tree);
32 33
33 enum TileResolution { 34 enum TileResolution {
34 LOW_RESOLUTION = 0 , 35 LOW_RESOLUTION = 0 ,
35 HIGH_RESOLUTION = 1, 36 HIGH_RESOLUTION = 1,
36 NON_IDEAL_RESOLUTION = 2, 37 NON_IDEAL_RESOLUTION = 2,
37 }; 38 };
39 scoped_ptr<base::Value> TileResolutionAsValue(
40 TileResolution resolution);
38 41
39 struct CC_EXPORT TilePriority { 42 struct CC_EXPORT TilePriority {
40 TilePriority() 43 TilePriority()
41 : is_live(false), 44 : is_live(false),
42 resolution(NON_IDEAL_RESOLUTION), 45 resolution(NON_IDEAL_RESOLUTION),
43 time_to_visible_in_seconds(std::numeric_limits<float>::max()), 46 time_to_visible_in_seconds(std::numeric_limits<float>::max()),
44 distance_to_visible_in_pixels(std::numeric_limits<float>::max()) {} 47 distance_to_visible_in_pixels(std::numeric_limits<float>::max()) {}
45 48
46 TilePriority( 49 TilePriority(
47 TileResolution resolution, 50 TileResolution resolution,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 else 84 else
82 resolution = NON_IDEAL_RESOLUTION; 85 resolution = NON_IDEAL_RESOLUTION;
83 86
84 time_to_visible_in_seconds = 87 time_to_visible_in_seconds =
85 std::min(active.time_to_visible_in_seconds, 88 std::min(active.time_to_visible_in_seconds,
86 pending.time_to_visible_in_seconds); 89 pending.time_to_visible_in_seconds);
87 distance_to_visible_in_pixels = 90 distance_to_visible_in_pixels =
88 std::min(active.distance_to_visible_in_pixels, 91 std::min(active.distance_to_visible_in_pixels,
89 pending.distance_to_visible_in_pixels); 92 pending.distance_to_visible_in_pixels);
90 } 93 }
94 void set_current_screen_quad(const gfx::QuadF& q) { current_screen_quad = q; }
95
96 scoped_ptr<base::Value> AsValue() const;
91 97
92 static const float kMaxDistanceInContentSpace; 98 static const float kMaxDistanceInContentSpace;
93 99
94 static inline float manhattanDistance(const gfx::RectF& a, const gfx::RectF& b ) { 100 static inline float manhattanDistance(const gfx::RectF& a, const gfx::RectF& b ) {
95 // Compute the union explicitly. 101 // Compute the union explicitly.
96 gfx::RectF c = gfx::RectF( 102 gfx::RectF c = gfx::RectF(
97 std::min(a.x(), b.x()), 103 std::min(a.x(), b.x()),
98 std::min(a.y(), b.y()), 104 std::min(a.y(), b.y()),
99 std::max(a.right(), b.right()) - std::min(a.x(), b.x()), 105 std::max(a.right(), b.right()) - std::min(a.x(), b.x()),
100 std::max(a.bottom(), b.bottom()) - std::min(a.y(), b.y())); 106 std::max(a.bottom(), b.bottom()) - std::min(a.y(), b.y()));
(...skipping 11 matching lines...) Expand all
112 static float TimeForBoundsToIntersect(const gfx::RectF& previous_bounds, 118 static float TimeForBoundsToIntersect(const gfx::RectF& previous_bounds,
113 const gfx::RectF& current_bounds, 119 const gfx::RectF& current_bounds,
114 float time_delta, 120 float time_delta,
115 const gfx::RectF& target_bounds); 121 const gfx::RectF& target_bounds);
116 122
117 // If a tile is not live, then all other fields are invalid. 123 // If a tile is not live, then all other fields are invalid.
118 bool is_live; 124 bool is_live;
119 TileResolution resolution; 125 TileResolution resolution;
120 float time_to_visible_in_seconds; 126 float time_to_visible_in_seconds;
121 float distance_to_visible_in_pixels; 127 float distance_to_visible_in_pixels;
128
129 private:
130 gfx::QuadF current_screen_quad;
122 }; 131 };
123 132
124 enum TileMemoryLimitPolicy { 133 enum TileMemoryLimitPolicy {
125 // Nothing. 134 // Nothing.
126 ALLOW_NOTHING, 135 ALLOW_NOTHING,
127 136
128 // 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.
129 ALLOW_ABSOLUTE_MINIMUM, // Tall. 138 ALLOW_ABSOLUTE_MINIMUM, // Tall.
130 139
131 // You're being interacted with, but we're low on memory. 140 // You're being interacted with, but we're low on memory.
(...skipping 29 matching lines...) Expand all
161 size_t memory_limit_in_bytes; 170 size_t memory_limit_in_bytes;
162 171
163 TreePriority tree_priority; 172 TreePriority tree_priority;
164 173
165 scoped_ptr<base::Value> AsValue() const; 174 scoped_ptr<base::Value> AsValue() const;
166 }; 175 };
167 176
168 } // namespace cc 177 } // namespace cc
169 178
170 #endif // CC_TILE_PRIORITY_H_ 179 #endif // CC_TILE_PRIORITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698