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

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

Issue 205813002: Separate storage for protected preferences into Protected Preferences file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pp4_profile_pref_store
Patch Set: Revert code that breaks tests, commit what works. Created 6 years, 8 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
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 DCHECK(CalledOnValidThread()); 60 DCHECK(CalledOnValidThread());
61 61
62 // Reset pointers so accesses after destruction reliably crash. 62 // Reset pointers so accesses after destruction reliably crash.
63 pref_value_store_.reset(); 63 pref_value_store_.reset();
64 pref_registry_ = NULL; 64 pref_registry_ = NULL;
65 user_pref_store_ = NULL; 65 user_pref_store_ = NULL;
66 pref_notifier_.reset(); 66 pref_notifier_.reset();
67 } 67 }
68 68
69 void PrefService::InitFromStorage(bool async) { 69 void PrefService::InitFromStorage(bool async) {
70 if (!async) { 70 if (user_pref_store_->IsInitializationComplete()) {
71 read_error_callback_.Run(user_pref_store_->GetReadError());
72 } else if (!async) {
71 read_error_callback_.Run(user_pref_store_->ReadPrefs()); 73 read_error_callback_.Run(user_pref_store_->ReadPrefs());
72 } else { 74 } else {
73 // Guarantee that initialization happens after this function returned. 75 // Guarantee that initialization happens after this function returned.
74 base::MessageLoop::current()->PostTask( 76 base::MessageLoop::current()->PostTask(
75 FROM_HERE, 77 FROM_HERE,
76 base::Bind(&PersistentPrefStore::ReadPrefsAsync, 78 base::Bind(&PersistentPrefStore::ReadPrefsAsync,
77 user_pref_store_.get(), 79 user_pref_store_.get(),
78 new ReadErrorHandler(read_error_callback_))); 80 new ReadErrorHandler(read_error_callback_)));
79 } 81 }
80 } 82 }
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 DCHECK(found_value->IsType(default_type)); 546 DCHECK(found_value->IsType(default_type));
545 return found_value; 547 return found_value;
546 } else { 548 } else {
547 // Every registered preference has at least a default value. 549 // Every registered preference has at least a default value.
548 NOTREACHED() << "no valid value found for registered pref " << path; 550 NOTREACHED() << "no valid value found for registered pref " << path;
549 } 551 }
550 } 552 }
551 553
552 return NULL; 554 return NULL;
553 } 555 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prefs/pref_hash_filter.h » ('j') | chrome/browser/prefs/pref_hash_filter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698