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

Unified Diff: base/prefs/json_pref_store.cc

Issue 974753002: Stop pretty-printing pref JSON (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add --pretty-print-prefs switch Created 5 years, 10 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 | « base/prefs/base_prefs_switches.cc ('k') | base/test/data/prefs/write.golden.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/prefs/json_pref_store.cc
diff --git a/base/prefs/json_pref_store.cc b/base/prefs/json_pref_store.cc
index c52a95c9cc2b7b675059cbd6d91574a465633eba..87696c5759e8674f3bd715704ab1bf9c1c63a116 100644
--- a/base/prefs/json_pref_store.cc
+++ b/base/prefs/json_pref_store.cc
@@ -8,12 +8,14 @@
#include "base/bind.h"
#include "base/callback.h"
+#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/json/json_file_value_serializer.h"
#include "base/json/json_string_value_serializer.h"
#include "base/memory/ref_counted.h"
#include "base/metrics/histogram.h"
+#include "base/prefs/base_prefs_switches.h"
#include "base/prefs/pref_filter.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/string_util.h"
@@ -398,7 +400,9 @@ bool JsonPrefStore::SerializeData(std::string* output) {
pref_filter_->FilterSerializeData(prefs_.get());
JSONStringValueSerializer serializer(output);
- serializer.set_pretty_print(true);
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kPrettyPrintPrefs))
Bernhard Bauer 2015/03/04 10:07:58 Add braces around the body if the condition is mor
hashimoto 2015/03/04 14:18:40 Done.
+ serializer.set_pretty_print(true);
return serializer.Serialize(*prefs_);
}
« no previous file with comments | « base/prefs/base_prefs_switches.cc ('k') | base/test/data/prefs/write.golden.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698