Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 11474036: Remove initial_sync_ended bits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another rebase Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 // The SyncBackendRegistrar's routing info will be updated by adding the 669 // The SyncBackendRegistrar's routing info will be updated by adding the
670 // types_to_add to the list then removing types_to_remove. Any types which 670 // types_to_add to the list then removing types_to_remove. Any types which
671 // are not in either of those sets will remain untouched. 671 // are not in either of those sets will remain untouched.
672 // 672 //
673 // Types which were not in the list previously are not fully downloaded, so we 673 // Types which were not in the list previously are not fully downloaded, so we
674 // must ask the syncer to download them. Any newly supported datatypes will 674 // must ask the syncer to download them. Any newly supported datatypes will
675 // not have been in that routing info list, so they will be among the types 675 // not have been in that routing info list, so they will be among the types
676 // downloaded if they are enabled. 676 // downloaded if they are enabled.
677 // 677 //
678 // The SyncBackendRegistrar's state was initially derived from the types 678 // The SyncBackendRegistrar's state was initially derived from the types
679 // marked initial_sync_ended when the sync database was loaded. Afterwards it 679 // detected to have been downloaded in the database. Afterwards it is
680 // is 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 browser is closed. 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 types_to_add, types_to_remove); 685 types_to_add, types_to_remove);
686 if (!types_to_download.Empty()) 686 if (!types_to_download.Empty())
687 types_to_download.Put(syncer::NIGORI); 687 types_to_download.Put(syncer::NIGORI);
688 688
689 // TODO(sync): crbug.com/137550. 689 // TODO(sync): crbug.com/137550.
690 // It's dangerous to configure types that have progress markers. Types with 690 // It's dangerous to configure types that have progress markers. Types with
691 // progress markers can trigger a MIGRATION_DONE response. We are not 691 // progress markers can trigger a MIGRATION_DONE response. We are not
692 // prepared to handle a migration during a configure, so we must ensure that 692 // prepared to handle a migration during a configure, so we must ensure that
693 // all our types_to_download actually contain no data before we sync them. 693 // all our types_to_download actually contain no data before we sync them.
694 // 694 //
695 // The most common way to end up in this situation used to be types which had 695 // One common way to end up in this situation used to be types which
696 // !initial_sync_ended, but did have some progress markers. We avoid problems 696 // downloaded some or all of their data but have not applied it yet. We avoid
697 // with those types by purging the data of any such partially synced types 697 // problems with those types by purging the data of any such partially synced
698 // soon after we load the directory. 698 // types soon after we load the directory.
699 // 699 //
700 // Another possible scenario is that we have newly supported or newly enabled 700 // Another possible scenario is that we have newly supported or newly enabled
701 // data types being downloaded here but the nigori type, which is always 701 // data types being downloaded here but the nigori type, which is always
702 // included in any GetUpdates request, requires migration. The server has 702 // included in any GetUpdates request, requires migration. The server has
703 // code to detect this scenario based on the configure reason, the fact that 703 // code to detect this scenario based on the configure reason, the fact that
704 // the nigori type is the only requested type which requires migration, and 704 // the nigori type is the only requested type which requires migration, and
705 // that the requested types list includes at least one non-nigori type. It 705 // that the requested types list includes at least one non-nigori type. It
706 // will not send a MIGRATION_DONE response in that case. We still need to be 706 // will not send a MIGRATION_DONE response in that case. We still need to be
707 // careful to not send progress markers for non-nigori types, though. If a 707 // careful to not send progress markers for non-nigori types, though. If a
708 // non-nigori type in the request requires migration, a MIGRATION_DONE 708 // non-nigori type in the request requires migration, a MIGRATION_DONE
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 1234
1235 if (!sync_manager_->GetUserShare()) { // NULL in some tests. 1235 if (!sync_manager_->GetUserShare()) { // NULL in some tests.
1236 DVLOG(1) << "Skipping initialization of DeviceInfo"; 1236 DVLOG(1) << "Skipping initialization of DeviceInfo";
1237 host_.Call( 1237 host_.Call(
1238 FROM_HERE, 1238 FROM_HERE,
1239 &SyncBackendHost::HandleInitializationCompletedOnFrontendLoop, 1239 &SyncBackendHost::HandleInitializationCompletedOnFrontendLoop,
1240 true); 1240 true);
1241 return; 1241 return;
1242 } 1242 }
1243 1243
1244 if (!sync_manager_->InitialSyncEndedTypes().HasAll(syncer::ControlTypes())) {
1245 LOG(ERROR) << "Failed to download control types";
1246 host_.Call(
1247 FROM_HERE,
1248 &SyncBackendHost::HandleInitializationCompletedOnFrontendLoop,
1249 false);
1250 return;
1251 }
1252
1244 // Initialize device info. This is asynchronous on some platforms, so we 1253 // Initialize device info. This is asynchronous on some platforms, so we
1245 // provide a callback for when it finishes. 1254 // provide a callback for when it finishes.
1246 synced_device_tracker_.reset( 1255 synced_device_tracker_.reset(
1247 new SyncedDeviceTracker(sync_manager_->GetUserShare(), 1256 new SyncedDeviceTracker(sync_manager_->GetUserShare(),
1248 sync_manager_->cache_guid())); 1257 sync_manager_->cache_guid()));
1249 synced_device_tracker_->InitLocalDeviceInfo( 1258 synced_device_tracker_->InitLocalDeviceInfo(
1250 base::Bind(&SyncBackendHost::Core::DoFinishInitialProcessControlTypes, 1259 base::Bind(&SyncBackendHost::Core::DoFinishInitialProcessControlTypes,
1251 this)); 1260 this));
1252 } 1261 }
1253 1262
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 DVLOG(1) << "Connection status changed: " 1599 DVLOG(1) << "Connection status changed: "
1591 << syncer::ConnectionStatusToString(status); 1600 << syncer::ConnectionStatusToString(status);
1592 frontend_->OnConnectionStatusChange(status); 1601 frontend_->OnConnectionStatusChange(status);
1593 } 1602 }
1594 1603
1595 #undef SDVLOG 1604 #undef SDVLOG
1596 1605
1597 #undef SLOG 1606 #undef SLOG
1598 1607
1599 } // namespace browser_sync 1608 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/about_sync_util.cc ('k') | chrome/browser/sync/glue/sync_backend_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698