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

Side by Side Diff: components/sync/engine_impl/syncer.cc

Issue 2804743004: [Sync] Restrict types to configure to only include registered types (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync/engine_impl/syncer.h" 5 #include "components/sync/engine_impl/syncer.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 cycle->mutable_status_controller()->set_commit_result(commit_result); 72 cycle->mutable_status_controller()->set_commit_result(commit_result);
73 73
74 return HandleCycleEnd(cycle, nudge_tracker->GetLegacySource()); 74 return HandleCycleEnd(cycle, nudge_tracker->GetLegacySource());
75 } 75 }
76 76
77 bool Syncer::ConfigureSyncShare( 77 bool Syncer::ConfigureSyncShare(
78 ModelTypeSet request_types, 78 ModelTypeSet request_types,
79 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, 79 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
80 SyncCycle* cycle) { 80 SyncCycle* cycle) {
81 base::AutoReset<bool> is_syncing(&is_syncing_, true); 81 base::AutoReset<bool> is_syncing(&is_syncing_, true);
82 VLOG(1) << "Configuring types " << ModelTypeSetToString(request_types); 82 VLOG(1) << "Configuring types " << ModelTypeSetToString(request_types);
skym 2017/04/06 22:27:45 I know this isn't you, but this line is now someti
pavely 2017/04/06 23:48:25 You are right. Moving RetainAll above this line.
83 HandleCycleBegin(cycle); 83 HandleCycleBegin(cycle);
84 ConfigureGetUpdatesDelegate configure_delegate(source); 84 ConfigureGetUpdatesDelegate configure_delegate(source);
85 85
86 // It is possible during shutdown that datatypes get unregistered from 86 // It is possible during configuration that datatypes get unregistered from
87 // ModelTypeRegistry before scheduled configure sync cycle gets executed. 87 // ModelTypeRegistry before scheduled configure sync cycle gets executed.
88 // When it happens we should adjust set of types to download to only include 88 // This happens either because DataTypeController::LoadModels fail and type
89 // need to be stopped or during shutdown when all datatypes are stopped. When
90 // it happens we should adjust set of types to download to only include
89 // registered types. 91 // registered types.
90 if (cancelation_signal_->IsSignalled()) 92 request_types.RetainAll(cycle->context()->GetEnabledTypes());
skym 2017/04/06 22:27:45 What do you think of moving this to https://cs.chr
pavely 2017/04/06 23:48:25 I thought about it when adding this check last tim
91 request_types.RetainAll(cycle->context()->GetEnabledTypes());
92 93
93 GetUpdatesProcessor get_updates_processor( 94 GetUpdatesProcessor get_updates_processor(
94 cycle->context()->model_type_registry()->update_handler_map(), 95 cycle->context()->model_type_registry()->update_handler_map(),
95 configure_delegate); 96 configure_delegate);
96 DownloadAndApplyUpdates(&request_types, cycle, &get_updates_processor, 97 DownloadAndApplyUpdates(&request_types, cycle, &get_updates_processor,
97 kCreateMobileBookmarksFolder); 98 kCreateMobileBookmarksFolder);
98 return HandleCycleEnd(cycle, source); 99 return HandleCycleEnd(cycle, source);
99 } 100 }
100 101
101 bool Syncer::PollSyncShare(ModelTypeSet request_types, SyncCycle* cycle) { 102 bool Syncer::PollSyncShare(ModelTypeSet request_types, SyncCycle* cycle) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 200 }
200 201
201 bool Syncer::PostClearServerData(SyncCycle* cycle) { 202 bool Syncer::PostClearServerData(SyncCycle* cycle) {
202 DCHECK(cycle); 203 DCHECK(cycle);
203 ClearServerData clear_server_data(cycle->context()->account_name()); 204 ClearServerData clear_server_data(cycle->context()->account_name());
204 const SyncerError post_result = clear_server_data.SendRequest(cycle); 205 const SyncerError post_result = clear_server_data.SendRequest(cycle);
205 return post_result == SYNCER_OK; 206 return post_result == SYNCER_OK;
206 } 207 }
207 208
208 } // namespace syncer 209 } // namespace syncer
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698