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

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: Close the database after each test Created 6 years, 6 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
« no previous file with comments | « base/prefs/persistent_pref_store.h ('k') | chrome/browser/prefs/leveldb_pref_store.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 // baseline on the success rate in addition to the error distribution. 306 // baseline on the success rate in addition to the error distribution.
307 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, 307 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error,
308 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM); 308 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM);
309 309
310 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) { 310 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) {
311 #if !defined(OS_CHROMEOS) 311 #if !defined(OS_CHROMEOS)
312 // Failing to load prefs on startup is a bad thing(TM). See bug 38352 for 312 // Failing to load prefs on startup is a bad thing(TM). See bug 38352 for
313 // an example problem that this can cause. 313 // an example problem that this can cause.
314 // Do some diagnosis and try to avoid losing data. 314 // Do some diagnosis and try to avoid losing data.
315 int message_id = 0; 315 int message_id = 0;
316 if (error <= PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE) { 316 if (error <= PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE ||
317 error == PersistentPrefStore::PREF_READ_ERROR_LEVELDB_CORRUPTION) {
317 message_id = IDS_PREFERENCES_CORRUPT_ERROR; 318 message_id = IDS_PREFERENCES_CORRUPT_ERROR;
318 } else if (error != PersistentPrefStore::PREF_READ_ERROR_NO_FILE) { 319 } else if (error != PersistentPrefStore::PREF_READ_ERROR_NO_FILE) {
319 message_id = IDS_PREFERENCES_UNREADABLE_ERROR; 320 message_id = IDS_PREFERENCES_UNREADABLE_ERROR;
320 } 321 }
321 322
322 if (message_id) { 323 if (message_id) {
323 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 324 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
324 base::Bind(&ShowProfileErrorDialog, 325 base::Bind(&ShowProfileErrorDialog,
325 PROFILE_ERROR_PREFERENCES, 326 PROFILE_ERROR_PREFERENCES,
326 message_id)); 327 message_id));
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 537
537 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { 538 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
538 ProfilePrefStoreManager::RegisterProfilePrefs(registry); 539 ProfilePrefStoreManager::RegisterProfilePrefs(registry);
539 } 540 }
540 541
541 void RegisterPrefs(PrefRegistrySimple* registry) { 542 void RegisterPrefs(PrefRegistrySimple* registry) {
542 ProfilePrefStoreManager::RegisterPrefs(registry); 543 ProfilePrefStoreManager::RegisterPrefs(registry);
543 } 544 }
544 545
545 } // namespace chrome_prefs 546 } // namespace chrome_prefs
OLDNEW
« no previous file with comments | « base/prefs/persistent_pref_store.h ('k') | chrome/browser/prefs/leveldb_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698