OLD | NEW |
---|---|
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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); |
83 HandleCycleBegin(cycle); | 83 HandleCycleBegin(cycle); |
84 ConfigureGetUpdatesDelegate configure_delegate(source); | 84 ConfigureGetUpdatesDelegate configure_delegate(source); |
85 | |
86 // It is possible during shutdown that datatypes get unregistered from | |
87 // ModelTypeRegistry before scheduled configure sync cycle gets executed. | |
88 // When it happens we should adjust set of types to download to only include | |
89 // registered types. | |
90 if (cancelation_signal_->IsSignalled()) | |
skym
2017/02/24 17:04:25
Would be good to have a unit test for this as well
pavely
2017/02/24 18:54:32
Done.
| |
91 request_types.RetainAll( | |
92 cycle->context()->model_type_registry()->GetEnabledTypes()); | |
93 | |
85 GetUpdatesProcessor get_updates_processor( | 94 GetUpdatesProcessor get_updates_processor( |
86 cycle->context()->model_type_registry()->update_handler_map(), | 95 cycle->context()->model_type_registry()->update_handler_map(), |
87 configure_delegate); | 96 configure_delegate); |
88 DownloadAndApplyUpdates(&request_types, cycle, &get_updates_processor, | 97 DownloadAndApplyUpdates(&request_types, cycle, &get_updates_processor, |
89 kCreateMobileBookmarksFolder); | 98 kCreateMobileBookmarksFolder); |
90 return HandleCycleEnd(cycle, source); | 99 return HandleCycleEnd(cycle, source); |
91 } | 100 } |
92 | 101 |
93 bool Syncer::PollSyncShare(ModelTypeSet request_types, SyncCycle* cycle) { | 102 bool Syncer::PollSyncShare(ModelTypeSet request_types, SyncCycle* cycle) { |
94 base::AutoReset<bool> is_syncing(&is_syncing_, true); | 103 base::AutoReset<bool> is_syncing(&is_syncing_, true); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 } | 200 } |
192 | 201 |
193 bool Syncer::PostClearServerData(SyncCycle* cycle) { | 202 bool Syncer::PostClearServerData(SyncCycle* cycle) { |
194 DCHECK(cycle); | 203 DCHECK(cycle); |
195 ClearServerData clear_server_data(cycle->context()->account_name()); | 204 ClearServerData clear_server_data(cycle->context()->account_name()); |
196 const SyncerError post_result = clear_server_data.SendRequest(cycle); | 205 const SyncerError post_result = clear_server_data.SendRequest(cycle); |
197 return post_result == SYNCER_OK; | 206 return post_result == SYNCER_OK; |
198 } | 207 } |
199 | 208 |
200 } // namespace syncer | 209 } // namespace syncer |
OLD | NEW |