OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/prefs/json_pref_store.h" | 5 #include "base/prefs/json_pref_store.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if (!base::PathExists(path) && !alternate_path.empty() && | 111 if (!base::PathExists(path) && !alternate_path.empty() && |
112 base::PathExists(alternate_path)) { | 112 base::PathExists(alternate_path)) { |
113 base::Move(alternate_path, path); | 113 base::Move(alternate_path, path); |
114 } | 114 } |
115 | 115 |
116 int error_code; | 116 int error_code; |
117 std::string error_msg; | 117 std::string error_msg; |
118 scoped_ptr<JsonPrefStore::ReadResult> read_result( | 118 scoped_ptr<JsonPrefStore::ReadResult> read_result( |
119 new JsonPrefStore::ReadResult); | 119 new JsonPrefStore::ReadResult); |
120 JSONFileValueDeserializer deserializer(path); | 120 JSONFileValueDeserializer deserializer(path); |
121 read_result->value.reset(deserializer.Deserialize(&error_code, &error_msg)); | 121 read_result->value = deserializer.Deserialize(&error_code, &error_msg); |
122 read_result->error = | 122 read_result->error = |
123 HandleReadErrors(read_result->value.get(), path, error_code, error_msg); | 123 HandleReadErrors(read_result->value.get(), path, error_code, error_msg); |
124 read_result->no_dir = !base::PathExists(path.DirName()); | 124 read_result->no_dir = !base::PathExists(path.DirName()); |
125 | 125 |
126 if (read_result->error == PersistentPrefStore::PREF_READ_ERROR_NONE) | 126 if (read_result->error == PersistentPrefStore::PREF_READ_ERROR_NONE) |
127 RecordJsonDataSizeHistogram(path, deserializer.get_last_read_size()); | 127 RecordJsonDataSizeHistogram(path, deserializer.get_last_read_size()); |
128 | 128 |
129 return read_result.Pass(); | 129 return read_result.Pass(); |
130 } | 130 } |
131 | 131 |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 DCHECK_EQ(31, num_buckets); | 526 DCHECK_EQ(31, num_buckets); |
527 | 527 |
528 // The histogram below is an expansion of the UMA_HISTOGRAM_CUSTOM_COUNTS | 528 // The histogram below is an expansion of the UMA_HISTOGRAM_CUSTOM_COUNTS |
529 // macro adapted to allow for a dynamically suffixed histogram name. | 529 // macro adapted to allow for a dynamically suffixed histogram name. |
530 // Note: The factory creates and owns the histogram. | 530 // Note: The factory creates and owns the histogram. |
531 base::HistogramBase* histogram = base::Histogram::FactoryGet( | 531 base::HistogramBase* histogram = base::Histogram::FactoryGet( |
532 histogram_name, min_value, max_value, num_buckets, | 532 histogram_name, min_value, max_value, num_buckets, |
533 base::HistogramBase::kUmaTargetedHistogramFlag); | 533 base::HistogramBase::kUmaTargetedHistogramFlag); |
534 return histogram; | 534 return histogram; |
535 } | 535 } |
OLD | NEW |