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

Unified Diff: base/json/json_file_value_serializer.cc

Issue 891663003: Log pref file size histogram on read rather than on write. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: histograms back in JsonPrefStore impl Created 5 years, 11 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: base/json/json_file_value_serializer.cc
diff --git a/base/json/json_file_value_serializer.cc b/base/json/json_file_value_serializer.cc
index d60f800cfcfbb9235fc62fc050feb98c87a54740..ebfd2e68f3fc5feb80ce331d7cc2ecb0731c03a6 100644
--- a/base/json/json_file_value_serializer.cc
+++ b/base/json/json_file_value_serializer.cc
@@ -15,6 +15,14 @@ const char JSONFileValueSerializer::kCannotReadFile[] = "Can't read file.";
const char JSONFileValueSerializer::kFileLocked[] = "File locked.";
const char JSONFileValueSerializer::kNoSuchFile[] = "File doesn't exist.";
+JSONFileValueSerializer::JSONFileValueSerializer(
+ const base::FilePath& json_file_path)
+ : json_file_path_(json_file_path),
+ allow_trailing_comma_(false),
+ last_read_size_(0U) {}
+
+JSONFileValueSerializer::~JSONFileValueSerializer() {}
+
bool JSONFileValueSerializer::Serialize(const base::Value& root) {
return SerializeInternal(root, false);
}
@@ -59,6 +67,8 @@ int JSONFileValueSerializer::ReadFileToString(std::string* json_string) {
else
return JSON_CANNOT_READ_FILE;
}
+
+ last_read_size_ = json_string->size();
return JSON_NO_ERROR;
}

Powered by Google App Engine
This is Rietveld 408576698