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

Unified Diff: sync/android/java/src/org/chromium/sync/notifier/InvalidationService.java

Issue 22642004: Ensure we never try to register for the object id "NULL" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 7 years, 4 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: sync/android/java/src/org/chromium/sync/notifier/InvalidationService.java
diff --git a/sync/android/java/src/org/chromium/sync/notifier/InvalidationService.java b/sync/android/java/src/org/chromium/sync/notifier/InvalidationService.java
index 92ac257bc703fed16bd300c08462040643cb0ffe..963c4177c6388bf72359bb474b537e880e6e24c3 100644
--- a/sync/android/java/src/org/chromium/sync/notifier/InvalidationService.java
+++ b/sync/android/java/src/org/chromium/sync/notifier/InvalidationService.java
@@ -292,16 +292,8 @@ public class InvalidationService extends AndroidListener {
@VisibleForTesting
Set<ObjectId> readRegistrationsFromPrefs() {
Set<String> savedTypes = new InvalidationPreferences(this).getSavedSyncedTypes();
- if (savedTypes == null) {
- return Collections.emptySet();
- } else {
- Set<ModelType> modelTypes = ModelType.syncTypesToModelTypes(savedTypes);
- Set<ObjectId> objectIds = Sets.newHashSetWithExpectedSize(modelTypes.size());
- for (ModelType modelType : modelTypes) {
- objectIds.add(modelType.toObjectId());
- }
- return objectIds;
- }
+ if (savedTypes == null) return Collections.emptySet();
+ else return ModelType.syncTypesToObjectIds(savedTypes);
}
/**
@@ -337,13 +329,11 @@ public class InvalidationService extends AndroidListener {
// expansion of the ALL_TYPES_TYPE wildcard.
// NOTE: syncTypes MUST NOT be used below this line, since it contains an unexpanded
// wildcard.
- Set<ModelType> newRegisteredTypes = ModelType.syncTypesToModelTypes(syncTypes);
-
List<ObjectId> unregistrations = Lists.newArrayList();
List<ObjectId> registrations = Lists.newArrayList();
computeRegistrationOps(existingRegistrations,
- ModelType.modelTypesToObjectIds(newRegisteredTypes), registrations,
- unregistrations);
+ ModelType.syncTypesToObjectIds(syncTypes),
+ registrations, unregistrations);
unregister(sClientId, unregistrations);
register(sClientId, registrations);
}

Powered by Google App Engine
This is Rietveld 408576698