Index: cc/resources/managed_tile_state.cc |
diff --git a/cc/resources/managed_tile_state.cc b/cc/resources/managed_tile_state.cc |
index 7109237b6127b5b2b1f1c3c193f5c0dbe63acad5..c760eb7797457985c00838aa466b5a99ac200e60 100644 |
--- a/cc/resources/managed_tile_state.cc |
+++ b/cc/resources/managed_tile_state.cc |
@@ -5,36 +5,43 @@ |
#include "cc/resources/managed_tile_state.h" |
#include <limits> |
-#include <string> |
-#include "base/debug/trace_event_argument.h" |
#include "cc/base/math_util.h" |
namespace cc { |
-std::string ManagedTileBinToString(ManagedTileBin bin) { |
+scoped_ptr<base::Value> ManagedTileBinAsValue(ManagedTileBin bin) { |
switch (bin) { |
case NOW_AND_READY_TO_DRAW_BIN: |
- return "NOW_AND_READY_TO_DRAW_BIN"; |
+ return scoped_ptr<base::Value>( |
+ new base::StringValue("NOW_AND_READY_TO_DRAW_BIN")); |
case NOW_BIN: |
- return "NOW_BIN"; |
+ return scoped_ptr<base::Value>(new base::StringValue("NOW_BIN")); |
case SOON_BIN: |
- return "SOON_BIN"; |
+ return scoped_ptr<base::Value>( |
+ new base::StringValue("SOON_BIN")); |
case EVENTUALLY_AND_ACTIVE_BIN: |
- return "EVENTUALLY_AND_ACTIVE_BIN"; |
+ return scoped_ptr<base::Value>( |
+ new base::StringValue("EVENTUALLY_AND_ACTIVE_BIN")); |
case EVENTUALLY_BIN: |
- return "EVENTUALLY_BIN"; |
+ return scoped_ptr<base::Value>( |
+ new base::StringValue("EVENTUALLY_BIN")); |
case AT_LAST_AND_ACTIVE_BIN: |
- return "AT_LAST_AND_ACTIVE_BIN"; |
+ return scoped_ptr<base::Value>( |
+ new base::StringValue("AT_LAST_AND_ACTIVE_BIN")); |
case AT_LAST_BIN: |
- return "AT_LAST_BIN"; |
+ return scoped_ptr<base::Value>( |
+ new base::StringValue("AT_LAST_BIN")); |
case NEVER_BIN: |
- return "NEVER_BIN"; |
+ return scoped_ptr<base::Value>( |
+ new base::StringValue("NEVER_BIN")); |
case NUM_BINS: |
NOTREACHED(); |
- return "Invalid Bin (NUM_BINS)"; |
+ return scoped_ptr<base::Value>( |
+ new base::StringValue("Invalid Bin (NUM_BINS)")); |
} |
- return "Invalid Bin (UNKNOWN)"; |
+ return scoped_ptr<base::Value>( |
+ new base::StringValue("Invalid Bin (UNKNOWN)")); |
} |
ManagedTileState::ManagedTileState() |
@@ -73,7 +80,7 @@ |
ManagedTileState::~ManagedTileState() {} |
-void ManagedTileState::AsValueInto(base::debug::TracedValue* state) const { |
+scoped_ptr<base::Value> ManagedTileState::AsValue() const { |
bool has_resource = false; |
bool has_active_task = false; |
for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { |
@@ -83,13 +90,14 @@ |
bool is_using_gpu_memory = has_resource || has_active_task; |
+ scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
state->SetBoolean("has_resource", has_resource); |
state->SetBoolean("is_using_gpu_memory", is_using_gpu_memory); |
- state->SetString("bin", ManagedTileBinToString(bin)); |
- state->SetString("resolution", TileResolutionToString(resolution)); |
- state->SetString("priority_bin", TilePriorityBinToString(priority_bin)); |
- state->SetDouble("distance_to_visible", |
- MathUtil::AsFloatSafely(distance_to_visible)); |
+ state->Set("bin", ManagedTileBinAsValue(bin).release()); |
+ state->Set("resolution", TileResolutionAsValue(resolution).release()); |
+ state->Set("priority_bin", TilePriorityBinAsValue(priority_bin).release()); |
+ state->Set("distance_to_visible", |
+ MathUtil::AsValueSafely(distance_to_visible).release()); |
state->SetBoolean("required_for_activation", required_for_activation); |
state->SetBoolean( |
"is_solid_color", |
@@ -99,6 +107,7 @@ |
tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE && |
!SkColorGetA(tile_versions[raster_mode].solid_color_)); |
state->SetInteger("scheduled_priority", scheduled_priority); |
+ return state.PassAs<base::Value>(); |
} |
} // namespace cc |