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

Unified Diff: cc/resources/managed_tile_state.cc

Issue 380763002: Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed memory leak found by Linux ASAN Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/managed_tile_state.h ('k') | cc/resources/picture.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/managed_tile_state.cc
diff --git a/cc/resources/managed_tile_state.cc b/cc/resources/managed_tile_state.cc
index c760eb7797457985c00838aa466b5a99ac200e60..7109237b6127b5b2b1f1c3c193f5c0dbe63acad5 100644
--- a/cc/resources/managed_tile_state.cc
+++ b/cc/resources/managed_tile_state.cc
@@ -5,43 +5,36 @@
#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 {
-scoped_ptr<base::Value> ManagedTileBinAsValue(ManagedTileBin bin) {
+std::string ManagedTileBinToString(ManagedTileBin bin) {
switch (bin) {
case NOW_AND_READY_TO_DRAW_BIN:
- return scoped_ptr<base::Value>(
- new base::StringValue("NOW_AND_READY_TO_DRAW_BIN"));
+ return "NOW_AND_READY_TO_DRAW_BIN";
case NOW_BIN:
- return scoped_ptr<base::Value>(new base::StringValue("NOW_BIN"));
+ return "NOW_BIN";
case SOON_BIN:
- return scoped_ptr<base::Value>(
- new base::StringValue("SOON_BIN"));
+ return "SOON_BIN";
case EVENTUALLY_AND_ACTIVE_BIN:
- return scoped_ptr<base::Value>(
- new base::StringValue("EVENTUALLY_AND_ACTIVE_BIN"));
+ return "EVENTUALLY_AND_ACTIVE_BIN";
case EVENTUALLY_BIN:
- return scoped_ptr<base::Value>(
- new base::StringValue("EVENTUALLY_BIN"));
+ return "EVENTUALLY_BIN";
case AT_LAST_AND_ACTIVE_BIN:
- return scoped_ptr<base::Value>(
- new base::StringValue("AT_LAST_AND_ACTIVE_BIN"));
+ return "AT_LAST_AND_ACTIVE_BIN";
case AT_LAST_BIN:
- return scoped_ptr<base::Value>(
- new base::StringValue("AT_LAST_BIN"));
+ return "AT_LAST_BIN";
case NEVER_BIN:
- return scoped_ptr<base::Value>(
- new base::StringValue("NEVER_BIN"));
+ return "NEVER_BIN";
case NUM_BINS:
NOTREACHED();
- return scoped_ptr<base::Value>(
- new base::StringValue("Invalid Bin (NUM_BINS)"));
+ return "Invalid Bin (NUM_BINS)";
}
- return scoped_ptr<base::Value>(
- new base::StringValue("Invalid Bin (UNKNOWN)"));
+ return "Invalid Bin (UNKNOWN)";
}
ManagedTileState::ManagedTileState()
@@ -80,7 +73,7 @@ size_t ManagedTileState::TileVersion::GPUMemoryUsageInBytes() const {
ManagedTileState::~ManagedTileState() {}
-scoped_ptr<base::Value> ManagedTileState::AsValue() const {
+void ManagedTileState::AsValueInto(base::debug::TracedValue* state) const {
bool has_resource = false;
bool has_active_task = false;
for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) {
@@ -90,14 +83,13 @@ scoped_ptr<base::Value> ManagedTileState::AsValue() const {
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->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->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->SetBoolean("required_for_activation", required_for_activation);
state->SetBoolean(
"is_solid_color",
@@ -107,7 +99,6 @@ scoped_ptr<base::Value> ManagedTileState::AsValue() const {
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
« no previous file with comments | « cc/resources/managed_tile_state.h ('k') | cc/resources/picture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698