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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 // The SyncBackendRegistrar's state was initially derived from the types | 682 // The SyncBackendRegistrar's state was initially derived from the types |
683 // detected to have been downloaded in the database. Afterwards it is | 683 // detected to have been downloaded in the database. Afterwards it is |
684 // modified only by this function. We expect it to remain in sync with the | 684 // modified only by this function. We expect it to remain in sync with the |
685 // backend because configuration requests are never aborted; they are retried | 685 // backend because configuration requests are never aborted; they are retried |
686 // until they succeed or the backend is shut down. | 686 // until they succeed or the backend is shut down. |
687 | 687 |
688 syncer::ModelTypeSet types_to_download = registrar_->ConfigureDataTypes( | 688 syncer::ModelTypeSet types_to_download = registrar_->ConfigureDataTypes( |
689 GetDataTypesInState(ENABLED, config_state_map), | 689 GetDataTypesInState(ENABLED, config_state_map), |
690 syncer::Union(GetDataTypesInState(DISABLED, config_state_map), | 690 syncer::Union(GetDataTypesInState(DISABLED, config_state_map), |
691 GetDataTypesInState(FAILED, config_state_map))); | 691 GetDataTypesInState(FAILED, config_state_map))); |
| 692 types_to_download.RemoveAll(syncer::ProxyTypes()); |
692 if (!types_to_download.Empty()) | 693 if (!types_to_download.Empty()) |
693 types_to_download.Put(syncer::NIGORI); | 694 types_to_download.Put(syncer::NIGORI); |
694 | 695 |
695 // TODO(sync): crbug.com/137550. | 696 // TODO(sync): crbug.com/137550. |
696 // It's dangerous to configure types that have progress markers. Types with | 697 // It's dangerous to configure types that have progress markers. Types with |
697 // progress markers can trigger a MIGRATION_DONE response. We are not | 698 // progress markers can trigger a MIGRATION_DONE response. We are not |
698 // prepared to handle a migration during a configure, so we must ensure that | 699 // prepared to handle a migration during a configure, so we must ensure that |
699 // all our types_to_download actually contain no data before we sync them. | 700 // all our types_to_download actually contain no data before we sync them. |
700 // | 701 // |
701 // One common way to end up in this situation used to be types which | 702 // One common way to end up in this situation used to be types which |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 } | 1380 } |
1380 | 1381 |
1381 void SyncBackendHost::Core::DoFinishConfigureDataTypes( | 1382 void SyncBackendHost::Core::DoFinishConfigureDataTypes( |
1382 syncer::ModelTypeSet types_to_config, | 1383 syncer::ModelTypeSet types_to_config, |
1383 const base::Callback<void(syncer::ModelTypeSet)>& ready_task) { | 1384 const base::Callback<void(syncer::ModelTypeSet)>& ready_task) { |
1384 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 1385 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
1385 | 1386 |
1386 // Update the enabled types for the bridge and sync manager. | 1387 // Update the enabled types for the bridge and sync manager. |
1387 syncer::ModelSafeRoutingInfo routing_info; | 1388 syncer::ModelSafeRoutingInfo routing_info; |
1388 registrar_->GetModelSafeRoutingInfo(&routing_info); | 1389 registrar_->GetModelSafeRoutingInfo(&routing_info); |
1389 const syncer::ModelTypeSet enabled_types = GetRoutingInfoTypes(routing_info); | 1390 syncer::ModelTypeSet enabled_types = GetRoutingInfoTypes(routing_info); |
| 1391 enabled_types.RemoveAll(syncer::ProxyTypes()); |
1390 sync_manager_->UpdateEnabledTypes(enabled_types); | 1392 sync_manager_->UpdateEnabledTypes(enabled_types); |
1391 | 1393 |
1392 const syncer::ModelTypeSet failed_configuration_types = | 1394 const syncer::ModelTypeSet failed_configuration_types = |
1393 Difference(types_to_config, sync_manager_->InitialSyncEndedTypes()); | 1395 Difference(types_to_config, sync_manager_->InitialSyncEndedTypes()); |
1394 host_.Call(FROM_HERE, | 1396 host_.Call(FROM_HERE, |
1395 &SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop, | 1397 &SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop, |
1396 failed_configuration_types, | 1398 failed_configuration_types, |
1397 ready_task); | 1399 ready_task); |
1398 } | 1400 } |
1399 | 1401 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 DVLOG(1) << "Connection status changed: " | 1632 DVLOG(1) << "Connection status changed: " |
1631 << syncer::ConnectionStatusToString(status); | 1633 << syncer::ConnectionStatusToString(status); |
1632 frontend_->OnConnectionStatusChange(status); | 1634 frontend_->OnConnectionStatusChange(status); |
1633 } | 1635 } |
1634 | 1636 |
1635 #undef SDVLOG | 1637 #undef SDVLOG |
1636 | 1638 |
1637 #undef SLOG | 1639 #undef SLOG |
1638 | 1640 |
1639 } // namespace browser_sync | 1641 } // namespace browser_sync |
OLD | NEW |