Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/sync/glue/sync_backend_host_impl.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 // until they succeed or the backend is shut down. | 340 // until they succeed or the backend is shut down. |
| 341 | 341 |
| 342 syncer::ModelTypeSet previous_types = registrar_->GetLastConfiguredTypes(); | 342 syncer::ModelTypeSet previous_types = registrar_->GetLastConfiguredTypes(); |
| 343 | 343 |
| 344 syncer::ModelTypeSet disabled_types = | 344 syncer::ModelTypeSet disabled_types = |
| 345 GetDataTypesInState(DISABLED, config_state_map); | 345 GetDataTypesInState(DISABLED, config_state_map); |
| 346 syncer::ModelTypeSet fatal_types = | 346 syncer::ModelTypeSet fatal_types = |
| 347 GetDataTypesInState(FATAL, config_state_map); | 347 GetDataTypesInState(FATAL, config_state_map); |
| 348 syncer::ModelTypeSet crypto_types = | 348 syncer::ModelTypeSet crypto_types = |
| 349 GetDataTypesInState(CRYPTO, config_state_map); | 349 GetDataTypesInState(CRYPTO, config_state_map); |
| 350 syncer::ModelTypeSet unready_types = | |
| 351 GetDataTypesInState(UNREADY, config_state_map); | |
| 350 disabled_types.PutAll(fatal_types); | 352 disabled_types.PutAll(fatal_types); |
| 351 disabled_types.PutAll(crypto_types); | 353 disabled_types.PutAll(crypto_types); |
| 354 disabled_types.PutAll(unready_types); | |
|
haitaol1
2014/06/19 18:14:35
This will remove routing info of unready types in
Nicolas Zea
2014/06/19 21:13:02
Hmm, I suspect you're right. They'll both be purge
| |
| 352 syncer::ModelTypeSet active_types = | 355 syncer::ModelTypeSet active_types = |
| 353 GetDataTypesInState(CONFIGURE_ACTIVE, config_state_map); | 356 GetDataTypesInState(CONFIGURE_ACTIVE, config_state_map); |
| 354 syncer::ModelTypeSet clean_first_types = | 357 syncer::ModelTypeSet clean_first_types = |
| 355 GetDataTypesInState(CONFIGURE_CLEAN, config_state_map); | 358 GetDataTypesInState(CONFIGURE_CLEAN, config_state_map); |
| 356 syncer::ModelTypeSet types_to_download = registrar_->ConfigureDataTypes( | 359 syncer::ModelTypeSet types_to_download = registrar_->ConfigureDataTypes( |
| 357 syncer::Union(active_types, clean_first_types), | 360 syncer::Union(active_types, clean_first_types), |
| 358 disabled_types); | 361 disabled_types); |
| 359 types_to_download.PutAll(clean_first_types); | 362 types_to_download.PutAll(clean_first_types); |
| 360 types_to_download.RemoveAll(syncer::ProxyTypes()); | 363 types_to_download.RemoveAll(syncer::ProxyTypes()); |
| 361 if (!types_to_download.Empty()) | 364 if (!types_to_download.Empty()) |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 385 | 388 |
| 386 syncer::ModelSafeRoutingInfo routing_info; | 389 syncer::ModelSafeRoutingInfo routing_info; |
| 387 registrar_->GetModelSafeRoutingInfo(&routing_info); | 390 registrar_->GetModelSafeRoutingInfo(&routing_info); |
| 388 | 391 |
| 389 syncer::ModelTypeSet current_types = registrar_->GetLastConfiguredTypes(); | 392 syncer::ModelTypeSet current_types = registrar_->GetLastConfiguredTypes(); |
| 390 syncer::ModelTypeSet types_to_purge = | 393 syncer::ModelTypeSet types_to_purge = |
| 391 syncer::Difference(previous_types, current_types); | 394 syncer::Difference(previous_types, current_types); |
| 392 syncer::ModelTypeSet inactive_types = | 395 syncer::ModelTypeSet inactive_types = |
| 393 GetDataTypesInState(CONFIGURE_INACTIVE, config_state_map); | 396 GetDataTypesInState(CONFIGURE_INACTIVE, config_state_map); |
| 394 types_to_purge.RemoveAll(inactive_types); | 397 types_to_purge.RemoveAll(inactive_types); |
| 398 types_to_purge.RemoveAll(unready_types); | |
| 395 | 399 |
| 396 // If a type has already been disabled and unapplied or journaled, it will | 400 // If a type has already been disabled and unapplied or journaled, it will |
| 397 // not be part of the |types_to_purge| set, and therefore does not need | 401 // not be part of the |types_to_purge| set, and therefore does not need |
| 398 // to be acted on again. | 402 // to be acted on again. |
| 399 fatal_types.RetainAll(types_to_purge); | 403 fatal_types.RetainAll(types_to_purge); |
| 400 syncer::ModelTypeSet unapply_types = | 404 syncer::ModelTypeSet unapply_types = |
| 401 syncer::Union(crypto_types, clean_first_types); | 405 syncer::Union(crypto_types, clean_first_types); |
| 402 unapply_types.RetainAll(types_to_purge); | 406 unapply_types.RetainAll(types_to_purge); |
| 403 | 407 |
| 404 DCHECK(syncer::Intersection(current_types, fatal_types).Empty()); | 408 DCHECK(syncer::Intersection(current_types, fatal_types).Empty()); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 867 | 871 |
| 868 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { | 872 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { |
| 869 return registrar_->sync_thread()->message_loop(); | 873 return registrar_->sync_thread()->message_loop(); |
| 870 } | 874 } |
| 871 | 875 |
| 872 } // namespace browser_sync | 876 } // namespace browser_sync |
| 873 | 877 |
| 874 #undef SDVLOG | 878 #undef SDVLOG |
| 875 | 879 |
| 876 #undef SLOG | 880 #undef SLOG |
| OLD | NEW |