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

Unified Diff: content/browser/tracing/etw_tracing_agent_win.cc

Issue 2911033002: Remove raw base::DictionaryValue::Set (Closed)
Patch Set: Proper Windows Fix Created 3 years, 6 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 | « content/browser/accessibility/accessibility_tree_formatter_win.cc ('k') | dbus/values_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/tracing/etw_tracing_agent_win.cc
diff --git a/content/browser/tracing/etw_tracing_agent_win.cc b/content/browser/tracing/etw_tracing_agent_win.cc
index c126212776020449964c5aadd659004e5ac4a824..b3b56bd9454c033b45d9e9ff5be14228dc085c27 100644
--- a/content/browser/tracing/etw_tracing_agent_win.cc
+++ b/content/browser/tracing/etw_tracing_agent_win.cc
@@ -168,43 +168,41 @@ void EtwTracingAgent::AddSyncEventToBuffer() {
now_in_us.QuadPart = now.ToInternalValue();
// Add fields to the event.
- std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
- value->Set("guid", new base::Value("ClockSync"));
- value->Set("walltime",
- new base::Value(base::StringPrintf(
- "%08X%08X", walltime_in_us.HighPart, walltime_in_us.LowPart)));
- value->Set("tick", new base::Value(base::StringPrintf(
- "%08X%08X", now_in_us.HighPart, now_in_us.LowPart)));
+ auto value = base::MakeUnique<base::DictionaryValue>();
+ value->SetString("guid", "ClockSync");
+ value->SetString("walltime",
+ base::StringPrintf("%08X%08X", walltime_in_us.HighPart,
+ walltime_in_us.LowPart));
+ value->SetString("tick", base::StringPrintf("%08X%08X", now_in_us.HighPart,
+ now_in_us.LowPart));
// Append it to the events buffer.
events_->Append(std::move(value));
}
void EtwTracingAgent::AppendEventToBuffer(EVENT_TRACE* event) {
- using base::Value;
-
- std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
+ auto value = base::MakeUnique<base::DictionaryValue>();
// Add header fields to the event.
LARGE_INTEGER ts_us;
ts_us.QuadPart = event->Header.TimeStamp.QuadPart / 10;
- value->Set("ts", new base::Value(base::StringPrintf(
- "%08X%08X", ts_us.HighPart, ts_us.LowPart)));
+ value->SetString(
+ "ts", base::StringPrintf("%08X%08X", ts_us.HighPart, ts_us.LowPart));
- value->Set("guid", new base::Value(GuidToString(event->Header.Guid)));
+ value->SetString("guid", GuidToString(event->Header.Guid));
- value->Set("op", new Value(event->Header.Class.Type));
- value->Set("ver", new Value(event->Header.Class.Version));
- value->Set("pid", new Value(static_cast<int>(event->Header.ProcessId)));
- value->Set("tid", new Value(static_cast<int>(event->Header.ThreadId)));
- value->Set("cpu", new Value(event->BufferContext.ProcessorNumber));
+ value->SetInteger("op", event->Header.Class.Type);
+ value->SetInteger("ver", event->Header.Class.Version);
+ value->SetInteger("pid", static_cast<int>(event->Header.ProcessId));
+ value->SetInteger("tid", static_cast<int>(event->Header.ThreadId));
+ value->SetInteger("cpu", event->BufferContext.ProcessorNumber);
// Base64 encode the payload bytes.
base::StringPiece buffer(static_cast<const char*>(event->MofData),
event->MofLength);
std::string payload;
base::Base64Encode(buffer, &payload);
- value->Set("payload", new base::Value(payload));
+ value->SetString("payload", payload);
// Append it to the events buffer.
events_->Append(std::move(value));
@@ -227,8 +225,8 @@ void EtwTracingAgent::TraceAndConsumeOnThread() {
void EtwTracingAgent::FlushOnThread(
const StopAgentTracingCallback& callback) {
// Add the header information to the stream.
- std::unique_ptr<base::DictionaryValue> header(new base::DictionaryValue());
- header->Set("name", new base::Value("ETW"));
+ auto header = base::MakeUnique<base::DictionaryValue>();
+ header->SetString("name", "ETW");
// Release and pass the events buffer.
header->Set("content", std::move(events_));
« no previous file with comments | « content/browser/accessibility/accessibility_tree_formatter_win.cc ('k') | dbus/values_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698