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 "chrome/browser/prefs/chrome_pref_service_factory.h" | 5 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // baseline on the success rate in addition to the error distribution. | 221 // baseline on the success rate in addition to the error distribution. |
222 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, | 222 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, |
223 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM); | 223 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM); |
224 | 224 |
225 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) { | 225 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) { |
226 #if !defined(OS_CHROMEOS) | 226 #if !defined(OS_CHROMEOS) |
227 // Failing to load prefs on startup is a bad thing(TM). See bug 38352 for | 227 // Failing to load prefs on startup is a bad thing(TM). See bug 38352 for |
228 // an example problem that this can cause. | 228 // an example problem that this can cause. |
229 // Do some diagnosis and try to avoid losing data. | 229 // Do some diagnosis and try to avoid losing data. |
230 int message_id = 0; | 230 int message_id = 0; |
231 if (error <= PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE) { | 231 if (error <= PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE || |
| 232 error >= PersistentPrefStore::PREF_READ_ERROR_LEVELDB_DESTROY_FAILED) { |
232 message_id = IDS_PREFERENCES_CORRUPT_ERROR; | 233 message_id = IDS_PREFERENCES_CORRUPT_ERROR; |
233 } else if (error != PersistentPrefStore::PREF_READ_ERROR_NO_FILE) { | 234 } else if (error != PersistentPrefStore::PREF_READ_ERROR_NO_FILE && |
| 235 error < PersistentPrefStore:: |
| 236 PREF_READ_ERROR_LEVELDB_DESTROYED_REOPEN_SUCCESS) { |
234 message_id = IDS_PREFERENCES_UNREADABLE_ERROR; | 237 message_id = IDS_PREFERENCES_UNREADABLE_ERROR; |
235 } | 238 } |
236 | 239 |
237 if (message_id) { | 240 if (message_id) { |
238 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 241 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
239 base::Bind(&ShowProfileErrorDialog, | 242 base::Bind(&ShowProfileErrorDialog, |
240 PROFILE_ERROR_PREFERENCES, | 243 PROFILE_ERROR_PREFERENCES, |
241 message_id)); | 244 message_id)); |
242 } | 245 } |
243 #else | 246 #else |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 UMA_HISTOGRAM_BOOLEAN("Settings.InitializedFromMasterPrefs", success); | 582 UMA_HISTOGRAM_BOOLEAN("Settings.InitializedFromMasterPrefs", success); |
580 return success; | 583 return success; |
581 } | 584 } |
582 | 585 |
583 void RegisterPrefs(PrefRegistrySimple* registry) { | 586 void RegisterPrefs(PrefRegistrySimple* registry) { |
584 registry->RegisterInt64Pref(prefs::kProfilePreferenceResetTime, 0L); | 587 registry->RegisterInt64Pref(prefs::kProfilePreferenceResetTime, 0L); |
585 PrefHashStoreImpl::RegisterPrefs(registry); | 588 PrefHashStoreImpl::RegisterPrefs(registry); |
586 } | 589 } |
587 | 590 |
588 } // namespace chrome_prefs | 591 } // namespace chrome_prefs |
OLD | NEW |