| 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 "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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 base::Bind(&PersistentPrefStore::ReadPrefsAsync, user_pref_store_.get(), | 99 base::Bind(&PersistentPrefStore::ReadPrefsAsync, user_pref_store_.get(), |
| 100 new ReadErrorHandler(read_error_callback_))); | 100 new ReadErrorHandler(read_error_callback_))); |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 void PrefService::CommitPendingWrite() { | 104 void PrefService::CommitPendingWrite() { |
| 105 DCHECK(CalledOnValidThread()); | 105 DCHECK(CalledOnValidThread()); |
| 106 user_pref_store_->CommitPendingWrite(); | 106 user_pref_store_->CommitPendingWrite(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void PrefService::SchedulePendingLossyWrites() { |
| 110 DCHECK(CalledOnValidThread()); |
| 111 user_pref_store_->SchedulePendingLossyWrites(); |
| 112 } |
| 113 |
| 109 bool PrefService::GetBoolean(const std::string& path) const { | 114 bool PrefService::GetBoolean(const std::string& path) const { |
| 110 DCHECK(CalledOnValidThread()); | 115 DCHECK(CalledOnValidThread()); |
| 111 | 116 |
| 112 bool result = false; | 117 bool result = false; |
| 113 | 118 |
| 114 const base::Value* value = GetPreferenceValue(path); | 119 const base::Value* value = GetPreferenceValue(path); |
| 115 if (!value) { | 120 if (!value) { |
| 116 NOTREACHED() << "Trying to read an unregistered pref: " << path; | 121 NOTREACHED() << "Trying to read an unregistered pref: " << path; |
| 117 return result; | 122 return result; |
| 118 } | 123 } |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 DCHECK(found_value->IsType(default_type)); | 605 DCHECK(found_value->IsType(default_type)); |
| 601 return found_value; | 606 return found_value; |
| 602 } else { | 607 } else { |
| 603 // Every registered preference has at least a default value. | 608 // Every registered preference has at least a default value. |
| 604 NOTREACHED() << "no valid value found for registered pref " << path; | 609 NOTREACHED() << "no valid value found for registered pref " << path; |
| 605 } | 610 } |
| 606 } | 611 } |
| 607 | 612 |
| 608 return NULL; | 613 return NULL; |
| 609 } | 614 } |
| OLD | NEW |