Index: cc/tile_priority.cc |
diff --git a/cc/tile_priority.cc b/cc/tile_priority.cc |
index ec77029abe66df355704cda51269899dac93f7f5..5ca4298f9b58610562c26b04d4b8d6ff1fc7b677 100644 |
--- a/cc/tile_priority.cc |
+++ b/cc/tile_priority.cc |
@@ -5,6 +5,7 @@ |
#include "cc/tile_priority.h" |
#include "base/values.h" |
+#include "cc/math_util.h" |
namespace { |
@@ -71,6 +72,34 @@ scoped_ptr<base::Value> WhichTreeAsValue(WhichTree tree) { |
} |
} |
+scoped_ptr<base::Value> TileResolutionAsValue( |
+ TileResolution resolution) { |
+ switch (resolution) { |
+ case LOW_RESOLUTION: |
+ return scoped_ptr<base::Value>(base::Value::CreateStringValue( |
+ "LOW_RESOLUTION")); |
+ case HIGH_RESOLUTION: |
+ return scoped_ptr<base::Value>(base::Value::CreateStringValue( |
+ "HIGH_RESOLUTION")); |
+ default: |
+ DCHECK(false) << "Unrecognized TileResolution value"; |
+ return scoped_ptr<base::Value>(base::Value::CreateStringValue( |
+ "<unknown TileResolution value>")); |
+ } |
+} |
+ |
+scoped_ptr<base::Value> TilePriority::AsValue() const { |
+ scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
+ state->SetBoolean("is_live", is_live); |
+ state->Set("resolution", TileResolutionAsValue(resolution).release()); |
whunt
2013/02/01 21:09:33
Is this going to cause a double-release as the val
|
+ state->SetDouble("time_to_visible_in_seconds", time_to_visible_in_seconds); |
+ state->SetDouble("distance_to_visible_in_pixels", distance_to_visible_in_pixels); |
+#if TRACK_TILE_SCREEN_SPACE_QUADS |
+ state->Set("current_screen_quad", MathUtil::asValue(current_screen_quad).release()); |
+#endif |
+ return state.PassAs<base::Value>(); |
+} |
+ |
int TilePriority::manhattanDistance(const gfx::RectF& a, const gfx::RectF& b) { |
gfx::RectF c = gfx::UnionRects(a, b); |
// Rects touching the edge of the screen should not be considered visible. |