| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/cronet/android/cronet_in_memory_pref_store.h" | 5 #include "components/cronet/android/cronet_in_memory_pref_store.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "base/values.h" | 10 #include "base/values.h" |
| 9 | 11 |
| 10 CronetInMemoryPrefStore::CronetInMemoryPrefStore() {} | 12 CronetInMemoryPrefStore::CronetInMemoryPrefStore() {} |
| 11 | 13 |
| 12 CronetInMemoryPrefStore::~CronetInMemoryPrefStore() {} | 14 CronetInMemoryPrefStore::~CronetInMemoryPrefStore() {} |
| 13 | 15 |
| 14 bool CronetInMemoryPrefStore::GetValue(const std::string& key, | 16 bool CronetInMemoryPrefStore::GetValue(const std::string& key, |
| 15 const base::Value** value) const { | 17 const base::Value** value) const { |
| 16 return prefs_.GetValue(key, value); | 18 return prefs_.GetValue(key, value); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 34 } | 36 } |
| 35 | 37 |
| 36 bool CronetInMemoryPrefStore::IsInitializationComplete() const { | 38 bool CronetInMemoryPrefStore::IsInitializationComplete() const { |
| 37 return true; | 39 return true; |
| 38 } | 40 } |
| 39 | 41 |
| 40 void CronetInMemoryPrefStore::SetValue(const std::string& key, | 42 void CronetInMemoryPrefStore::SetValue(const std::string& key, |
| 41 scoped_ptr<base::Value> value, | 43 scoped_ptr<base::Value> value, |
| 42 uint32_t flags) { | 44 uint32_t flags) { |
| 43 DCHECK(value); | 45 DCHECK(value); |
| 44 if (prefs_.SetValue(key, value.Pass())) | 46 if (prefs_.SetValue(key, std::move(value))) |
| 45 ReportValueChanged(key, flags); | 47 ReportValueChanged(key, flags); |
| 46 } | 48 } |
| 47 | 49 |
| 48 void CronetInMemoryPrefStore::SetValueSilently(const std::string& key, | 50 void CronetInMemoryPrefStore::SetValueSilently(const std::string& key, |
| 49 scoped_ptr<base::Value> value, | 51 scoped_ptr<base::Value> value, |
| 50 uint32_t flags) { | 52 uint32_t flags) { |
| 51 prefs_.SetValue(key, value.Pass()); | 53 prefs_.SetValue(key, std::move(value)); |
| 52 } | 54 } |
| 53 | 55 |
| 54 void CronetInMemoryPrefStore::RemoveValue(const std::string& key, | 56 void CronetInMemoryPrefStore::RemoveValue(const std::string& key, |
| 55 uint32_t flags) { | 57 uint32_t flags) { |
| 56 if (prefs_.RemoveValue(key)) | 58 if (prefs_.RemoveValue(key)) |
| 57 ReportValueChanged(key, flags); | 59 ReportValueChanged(key, flags); |
| 58 } | 60 } |
| 59 | 61 |
| 60 bool CronetInMemoryPrefStore::ReadOnly() const { | 62 bool CronetInMemoryPrefStore::ReadOnly() const { |
| 61 return false; | 63 return false; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 72 | 74 |
| 73 void CronetInMemoryPrefStore::ReadPrefsAsync( | 75 void CronetInMemoryPrefStore::ReadPrefsAsync( |
| 74 ReadErrorDelegate* error_delegate_raw) { | 76 ReadErrorDelegate* error_delegate_raw) { |
| 75 } | 77 } |
| 76 | 78 |
| 77 void CronetInMemoryPrefStore::ReportValueChanged(const std::string& key, | 79 void CronetInMemoryPrefStore::ReportValueChanged(const std::string& key, |
| 78 uint32_t flags) { | 80 uint32_t flags) { |
| 79 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); | 81 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); |
| 80 } | 82 } |
| 81 | 83 |
| OLD | NEW |