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()) |
| 91 request_types.RetainAll(cycle->context()->GetEnabledTypes()); |
| 92 |
85 GetUpdatesProcessor get_updates_processor( | 93 GetUpdatesProcessor get_updates_processor( |
86 cycle->context()->model_type_registry()->update_handler_map(), | 94 cycle->context()->model_type_registry()->update_handler_map(), |
87 configure_delegate); | 95 configure_delegate); |
88 DownloadAndApplyUpdates(&request_types, cycle, &get_updates_processor, | 96 DownloadAndApplyUpdates(&request_types, cycle, &get_updates_processor, |
89 kCreateMobileBookmarksFolder); | 97 kCreateMobileBookmarksFolder); |
90 return HandleCycleEnd(cycle, source); | 98 return HandleCycleEnd(cycle, source); |
91 } | 99 } |
92 | 100 |
93 bool Syncer::PollSyncShare(ModelTypeSet request_types, SyncCycle* cycle) { | 101 bool Syncer::PollSyncShare(ModelTypeSet request_types, SyncCycle* cycle) { |
94 base::AutoReset<bool> is_syncing(&is_syncing_, true); | 102 base::AutoReset<bool> is_syncing(&is_syncing_, true); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 199 } |
192 | 200 |
193 bool Syncer::PostClearServerData(SyncCycle* cycle) { | 201 bool Syncer::PostClearServerData(SyncCycle* cycle) { |
194 DCHECK(cycle); | 202 DCHECK(cycle); |
195 ClearServerData clear_server_data(cycle->context()->account_name()); | 203 ClearServerData clear_server_data(cycle->context()->account_name()); |
196 const SyncerError post_result = clear_server_data.SendRequest(cycle); | 204 const SyncerError post_result = clear_server_data.SendRequest(cycle); |
197 return post_result == SYNCER_OK; | 205 return post_result == SYNCER_OK; |
198 } | 206 } |
199 | 207 |
200 } // namespace syncer | 208 } // namespace syncer |
OLD | NEW |