| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |