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

Unified Diff: components/browser_sync/profile_sync_service.cc

Issue 2716413003: Initial clear server data impl (Closed)
Patch Set: Responding to Pavel's comments. Created 3 years, 9 months 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 side-by-side diff with in-line comments
Download patch
Index: components/browser_sync/profile_sync_service.cc
diff --git a/components/browser_sync/profile_sync_service.cc b/components/browser_sync/profile_sync_service.cc
index 2909868bc33e3addeee8a618ad28c941de3a26e5..46408ac7e7ca5312de7061edbd149c48b3fc4996 100644
--- a/components/browser_sync/profile_sync_service.cc
+++ b/components/browser_sync/profile_sync_service.cc
@@ -1199,6 +1199,14 @@ void ProfileSyncService::OnClearServerDataDone() {
syncer::CLEAR_SERVER_DATA_MAX);
}
+void ProfileSyncService::ClearServerDataForTest(const base::Closure& callback) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ // Sync has a restriction that the engine must be in configuration mode
+ // in order to run clear server data.
+ engine_->StartConfiguration();
+ engine_->ClearServerData(callback);
+}
+
void ProfileSyncService::OnConfigureDone(
const DataTypeManager::ConfigureResult& result) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -1386,6 +1394,10 @@ bool ProfileSyncService::IsFirstSetupInProgress() const {
std::unique_ptr<syncer::SyncSetupInProgressHandle>
ProfileSyncService::GetSetupInProgressHandle() {
DCHECK(thread_checker_.CalledOnValidThread());
+
+ LOG(WARNING) << "GetHandle, count="
+ << (outstanding_setup_in_progress_handles_ + 1);
+
if (++outstanding_setup_in_progress_handles_ == 1) {
DCHECK(!startup_controller_->IsSetupInProgress());
startup_controller_->SetSetupInProgress(true);
@@ -2414,6 +2426,9 @@ tracked_objects::Location ProfileSyncService::unrecoverable_error_location()
void ProfileSyncService::OnSetupInProgressHandleDestroyed() {
DCHECK_GT(outstanding_setup_in_progress_handles_, 0);
+ LOG(WARNING) << "GetHandle, count="
+ << (outstanding_setup_in_progress_handles_ - 1);
+
// Don't re-start Sync until all outstanding handles are destroyed.
if (--outstanding_setup_in_progress_handles_ != 0)
return;
@@ -2425,5 +2440,4 @@ void ProfileSyncService::OnSetupInProgressHandleDestroyed() {
ReconfigureDatatypeManager();
NotifyObservers();
}
-
} // namespace browser_sync

Powered by Google App Engine
This is Rietveld 408576698