Chromium Code Reviews| Index: base/json/json_file_value_serializer.h |
| diff --git a/base/json/json_file_value_serializer.h b/base/json/json_file_value_serializer.h |
| index f0f556c2dc68a23457ad2aa8ec3db7a8a209947d..fded3f289ff9dc959744b8701fa186ccc005bc8d 100644 |
| --- a/base/json/json_file_value_serializer.h |
| +++ b/base/json/json_file_value_serializer.h |
| @@ -14,15 +14,21 @@ |
| class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer { |
| public: |
| - // json_file_patch is the path of a file that will be source of the |
| + // |json_file_path_| is the path of a file that will be source of the |
| // deserialization or the destination of the serialization. |
| // When deserializing, the file should exist, but when serializing, the |
| // serializer will attempt to create the file at the specified location. |
| - explicit JSONFileValueSerializer(const base::FilePath& json_file_path) |
| - : json_file_path_(json_file_path), |
| - allow_trailing_comma_(false) {} |
| + // If |histogram_suffix| is non-empty, will log a |
| + // "Settings.JsonDataSizeKilobytes.|histogram_suffix|" UMA histogram with the |
| + // size of the content read from disk while deserializing. |
| + JSONFileValueSerializer(const base::FilePath& json_file_path, |
| + const std::string& histogram_suffix); |
|
Nico
2015/01/30 18:46:28
Why does a json library need to expose histograms
|
| - ~JSONFileValueSerializer() override {} |
| + // Constructs a JSONFileValueSerializer as above but with an empty |
| + // |histogram_suffix|. |
| + explicit JSONFileValueSerializer(const base::FilePath& json_file_path); |
| + |
| + ~JSONFileValueSerializer() override; |
| // DO NOT USE except in unit tests to verify the file was written properly. |
| // We should never serialize directly to a file since this will block the |
| @@ -74,8 +80,9 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer { |
| private: |
| bool SerializeInternal(const base::Value& root, bool omit_binary_values); |
| - base::FilePath json_file_path_; |
| + const base::FilePath json_file_path_; |
| bool allow_trailing_comma_; |
| + const std::string histogram_suffix_; |
| // A wrapper for ReadFileToString which returns a non-zero JsonFileError if |
| // there were file errors. |