Index: chrome/browser/sync/engine/syncapi.cc |
=================================================================== |
--- chrome/browser/sync/engine/syncapi.cc (revision 71029) |
+++ chrome/browser/sync/engine/syncapi.cc (working copy) |
@@ -2242,21 +2242,32 @@ |
void SyncManager::SyncInternal::OnIncomingNotification( |
const IncomingNotificationData& notification_data) { |
syncable::ModelTypeBitSet model_types; |
+ std::vector<std::string> payloads; |
// Check if the service url is a sync URL. An empty service URL is |
// treated as a legacy sync notification. If we're listening to |
// server-issued notifications, no need to check the service_url. |
if (notifier_options_.notification_method == |
notifier::NOTIFICATION_SERVER) { |
- VLOG(1) << "Sync received server notification: " << |
+ VLOG(1) << "Sync received server notification from " << |
+ notification_data.service_url << ": " << |
notification_data.service_specific_data; |
if (!syncable::ModelTypeBitSetFromString( |
- notification_data.service_specific_data, |
+ notification_data.service_url, |
&model_types)) { |
LOG(DFATAL) << "Could not extract model types from server data."; |
model_types.set(); |
} |
+ if (!notification_data.service_specific_data.empty()) { |
+ payloads.resize(model_types.size()); |
+ for (size_t i = syncable::FIRST_REAL_MODEL_TYPE; |
+ i < model_types.size(); |
+ ++i) { |
+ if (model_types[i]) |
+ payloads[i] = notification_data.service_specific_data; |
+ } |
+ } |
} else if (notification_data.service_url.empty() || |
(notification_data.service_url == |
browser_sync::kSyncLegacyServiceUrl) || |
@@ -2272,12 +2283,22 @@ |
} |
if (model_types.any()) { |
+ // Introduce a delay to help coalesce initial notifications. |
+ int milliseconds_from_now = 250; |
if (syncer_thread()) { |
- // Introduce a delay to help coalesce initial notifications. |
- syncer_thread()->NudgeSyncerWithDataTypes( |
- 250, |
- SyncerThread::kNotification, |
- model_types); |
+ // If this notification had a payload, pass it along, else just pass the |
+ // datatypes that triggered the notification. |
+ if (notification_data.service_specific_data.empty()) { |
+ syncer_thread()->NudgeSyncerWithDataTypes( |
+ milliseconds_from_now, |
+ SyncerThread::kNotification, |
+ model_types); |
+ } else { |
+ syncer_thread()->NudgeSyncerWithPayloads( |
+ milliseconds_from_now, |
+ SyncerThread::kNotification, |
+ payloads); |
+ } |
} |
allstatus_.IncrementNotificationsReceived(); |
} else { |