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; |