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

Side by Side Diff: cc/tile_priority.cc

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
« cc/tile_priority.h ('K') | « cc/tile_priority.h ('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 #include "cc/tile_priority.h" 5 #include "cc/tile_priority.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "cc/math_util.h"
8 9
9 namespace { 10 namespace {
10 11
11 // TODO(qinmin): modify ui/range/Range.h to support template so that we 12 // TODO(qinmin): modify ui/range/Range.h to support template so that we
12 // don't need to define this. 13 // don't need to define this.
13 struct Range { 14 struct Range {
14 Range(double start, double end) : start_(start), end_(end) {} 15 Range(double start, double end) : start_(start), end_(end) {}
15 Range Intersects(const Range& other); 16 Range Intersects(const Range& other);
16 bool IsEmpty(); 17 bool IsEmpty();
17 double start_; 18 double start_;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 case PENDING_TREE: 65 case PENDING_TREE:
65 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 66 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
66 "PENDING_TREE")); 67 "PENDING_TREE"));
67 default: 68 default:
68 DCHECK(false) << "Unrecognized WhichTree value"; 69 DCHECK(false) << "Unrecognized WhichTree value";
69 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 70 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
70 "<unknown WhichTree value>")); 71 "<unknown WhichTree value>"));
71 } 72 }
72 } 73 }
73 74
75 scoped_ptr<base::Value> TileResolutionAsValue(
76 TileResolution resolution) {
77 switch (resolution) {
78 case LOW_RESOLUTION:
79 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
80 "LOW_RESOLUTION"));
81 case HIGH_RESOLUTION:
82 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
83 "HIGH_RESOLUTION"));
84 default:
85 DCHECK(false) << "Unrecognized TileResolution value";
86 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
87 "<unknown TileResolution value>"));
88 }
89 }
90
91 scoped_ptr<base::Value> TilePriority::AsValue() const {
92 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
93 state->SetBoolean("is_live", is_live);
94 state->Set("resolution", TileResolutionAsValue(resolution).release());
whunt 2013/02/01 21:09:33 Is this going to cause a double-release as the val
95 state->SetDouble("time_to_visible_in_seconds", time_to_visible_in_seconds);
96 state->SetDouble("distance_to_visible_in_pixels", distance_to_visible_in_pixel s);
97 #if TRACK_TILE_SCREEN_SPACE_QUADS
98 state->Set("current_screen_quad", MathUtil::asValue(current_screen_quad).relea se());
99 #endif
100 return state.PassAs<base::Value>();
101 }
102
74 int TilePriority::manhattanDistance(const gfx::RectF& a, const gfx::RectF& b) { 103 int TilePriority::manhattanDistance(const gfx::RectF& a, const gfx::RectF& b) {
75 gfx::RectF c = gfx::UnionRects(a, b); 104 gfx::RectF c = gfx::UnionRects(a, b);
76 // Rects touching the edge of the screen should not be considered visible. 105 // Rects touching the edge of the screen should not be considered visible.
77 // So we add 1 pixel here to avoid that situation. 106 // So we add 1 pixel here to avoid that situation.
78 int x = static_cast<int>( 107 int x = static_cast<int>(
79 std::max(0.0f, c.width() - a.width() - b.width() + 1)); 108 std::max(0.0f, c.width() - a.width() - b.width() + 1));
80 int y = static_cast<int>( 109 int y = static_cast<int>(
81 std::max(0.0f, c.height() - a.height() - b.height() + 1)); 110 std::max(0.0f, c.height() - a.height() - b.height() + 1));
82 return (x + y); 111 return (x + y);
83 } 112 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 scoped_ptr<base::Value> GlobalStateThatImpactsTilePriority::AsValue() const { 191 scoped_ptr<base::Value> GlobalStateThatImpactsTilePriority::AsValue() const {
163 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 192 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
164 state->Set("memory_limit_policy", TileMemoryLimitPolicyAsValue(memory_limit_po licy).release()); 193 state->Set("memory_limit_policy", TileMemoryLimitPolicyAsValue(memory_limit_po licy).release());
165 state->SetInteger("memory_limit_in_bytes", memory_limit_in_bytes); 194 state->SetInteger("memory_limit_in_bytes", memory_limit_in_bytes);
166 state->Set("tree_priority", TreePriorityAsValue(tree_priority).release()); 195 state->Set("tree_priority", TreePriorityAsValue(tree_priority).release());
167 return state.PassAs<base::Value>(); 196 return state.PassAs<base::Value>();
168 } 197 }
169 198
170 199
171 } // namespace cc 200 } // namespace cc
OLDNEW
« cc/tile_priority.h ('K') | « cc/tile_priority.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698