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

Unified Diff: sync/engine/directory_update_handler.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/directory_update_handler.cc
diff --git a/sync/engine/directory_update_handler.cc b/sync/engine/directory_update_handler.cc
index 9d97765195fc1064861d9cef1064b90d276b2a6d..a2cc73c1b50632ed892353aa234903a84a1a1e19 100644
--- a/sync/engine/directory_update_handler.cc
+++ b/sync/engine/directory_update_handler.cc
@@ -31,6 +31,11 @@ void DirectoryUpdateHandler::GetDownloadProgress(
dir_->GetDownloadProgress(type_, progress_marker);
}
+void DirectoryUpdateHandler::GetDataTypeContext(
+ sync_pb::DataTypeContext* context) const {
+ dir_->GetDataTypeContext(type_, context);
+}
+
void DirectoryUpdateHandler::ProcessGetUpdatesResponse(
const sync_pb::DataTypeProgressMarker& progress_marker,
const SyncEntityList& applicable_updates,
@@ -44,6 +49,20 @@ void DirectoryUpdateHandler::ProcessGetUpdatesResponse(
}
}
+void DirectoryUpdateHandler::ProcessDataTypeContextMutation(
rlarocque 2014/04/03 17:31:58 Does the context need to be updated atomically wit
Nicolas Zea 2014/04/03 22:56:47 Done.
+ const sync_pb::DataTypeContext& mutated_context) {
+ sync_pb::DataTypeContext local_context;
+ dir_->GetDataTypeContext(type_, &local_context);
+
+ // Only update the local context if it is still relevant. If the local version
+ // is higher, it means a local change happened while the mutation was in
+ // flight, and the local context takes priority.
+ if (mutated_context.version() >= local_context.version()) {
+ dir_->SetDataTypeContext(type_, mutated_context);
+ // TODO(zea): trigger the datatype's UpdateDataTypeContext method.
+ }
+}
+
void DirectoryUpdateHandler::ApplyUpdates(sessions::StatusController* status) {
if (!IsApplyUpdatesRequired()) {
return;

Powered by Google App Engine
This is Rietveld 408576698