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

Unified Diff: components/invalidation/invalidator_registrar.cc

Issue 1146533005: [Sync] InvalidationService shouldn't CHECK when registering ObjectId for more than one handler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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: components/invalidation/invalidator_registrar.cc
diff --git a/components/invalidation/invalidator_registrar.cc b/components/invalidation/invalidator_registrar.cc
index 9ee6a94fbdaff6dc14a02c9db2eef4f94e180bec..21df5bdfc91f9dc629ae39b151c80ff24c38d6b6 100644
--- a/components/invalidation/invalidator_registrar.cc
+++ b/components/invalidation/invalidator_registrar.cc
@@ -28,9 +28,8 @@ void InvalidatorRegistrar::RegisterHandler(InvalidationHandler* handler) {
handlers_.AddObserver(handler);
}
-void InvalidatorRegistrar::UpdateRegisteredIds(
- InvalidationHandler* handler,
- const ObjectIdSet& ids) {
+bool InvalidatorRegistrar::UpdateRegisteredIds(InvalidationHandler* handler,
+ const ObjectIdSet& ids) {
DCHECK(thread_checker_.CalledOnValidThread());
CHECK(handler);
CHECK(handlers_.HasObserver(handler));
@@ -47,11 +46,12 @@ void InvalidatorRegistrar::UpdateRegisteredIds(
ids.begin(), ids.end(),
std::inserter(intersection, intersection.end()),
ObjectIdLessThan());
- CHECK(intersection.empty())
- << "Duplicate registration: trying to register "
- << ObjectIdToString(*intersection.begin()) << " for "
- << handler << " when it's already registered for "
- << it->first;
+ if (!intersection.empty()) {
+ DVLOG(0) << "Duplicate registration: trying to register "
maniscalco 2015/05/18 15:42:28 Can you walk me through the thought process on the
pavely 2015/05/18 18:38:04 I think LOG(ERROR) and DVLOG(0) have the same effe
maniscalco 2015/05/18 18:56:05 Cool. As we discussed offline, the V in DVLOG sta
+ << ObjectIdToString(*intersection.begin()) << " for " << handler
+ << " when it's already registered for " << it->first;
+ return false;
+ }
}
if (ids.empty()) {
@@ -59,6 +59,7 @@ void InvalidatorRegistrar::UpdateRegisteredIds(
} else {
handler_to_ids_map_[handler] = ids;
}
+ return true;
}
void InvalidatorRegistrar::UnregisterHandler(InvalidationHandler* handler) {

Powered by Google App Engine
This is Rietveld 408576698