Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(570)

Unified Diff: services/preferences/public/cpp/pref_store_manager_impl.cc

Issue 2762333003: Pref service: add a factory to create the client lib (Closed)
Patch Set: Address more review comments from sammc@ Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: services/preferences/public/cpp/pref_store_manager_impl.cc
diff --git a/services/preferences/public/cpp/pref_store_manager_impl.cc b/services/preferences/public/cpp/pref_store_manager_impl.cc
index 56846c39ca2b6ed880235fb5da690edd39839ecc..6ae0689e44e272f93f0d333f9519c0c2cf869dbf 100644
--- a/services/preferences/public/cpp/pref_store_manager_impl.cc
+++ b/services/preferences/public/cpp/pref_store_manager_impl.cc
@@ -58,6 +58,12 @@ void ConnectionBarrier::Create(const PrefStorePtrs& pref_store_ptrs,
}
void ConnectionBarrier::Init(const PrefStorePtrs& pref_store_ptrs) {
+ if (expected_connections_ == 0) {
+ // Degenerate case. We don't expect this, but it could happen in
+ // e.g. testing.
+ callback_.Run(std::move(connections_));
+ return;
+ }
for (const auto& ptr : pref_store_ptrs) {
ptr.second->AddObserver(
base::Bind(&ConnectionBarrier::OnConnect, this, ptr.first));

Powered by Google App Engine
This is Rietveld 408576698