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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "chrome/browser/sync/glue/sync_backend_host.h" | 7 #include "chrome/browser/sync/glue/sync_backend_host.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 // The SyncBackendRegistrar's state was initially derived from the types | 678 // The SyncBackendRegistrar's state was initially derived from the types |
679 // detected to have been downloaded in the database. Afterwards it is | 679 // detected to have been downloaded in the database. Afterwards it is |
680 // modified only by this function. We expect it to remain in sync with the | 680 // modified only by this function. We expect it to remain in sync with the |
681 // backend because configuration requests are never aborted; they are retried | 681 // backend because configuration requests are never aborted; they are retried |
682 // until they succeed or the backend is shut down. | 682 // until they succeed or the backend is shut down. |
683 | 683 |
684 syncer::ModelTypeSet types_to_download = registrar_->ConfigureDataTypes( | 684 syncer::ModelTypeSet types_to_download = registrar_->ConfigureDataTypes( |
685 GetDataTypesInState(ENABLED, config_state_map), | 685 GetDataTypesInState(ENABLED, config_state_map), |
686 syncer::Union(GetDataTypesInState(DISABLED, config_state_map), | 686 syncer::Union(GetDataTypesInState(DISABLED, config_state_map), |
687 GetDataTypesInState(FAILED, config_state_map))); | 687 GetDataTypesInState(FAILED, config_state_map))); |
| 688 types_to_download.RemoveAll(syncer::VirtualTypes()); |
688 if (!types_to_download.Empty()) | 689 if (!types_to_download.Empty()) |
689 types_to_download.Put(syncer::NIGORI); | 690 types_to_download.Put(syncer::NIGORI); |
690 | 691 |
691 // TODO(sync): crbug.com/137550. | 692 // TODO(sync): crbug.com/137550. |
692 // It's dangerous to configure types that have progress markers. Types with | 693 // It's dangerous to configure types that have progress markers. Types with |
693 // progress markers can trigger a MIGRATION_DONE response. We are not | 694 // progress markers can trigger a MIGRATION_DONE response. We are not |
694 // prepared to handle a migration during a configure, so we must ensure that | 695 // prepared to handle a migration during a configure, so we must ensure that |
695 // all our types_to_download actually contain no data before we sync them. | 696 // all our types_to_download actually contain no data before we sync them. |
696 // | 697 // |
697 // One common way to end up in this situation used to be types which | 698 // One common way to end up in this situation used to be types which |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 } | 1362 } |
1362 | 1363 |
1363 void SyncBackendHost::Core::DoFinishConfigureDataTypes( | 1364 void SyncBackendHost::Core::DoFinishConfigureDataTypes( |
1364 syncer::ModelTypeSet types_to_config, | 1365 syncer::ModelTypeSet types_to_config, |
1365 const base::Callback<void(syncer::ModelTypeSet)>& ready_task) { | 1366 const base::Callback<void(syncer::ModelTypeSet)>& ready_task) { |
1366 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 1367 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
1367 | 1368 |
1368 // Update the enabled types for the bridge and sync manager. | 1369 // Update the enabled types for the bridge and sync manager. |
1369 syncer::ModelSafeRoutingInfo routing_info; | 1370 syncer::ModelSafeRoutingInfo routing_info; |
1370 registrar_->GetModelSafeRoutingInfo(&routing_info); | 1371 registrar_->GetModelSafeRoutingInfo(&routing_info); |
1371 const syncer::ModelTypeSet enabled_types = GetRoutingInfoTypes(routing_info); | 1372 syncer::ModelTypeSet enabled_types = GetRoutingInfoTypes(routing_info); |
| 1373 enabled_types.RemoveAll(syncer::VirtualTypes()); |
1372 sync_manager_->UpdateEnabledTypes(enabled_types); | 1374 sync_manager_->UpdateEnabledTypes(enabled_types); |
1373 | 1375 |
1374 const syncer::ModelTypeSet failed_configuration_types = | 1376 const syncer::ModelTypeSet failed_configuration_types = |
1375 Difference(types_to_config, sync_manager_->InitialSyncEndedTypes()); | 1377 Difference(types_to_config, sync_manager_->InitialSyncEndedTypes()); |
1376 host_.Call(FROM_HERE, | 1378 host_.Call(FROM_HERE, |
1377 &SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop, | 1379 &SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop, |
1378 failed_configuration_types, | 1380 failed_configuration_types, |
1379 ready_task); | 1381 ready_task); |
1380 } | 1382 } |
1381 | 1383 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 DVLOG(1) << "Connection status changed: " | 1615 DVLOG(1) << "Connection status changed: " |
1614 << syncer::ConnectionStatusToString(status); | 1616 << syncer::ConnectionStatusToString(status); |
1615 frontend_->OnConnectionStatusChange(status); | 1617 frontend_->OnConnectionStatusChange(status); |
1616 } | 1618 } |
1617 | 1619 |
1618 #undef SDVLOG | 1620 #undef SDVLOG |
1619 | 1621 |
1620 #undef SLOG | 1622 #undef SLOG |
1621 | 1623 |
1622 } // namespace browser_sync | 1624 } // namespace browser_sync |
OLD | NEW |