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

Side by Side Diff: base/prefs/pref_service.cc

Issue 25428002: LevelDBPrefStore Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: latest Created 6 years, 10 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/migration_pref_store.h ('k') | no next file » | 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 "base/prefs/pref_service.h" 5 #include "base/prefs/pref_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 DCHECK(CalledOnValidThread()); 253 DCHECK(CalledOnValidThread());
254 254
255 const Preference* pref = FindPreference(path); 255 const Preference* pref = FindPreference(path);
256 if (!pref) { 256 if (!pref) {
257 NOTREACHED() << "Trying to get an unregistered pref: " << path; 257 NOTREACHED() << "Trying to get an unregistered pref: " << path;
258 return NULL; 258 return NULL;
259 } 259 }
260 260
261 // Look for an existing preference in the user store. If it doesn't 261 // Look for an existing preference in the user store. If it doesn't
262 // exist, return NULL. 262 // exist, return NULL.
263 base::Value* value = NULL; 263 const base::Value* value = NULL;
264 if (!user_pref_store_->GetMutableValue(path, &value)) 264 if (!user_pref_store_->GetValue(path, &value))
265 return NULL; 265 return NULL;
266 266
267 if (!value->IsType(pref->GetType())) { 267 if (!value->IsType(pref->GetType())) {
268 NOTREACHED() << "Pref value type doesn't match registered type."; 268 NOTREACHED() << "Pref value type doesn't match registered type.";
269 return NULL; 269 return NULL;
270 } 270 }
271 271
272 return value; 272 return value;
273 } 273 }
274 274
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 DCHECK(found_value->IsType(default_type)); 544 DCHECK(found_value->IsType(default_type));
545 return found_value; 545 return found_value;
546 } else { 546 } else {
547 // Every registered preference has at least a default value. 547 // Every registered preference has at least a default value.
548 NOTREACHED() << "no valid value found for registered pref " << path; 548 NOTREACHED() << "no valid value found for registered pref " << path;
549 } 549 }
550 } 550 }
551 551
552 return NULL; 552 return NULL;
553 } 553 }
OLDNEW
« no previous file with comments | « base/prefs/migration_pref_store.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698