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

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
17 #define TRACK_TILE_SCREEN_SPACE_QUADS 1
18
16 namespace base { 19 namespace base {
17 class Value; 20 class Value;
18 } 21 }
19 22
20 namespace cc { 23 namespace cc {
21 24
22 enum WhichTree { 25 enum WhichTree {
23 // Note: these must be 0 and 1 because we index with them in various places, 26 // Note: these must be 0 and 1 because we index with them in various places,
24 // e.g. in Tile::priority_. 27 // e.g. in Tile::priority_.
25 ACTIVE_TREE = 0, 28 ACTIVE_TREE = 0,
26 PENDING_TREE = 1, 29 PENDING_TREE = 1,
27 NUM_TREES = 2 30 NUM_TREES = 2
28 // Be sure to update WhichTreeAsValue when adding new fields. 31 // Be sure to update WhichTreeAsValue when adding new fields.
29 }; 32 };
30 scoped_ptr<base::Value> WhichTreeAsValue( 33 scoped_ptr<base::Value> WhichTreeAsValue(
31 WhichTree tree); 34 WhichTree tree);
32 35
33 enum TileResolution { 36 enum TileResolution {
34 LOW_RESOLUTION = 0 , 37 LOW_RESOLUTION = 0 ,
35 HIGH_RESOLUTION = 1, 38 HIGH_RESOLUTION = 1,
36 NON_IDEAL_RESOLUTION = 2, 39 NON_IDEAL_RESOLUTION = 2,
37 }; 40 };
41 scoped_ptr<base::Value> TileResolutionAsValue(
42 TileResolution resolution);
38 43
39 struct CC_EXPORT TilePriority { 44 struct CC_EXPORT TilePriority {
40 TilePriority() 45 TilePriority()
41 : is_live(false), 46 : is_live(false),
42 resolution(NON_IDEAL_RESOLUTION), 47 resolution(NON_IDEAL_RESOLUTION),
43 time_to_visible_in_seconds(std::numeric_limits<float>::max()), 48 time_to_visible_in_seconds(std::numeric_limits<float>::max()),
44 distance_to_visible_in_pixels(std::numeric_limits<float>::max()) {} 49 distance_to_visible_in_pixels(std::numeric_limits<float>::max()) {}
45 50
46 TilePriority( 51 TilePriority(
47 TileResolution resolution, 52 TileResolution resolution,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 resolution = NON_IDEAL_RESOLUTION; 87 resolution = NON_IDEAL_RESOLUTION;
83 88
84 time_to_visible_in_seconds = 89 time_to_visible_in_seconds =
85 std::min(active.time_to_visible_in_seconds, 90 std::min(active.time_to_visible_in_seconds,
86 pending.time_to_visible_in_seconds); 91 pending.time_to_visible_in_seconds);
87 distance_to_visible_in_pixels = 92 distance_to_visible_in_pixels =
88 std::min(active.distance_to_visible_in_pixels, 93 std::min(active.distance_to_visible_in_pixels,
89 pending.distance_to_visible_in_pixels); 94 pending.distance_to_visible_in_pixels);
90 } 95 }
91 96
97 #ifdef TRACK_TILE_SCREEN_SPACE_QUADS
whunt 2013/02/01 21:09:33 same question on #if defined
98 void set_current_screen_quad(const gfx::QuadF& q) { current_screen_quad = q; }
99 #else
100 void set_current_screen_quad(const gfx::QuadF& current_screen_quad) {}
101 #endif
102
103 scoped_ptr<base::Value> AsValue() const;
104
92 static const double kMaxTimeToVisibleInSeconds; 105 static const double kMaxTimeToVisibleInSeconds;
93 static const double kMaxDistanceInContentSpace; 106 static const double kMaxDistanceInContentSpace;
94 107
95 static int manhattanDistance(const gfx::RectF& a, const gfx::RectF& b); 108 static int manhattanDistance(const gfx::RectF& a, const gfx::RectF& b);
96 109
97 // Calculate the time for the |current_bounds| to intersect with the 110 // Calculate the time for the |current_bounds| to intersect with the
98 // |target_bounds| given its previous location and time delta. 111 // |target_bounds| given its previous location and time delta.
99 // This function should work for both scaling and scrolling case. 112 // This function should work for both scaling and scrolling case.
100 static double TimeForBoundsToIntersect(gfx::RectF previous_bounds, 113 static double TimeForBoundsToIntersect(gfx::RectF previous_bounds,
101 gfx::RectF current_bounds, 114 gfx::RectF current_bounds,
102 double time_delta, 115 double time_delta,
103 gfx::RectF target_bounds); 116 gfx::RectF target_bounds);
104 117
105 // If a tile is not live, then all other fields are invalid. 118 // If a tile is not live, then all other fields are invalid.
106 bool is_live; 119 bool is_live;
107 TileResolution resolution; 120 TileResolution resolution;
108 float time_to_visible_in_seconds; 121 float time_to_visible_in_seconds;
109 float distance_to_visible_in_pixels; 122 float distance_to_visible_in_pixels;
123
124 private:
125 // TODO(nduca): How do we make this suck minimally?
126 #if TRACK_TILE_SCREEN_SPACE_QUADS
127 gfx::QuadF current_screen_quad;
128 #endif
110 }; 129 };
111 130
112 enum TileMemoryLimitPolicy { 131 enum TileMemoryLimitPolicy {
113 // Nothing. 132 // Nothing.
114 ALLOW_NOTHING, 133 ALLOW_NOTHING,
115 134
116 // You might be made visible, but you're not being interacted with. 135 // You might be made visible, but you're not being interacted with.
117 ALLOW_ABSOLUTE_MINIMUM, // Tall. 136 ALLOW_ABSOLUTE_MINIMUM, // Tall.
118 137
119 // You're being interacted with, but we're low on memory. 138 // You're being interacted with, but we're low on memory.
(...skipping 29 matching lines...) Expand all
149 size_t memory_limit_in_bytes; 168 size_t memory_limit_in_bytes;
150 169
151 TreePriority tree_priority; 170 TreePriority tree_priority;
152 171
153 scoped_ptr<base::Value> AsValue() const; 172 scoped_ptr<base::Value> AsValue() const;
154 }; 173 };
155 174
156 } // namespace cc 175 } // namespace cc
157 176
158 #endif // CC_TILE_PRIORITY_H_ 177 #endif // CC_TILE_PRIORITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698