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

Unified Diff: net/log/write_to_file_net_log_observer.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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 | « net/log/trace_net_log_observer.cc ('k') | net/test/spawned_test_server/remote_test_server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/log/write_to_file_net_log_observer.cc
diff --git a/net/log/write_to_file_net_log_observer.cc b/net/log/write_to_file_net_log_observer.cc
index 8ef5a7156a70da0423218bd7b39f2e6494e70bda..5c4f95142d174aff6b5b346644fa06551bc29dab 100644
--- a/net/log/write_to_file_net_log_observer.cc
+++ b/net/log/write_to_file_net_log_observer.cc
@@ -43,12 +43,11 @@ void WriteToFileNetLogObserver::StartObserving(
// different source and event types, as they may be added and removed
// between Chrome versions.
std::string json;
- if (constants) {
- base::JSONWriter::Write(constants, &json);
- } else {
- scoped_ptr<base::DictionaryValue> scoped_constants(GetNetConstants());
- base::JSONWriter::Write(scoped_constants.get(), &json);
- }
+ if (constants)
+ base::JSONWriter::Write(*constants, &json);
+ else
+ base::JSONWriter::Write(*GetNetConstants(), &json);
+
fprintf(file_.get(), "{\"constants\": %s,\n", json.c_str());
// Start events array. It's closed in StopObserving().
@@ -78,9 +77,8 @@ void WriteToFileNetLogObserver::StopObserving(
DCHECK(url_request_context->CalledOnValidThread());
std::string json;
- scoped_ptr<base::DictionaryValue> net_info =
- GetNetInfo(url_request_context, NET_INFO_ALL_SOURCES);
- base::JSONWriter::Write(net_info.get(), &json);
+ base::JSONWriter::Write(
+ *GetNetInfo(url_request_context, NET_INFO_ALL_SOURCES), &json);
fprintf(file_.get(), ",\"tabInfo\": %s\n", json.c_str());
}
fprintf(file_.get(), "}");
@@ -94,7 +92,7 @@ void WriteToFileNetLogObserver::OnAddEntry(const NetLog::Entry& entry) {
// work, lines cannot be pretty printed.
scoped_ptr<base::Value> value(entry.ToValue());
std::string json;
- base::JSONWriter::Write(value.get(), &json);
+ base::JSONWriter::Write(*value, &json);
fprintf(file_.get(), "%s%s", (added_events_ ? ",\n" : ""), json.c_str());
added_events_ = true;
}
« no previous file with comments | « net/log/trace_net_log_observer.cc ('k') | net/test/spawned_test_server/remote_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698