OLD | NEW |
---|---|
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/pref_service.h" | 5 #include "chrome/browser/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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 PrefService::~PrefService() { | 218 PrefService::~PrefService() { |
219 DCHECK(CalledOnValidThread()); | 219 DCHECK(CalledOnValidThread()); |
220 STLDeleteContainerPointers(prefs_.begin(), prefs_.end()); | 220 STLDeleteContainerPointers(prefs_.begin(), prefs_.end()); |
221 prefs_.clear(); | 221 prefs_.clear(); |
222 | 222 |
223 // Reset pointers so accesses after destruction reliably crash. | 223 // Reset pointers so accesses after destruction reliably crash. |
224 pref_value_store_.reset(); | 224 pref_value_store_.reset(); |
225 user_pref_store_ = NULL; | 225 user_pref_store_ = NULL; |
226 default_store_ = NULL; | 226 default_store_ = NULL; |
227 pref_sync_associator_.reset(); | 227 pref_sync_associator_.reset(); |
228 pref_notifier_.reset(); | |
Bernhard Bauer
2012/06/08 13:08:46
I don't really understand. What does this change d
| |
228 } | 229 } |
229 | 230 |
230 void PrefService::InitFromStorage(bool async) { | 231 void PrefService::InitFromStorage(bool async) { |
231 if (!async) { | 232 if (!async) { |
232 ReadErrorHandler error_handler; | 233 ReadErrorHandler error_handler; |
233 error_handler.OnError(user_pref_store_->ReadPrefs()); | 234 error_handler.OnError(user_pref_store_->ReadPrefs()); |
234 } else { | 235 } else { |
235 // Guarantee that initialization happens after this function returned. | 236 // Guarantee that initialization happens after this function returned. |
236 MessageLoop::current()->PostTask( | 237 MessageLoop::current()->PostTask( |
237 FROM_HERE, | 238 FROM_HERE, |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
991 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); | 992 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); |
992 } | 993 } |
993 | 994 |
994 bool PrefService::Preference::IsUserModifiable() const { | 995 bool PrefService::Preference::IsUserModifiable() const { |
995 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); | 996 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); |
996 } | 997 } |
997 | 998 |
998 bool PrefService::Preference::IsExtensionModifiable() const { | 999 bool PrefService::Preference::IsExtensionModifiable() const { |
999 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); | 1000 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); |
1000 } | 1001 } |
OLD | NEW |