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

Unified Diff: sync/engine/get_updates_processor.cc

Issue 215973007: [Sync] Add plumbing of context from client to server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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: sync/engine/get_updates_processor.cc
diff --git a/sync/engine/get_updates_processor.cc b/sync/engine/get_updates_processor.cc
index eb1d7be2e82987f9cff188b52a485e0f260421d7..d94f12cfa82ab5858e5bf444e92cd2419031e730 100644
--- a/sync/engine/get_updates_processor.cc
+++ b/sync/engine/get_updates_processor.cc
@@ -178,7 +178,13 @@ void GetUpdatesProcessor::PrepareGetUpdates(
get_updates->add_from_progress_marker();
handler_it->second->GetDownloadProgress(progress_marker);
progress_marker->clear_gc_directive();
+
+ sync_pb::DataTypeContext context;
+ handler_it->second->GetDataTypeContext(&context);
+ if (!context.context().empty())
+ get_updates->add_client_contexts()->Swap(&context);
}
+
delegate_.HelpPopulateGuMessage(get_updates);
}
@@ -314,6 +320,28 @@ bool GetUpdatesProcessor::ProcessGetUpdatesResponse(
DCHECK(progress_marker_iter == progress_index_by_type.end() &&
updates_iter == updates_by_type.end());
+ for (int i = 0; i < gu_response.context_mutations_size(); ++i) {
+ const sync_pb::DataTypeContext& context = gu_response.context_mutations(i);
+ syncer::ModelType type =
+ GetModelTypeFromSpecificsFieldNumber(context.type());
+ if (!syncer::IsRealDataType(type)) {
+ DLOG(WARNING) << "Received datatype context mutation with invalid type.";
+ continue;
+ }
+
+ UpdateHandlerMap::iterator update_handler_iter =
+ update_handler_map_->find(type);
+
+ if (update_handler_iter != update_handler_map_->end()) {
+ update_handler_iter->second->ProcessDataTypeContextMutation(context);
+ } else {
+ DLOG(WARNING)
+ << "Ignoring received context mutations of a type we can't handle. "
+ << "Type is: " << ModelTypeToString(type);
+ continue;
+ }
+ }
+
return true;
}

Powered by Google App Engine
This is Rietveld 408576698