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

Unified Diff: components/sync/engine_impl/syncer.cc

Issue 2916133002: [Sync] Support commit only types. (Closed)
Patch Set: Updates for pnoland. Created 3 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/sync/engine_impl/syncer.cc
diff --git a/components/sync/engine_impl/syncer.cc b/components/sync/engine_impl/syncer.cc
index ccdcb70598322dbde8c4856f474d2d60989c6666..60a2194e9f39ef827eb1ac5dc8ab8bd523c12230 100644
--- a/components/sync/engine_impl/syncer.cc
+++ b/components/sync/engine_impl/syncer.cc
@@ -114,14 +114,20 @@ bool Syncer::DownloadAndApplyUpdates(ModelTypeSet* request_types,
SyncCycle* cycle,
const GetUpdatesDelegate& delegate,
bool create_mobile_bookmarks_folder) {
+ ModelTypeSet add_for_commit = Intersection(*request_types, CommitOnlyTypes());
Patrick Noland 2017/06/01 22:58:48 This name made it harder for me to follow what you
skym 2017/06/01 23:15:21 Done.
+ ModelTypeSet download_types = Difference(*request_types, add_for_commit);
GetUpdatesProcessor get_updates_processor(
cycle->context()->model_type_registry()->update_handler_map(), delegate);
SyncerError download_result = UNSET;
do {
download_result = get_updates_processor.DownloadUpdates(
- request_types, cycle, create_mobile_bookmarks_folder);
+ &download_types, cycle, create_mobile_bookmarks_folder);
} while (download_result == SERVER_MORE_TO_DOWNLOAD);
+ // It is our responsibility to propagate the removal of types that occurred in
+ // GetUpdatesProcessor::DownloadUpdates().
+ *request_types = Union(download_types, add_for_commit);
+
// Exit without applying if we're shutting down or an error was detected.
if (download_result != SYNCER_OK || ExitRequested())
return false;
@@ -135,7 +141,7 @@ bool Syncer::DownloadAndApplyUpdates(ModelTypeSet* request_types,
// Apply updates to the other types. May or may not involve cross-thread
// traffic, depending on the underlying update handlers and the GU type's
// delegate.
- get_updates_processor.ApplyUpdates(*request_types,
+ get_updates_processor.ApplyUpdates(download_types,
cycle->mutable_status_controller());
cycle->context()->set_hierarchy_conflict_detected(

Powered by Google App Engine
This is Rietveld 408576698