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, |
77 base::OnceClosure on_initialized) | 78 base::OnceClosure on_initialized) |
78 : backing_pref_store_(backing_pref_store) { | 79 : backing_pref_store_(backing_pref_store), |
| 80 validation_delegate_(std::move(validation_delegate)) { |
79 backing_pref_store_->AddObserver(this); | 81 backing_pref_store_->AddObserver(this); |
80 if (!backing_pref_store_->IsInitializationComplete()) { | 82 if (!backing_pref_store_->IsInitializationComplete()) { |
81 on_initialized_ = std::move(on_initialized); | 83 on_initialized_ = std::move(on_initialized); |
82 initializing_ = true; | 84 initializing_ = true; |
83 backing_pref_store_->ReadPrefsAsync(nullptr); | 85 backing_pref_store_->ReadPrefsAsync(nullptr); |
84 } | 86 } |
85 } | 87 } |
86 | 88 |
87 PersistentPrefStoreImpl::~PersistentPrefStoreImpl() { | 89 PersistentPrefStoreImpl::~PersistentPrefStoreImpl() { |
88 backing_pref_store_->RemoveObserver(this); | 90 backing_pref_store_->RemoveObserver(this); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 153 |
152 void PersistentPrefStoreImpl::ClearMutableValues() { | 154 void PersistentPrefStoreImpl::ClearMutableValues() { |
153 backing_pref_store_->ClearMutableValues(); | 155 backing_pref_store_->ClearMutableValues(); |
154 } | 156 } |
155 | 157 |
156 void PersistentPrefStoreImpl::OnConnectionError(Connection* connection) { | 158 void PersistentPrefStoreImpl::OnConnectionError(Connection* connection) { |
157 connections_.erase(connection); | 159 connections_.erase(connection); |
158 } | 160 } |
159 | 161 |
160 } // namespace prefs | 162 } // namespace prefs |
OLD | NEW |