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

Side by Side Diff: chrome/browser/prefs/chrome_pref_service_factory.cc

Issue 169323003: Implementation of leveldb-backed PrefStore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: respond to comments; add histograms.xml entries Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // baseline on the success rate in addition to the error distribution. 275 // baseline on the success rate in addition to the error distribution.
276 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, 276 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error,
277 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM); 277 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM);
278 278
279 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) { 279 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) {
280 #if !defined(OS_CHROMEOS) 280 #if !defined(OS_CHROMEOS)
281 // Failing to load prefs on startup is a bad thing(TM). See bug 38352 for 281 // Failing to load prefs on startup is a bad thing(TM). See bug 38352 for
282 // an example problem that this can cause. 282 // an example problem that this can cause.
283 // Do some diagnosis and try to avoid losing data. 283 // Do some diagnosis and try to avoid losing data.
284 int message_id = 0; 284 int message_id = 0;
285 if (error <= PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE) { 285 if (error <= PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE ||
286 error == PersistentPrefStore::PREF_READ_ERROR_LEVELDB_CORRUPTION) {
286 message_id = IDS_PREFERENCES_CORRUPT_ERROR; 287 message_id = IDS_PREFERENCES_CORRUPT_ERROR;
287 } else if (error != PersistentPrefStore::PREF_READ_ERROR_NO_FILE) { 288 } else if (error != PersistentPrefStore::PREF_READ_ERROR_NO_FILE) {
288 message_id = IDS_PREFERENCES_UNREADABLE_ERROR; 289 message_id = IDS_PREFERENCES_UNREADABLE_ERROR;
289 } 290 }
290 291
291 if (message_id) { 292 if (message_id) {
292 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 293 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
293 base::Bind(&ShowProfileErrorDialog, 294 base::Bind(&ShowProfileErrorDialog,
294 PROFILE_ERROR_PREFERENCES, 295 PROFILE_ERROR_PREFERENCES,
295 message_id)); 296 message_id));
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 497
497 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { 498 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
498 ProfilePrefStoreManager::RegisterProfilePrefs(registry); 499 ProfilePrefStoreManager::RegisterProfilePrefs(registry);
499 } 500 }
500 501
501 void RegisterPrefs(PrefRegistrySimple* registry) { 502 void RegisterPrefs(PrefRegistrySimple* registry) {
502 ProfilePrefStoreManager::RegisterPrefs(registry); 503 ProfilePrefStoreManager::RegisterPrefs(registry);
503 } 504 }
504 505
505 } // namespace chrome_prefs 506 } // namespace chrome_prefs
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698