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

Unified Diff: components/invalidation/android/java/src/org/chromium/components/invalidation/InvalidationClientService.java

Issue 1144543009: [Android] Only invalidate objects that were received from Tango on resume. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase with upstream + Use Json Reader,Writer 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/android/java/src/org/chromium/components/invalidation/InvalidationClientService.java
diff --git a/components/invalidation/android/java/src/org/chromium/components/invalidation/InvalidationClientService.java b/components/invalidation/android/java/src/org/chromium/components/invalidation/InvalidationClientService.java
index ced6f51779917f020d6642cfe22afd7ef7a63ca9..f282b725bddfee0975a17006369b2f41dffb77b6 100644
--- a/components/invalidation/android/java/src/org/chromium/components/invalidation/InvalidationClientService.java
+++ b/components/invalidation/android/java/src/org/chromium/components/invalidation/InvalidationClientService.java
@@ -116,13 +116,13 @@ public class InvalidationClientService extends AndroidListener {
@Override
public void invalidateUnknownVersion(ObjectId objectId, byte[] ackHandle) {
- requestSync(objectId, null, null);
+ requestSync(objectId, 0L, null);
acknowledge(ackHandle);
}
@Override
public void invalidateAll(byte[] ackHandle) {
- requestSync(null, null, null);
+ requestSync(null, 0L, null);
acknowledge(ackHandle);
}
@@ -426,23 +426,15 @@ public class InvalidationClientService extends AndroidListener {
* @param version the version of the object that changed, if known.
* @param payload the payload of the change, if known.
*/
- private void requestSync(@Nullable ObjectId objectId, @Nullable Long version,
- @Nullable String payload) {
- // Construct the bundle to supply to the native sync code.
- Bundle bundle = new Bundle();
- if (objectId == null && version == null && payload == null) {
- // Use an empty bundle in this case for compatibility with the v1 implementation.
- } else {
- if (objectId != null) {
- bundle.putInt("objectSource", objectId.getSource());
- bundle.putString("objectId", new String(objectId.getName()));
- }
- // We use "0" as the version if we have an unknown-version invalidation. This is OK
- // because the native sync code special-cases zero and always syncs for invalidations at
- // that version (Tango defines a special UNKNOWN_VERSION constant with this value).
- bundle.putLong("version", (version == null) ? 0 : version);
- bundle.putString("payload", (payload == null) ? "" : payload);
+ private void requestSync(@Nullable ObjectId objectId, Long version, @Nullable String payload) {
+ int objectSource = 0;
+ String objectName = null;
+ if (objectId != null) {
+ objectName = new String(objectId.getName());
+ objectSource = objectId.getSource();
}
+ Bundle bundle =
+ (new PendingInvalidation(objectName, objectSource, version, payload)).toBundle();
Account account = ChromeSigninController.get(this).getSignedInUser();
String contractAuthority = AndroidSyncSettings.getContractAuthority(this);
requestSyncFromContentResolver(bundle, account, contractAuthority);

Powered by Google App Engine
This is Rietveld 408576698