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); |
| 353 |
| 354 // TODO(zea): These types won't be fully purged if they are subsequently |
| 355 // disabled by the user. Fix that. See crbug.com/386778 |
351 disabled_types.PutAll(crypto_types); | 356 disabled_types.PutAll(crypto_types); |
| 357 disabled_types.PutAll(unready_types); |
| 358 |
352 syncer::ModelTypeSet active_types = | 359 syncer::ModelTypeSet active_types = |
353 GetDataTypesInState(CONFIGURE_ACTIVE, config_state_map); | 360 GetDataTypesInState(CONFIGURE_ACTIVE, config_state_map); |
354 syncer::ModelTypeSet clean_first_types = | 361 syncer::ModelTypeSet clean_first_types = |
355 GetDataTypesInState(CONFIGURE_CLEAN, config_state_map); | 362 GetDataTypesInState(CONFIGURE_CLEAN, config_state_map); |
356 syncer::ModelTypeSet types_to_download = registrar_->ConfigureDataTypes( | 363 syncer::ModelTypeSet types_to_download = registrar_->ConfigureDataTypes( |
357 syncer::Union(active_types, clean_first_types), | 364 syncer::Union(active_types, clean_first_types), |
358 disabled_types); | 365 disabled_types); |
359 types_to_download.PutAll(clean_first_types); | 366 types_to_download.PutAll(clean_first_types); |
360 types_to_download.RemoveAll(syncer::ProxyTypes()); | 367 types_to_download.RemoveAll(syncer::ProxyTypes()); |
361 if (!types_to_download.Empty()) | 368 if (!types_to_download.Empty()) |
(...skipping 23 matching lines...) Expand all Loading... |
385 | 392 |
386 syncer::ModelSafeRoutingInfo routing_info; | 393 syncer::ModelSafeRoutingInfo routing_info; |
387 registrar_->GetModelSafeRoutingInfo(&routing_info); | 394 registrar_->GetModelSafeRoutingInfo(&routing_info); |
388 | 395 |
389 syncer::ModelTypeSet current_types = registrar_->GetLastConfiguredTypes(); | 396 syncer::ModelTypeSet current_types = registrar_->GetLastConfiguredTypes(); |
390 syncer::ModelTypeSet types_to_purge = | 397 syncer::ModelTypeSet types_to_purge = |
391 syncer::Difference(previous_types, current_types); | 398 syncer::Difference(previous_types, current_types); |
392 syncer::ModelTypeSet inactive_types = | 399 syncer::ModelTypeSet inactive_types = |
393 GetDataTypesInState(CONFIGURE_INACTIVE, config_state_map); | 400 GetDataTypesInState(CONFIGURE_INACTIVE, config_state_map); |
394 types_to_purge.RemoveAll(inactive_types); | 401 types_to_purge.RemoveAll(inactive_types); |
| 402 types_to_purge.RemoveAll(unready_types); |
395 | 403 |
396 // If a type has already been disabled and unapplied or journaled, it will | 404 // 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 | 405 // not be part of the |types_to_purge| set, and therefore does not need |
398 // to be acted on again. | 406 // to be acted on again. |
399 fatal_types.RetainAll(types_to_purge); | 407 fatal_types.RetainAll(types_to_purge); |
400 syncer::ModelTypeSet unapply_types = | 408 syncer::ModelTypeSet unapply_types = |
401 syncer::Union(crypto_types, clean_first_types); | 409 syncer::Union(crypto_types, clean_first_types); |
402 unapply_types.RetainAll(types_to_purge); | 410 unapply_types.RetainAll(types_to_purge); |
403 | 411 |
404 DCHECK(syncer::Intersection(current_types, fatal_types).Empty()); | 412 DCHECK(syncer::Intersection(current_types, fatal_types).Empty()); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 | 875 |
868 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { | 876 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { |
869 return registrar_->sync_thread()->message_loop(); | 877 return registrar_->sync_thread()->message_loop(); |
870 } | 878 } |
871 | 879 |
872 } // namespace browser_sync | 880 } // namespace browser_sync |
873 | 881 |
874 #undef SDVLOG | 882 #undef SDVLOG |
875 | 883 |
876 #undef SLOG | 884 #undef SLOG |
OLD | NEW |