| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "services/preferences/persistent_pref_store_impl.h" | 5 #include "services/preferences/persistent_pref_store_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 // If true then a write is in progress and any update notifications should be | 68 // If true then a write is in progress and any update notifications should be |
| 69 // ignored, as those updates would originate from ourselves. | 69 // ignored, as those updates would originate from ourselves. |
| 70 bool write_in_progress_ = false; | 70 bool write_in_progress_ = false; |
| 71 | 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(Connection); | 72 DISALLOW_COPY_AND_ASSIGN(Connection); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 PersistentPrefStoreImpl::PersistentPrefStoreImpl( | 75 PersistentPrefStoreImpl::PersistentPrefStoreImpl( |
| 76 scoped_refptr<PersistentPrefStore> backing_pref_store, | 76 scoped_refptr<PersistentPrefStore> backing_pref_store, |
| 77 mojom::TrackedPreferenceValidationDelegatePtr validation_delegate, | |
| 78 base::OnceClosure on_initialized) | 77 base::OnceClosure on_initialized) |
| 79 : backing_pref_store_(backing_pref_store), | 78 : backing_pref_store_(backing_pref_store) { |
| 80 validation_delegate_(std::move(validation_delegate)) { | |
| 81 backing_pref_store_->AddObserver(this); | 79 backing_pref_store_->AddObserver(this); |
| 82 if (!backing_pref_store_->IsInitializationComplete()) { | 80 if (!backing_pref_store_->IsInitializationComplete()) { |
| 83 on_initialized_ = std::move(on_initialized); | 81 on_initialized_ = std::move(on_initialized); |
| 84 initializing_ = true; | 82 initializing_ = true; |
| 85 backing_pref_store_->ReadPrefsAsync(nullptr); | 83 backing_pref_store_->ReadPrefsAsync(nullptr); |
| 86 } | 84 } |
| 87 } | 85 } |
| 88 | 86 |
| 89 PersistentPrefStoreImpl::~PersistentPrefStoreImpl() { | 87 PersistentPrefStoreImpl::~PersistentPrefStoreImpl() { |
| 90 backing_pref_store_->RemoveObserver(this); | 88 backing_pref_store_->RemoveObserver(this); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 151 |
| 154 void PersistentPrefStoreImpl::ClearMutableValues() { | 152 void PersistentPrefStoreImpl::ClearMutableValues() { |
| 155 backing_pref_store_->ClearMutableValues(); | 153 backing_pref_store_->ClearMutableValues(); |
| 156 } | 154 } |
| 157 | 155 |
| 158 void PersistentPrefStoreImpl::OnConnectionError(Connection* connection) { | 156 void PersistentPrefStoreImpl::OnConnectionError(Connection* connection) { |
| 159 connections_.erase(connection); | 157 connections_.erase(connection); |
| 160 } | 158 } |
| 161 | 159 |
| 162 } // namespace prefs | 160 } // namespace prefs |
| OLD | NEW |