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

Unified Diff: cc/resources/tile_manager.cc

Issue 380763002: Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: cc/resources/tile_manager.cc
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index bf10d9504150aab4e26657a70055f52fad30f463..2003ea515d38e7e94aeed5f845621b0ec6460d84 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -9,6 +9,7 @@
#include <string>
#include "base/bind.h"
+#include "base/debug/trace_event_argument.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
@@ -667,7 +668,7 @@ void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) {
"DidManage",
TRACE_EVENT_SCOPE_THREAD,
"state",
- TracedValue::FromValue(BasicStateAsValue().release()));
+ BasicStateAsValue());
TRACE_COUNTER_ID1("cc",
"unused_memory_bytes",
@@ -696,19 +697,27 @@ bool TileManager::UpdateVisibleTiles() {
return did_initialize_visible_tile;
}
-scoped_ptr<base::Value> TileManager::BasicStateAsValue() const {
- scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
- state->SetInteger("tile_count", tiles_.size());
- state->Set("global_state", global_state_.AsValue().release());
- return state.PassAs<base::Value>();
+scoped_refptr<base::debug::ConvertableToTraceFormat>
+TileManager::BasicStateAsValue() const {
+ scoped_refptr<base::debug::TracedValue> value =
+ new base::debug::TracedValue();
+ BasicStateAsValueInto(value.get());
+ return value;
}
-scoped_ptr<base::Value> TileManager::AllTilesAsValue() const {
- scoped_ptr<base::ListValue> state(new base::ListValue());
- for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
- state->Append(it->second->AsValue().release());
+void TileManager::BasicStateAsValueInto(base::debug::TracedValue* state) const {
+ state->SetInteger("tile_count", tiles_.size());
+ state->BeginDictionary("global_state");
+ global_state_.AsValueInto(state);
+ state->EndDictionary();
+}
- return state.PassAs<base::Value>();
+void TileManager::AllTilesAsValueInto(base::debug::TracedValue* state) const {
+ for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
+ state->BeginDictionary();
+ it->second->AsValueInto(state);
+ state->EndDictionary();
+ }
}
void TileManager::AssignGpuMemoryToTiles(

Powered by Google App Engine
This is Rietveld 408576698