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

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

Issue 6995008: Implement new SyncAPI and convert Preferences to it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and fix compile Created 9 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
« no previous file with comments | « chrome/browser/prefs/pref_model_associator.cc ('k') | chrome/browser/sync/api/sync_change.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/pref_service.h" 5 #include "chrome/browser/prefs/pref_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 PrefService::~PrefService() { 206 PrefService::~PrefService() {
207 DCHECK(CalledOnValidThread()); 207 DCHECK(CalledOnValidThread());
208 STLDeleteContainerPointers(prefs_.begin(), prefs_.end()); 208 STLDeleteContainerPointers(prefs_.begin(), prefs_.end());
209 prefs_.clear(); 209 prefs_.clear();
210 210
211 // Reset pointers so accesses after destruction reliably crash. 211 // Reset pointers so accesses after destruction reliably crash.
212 pref_value_store_.reset(); 212 pref_value_store_.reset();
213 user_pref_store_ = NULL; 213 user_pref_store_ = NULL;
214 default_store_ = NULL; 214 default_store_ = NULL;
215 if (pref_sync_associator_.get())
216 pref_sync_associator_->DisassociateModels();
217 pref_sync_associator_.reset(); 215 pref_sync_associator_.reset();
218 } 216 }
219 217
220 void PrefService::InitFromStorage(bool async) { 218 void PrefService::InitFromStorage(bool async) {
221 if (!async) { 219 if (!async) {
222 ReadErrorHandler error_handler; 220 ReadErrorHandler error_handler;
223 error_handler.OnError(user_pref_store_->ReadPrefs()); 221 error_handler.OnError(user_pref_store_->ReadPrefs());
224 } else { 222 } else {
225 // Guarantee that initialization happens after this function returned. 223 // Guarantee that initialization happens after this function returned.
226 MessageLoop::current()->PostTask( 224 MessageLoop::current()->PostTask(
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); 892 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str());
895 } 893 }
896 894
897 bool PrefService::Preference::IsUserModifiable() const { 895 bool PrefService::Preference::IsUserModifiable() const {
898 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); 896 return pref_value_store()->PrefValueUserModifiable(name_.c_str());
899 } 897 }
900 898
901 bool PrefService::Preference::IsExtensionModifiable() const { 899 bool PrefService::Preference::IsExtensionModifiable() const {
902 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); 900 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str());
903 } 901 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_model_associator.cc ('k') | chrome/browser/sync/api/sync_change.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698