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

Side by Side Diff: components/browser_sync/profile_sync_service.cc

Issue 2716413003: Initial clear server data impl (Closed)
Patch Set: CL changes 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 unified diff | Download patch
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 "components/browser_sync/profile_sync_service.h" 5 #include "components/browser_sync/profile_sync_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <map> 10 #include <map>
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 } 1379 }
1380 1380
1381 bool ProfileSyncService::IsFirstSetupInProgress() const { 1381 bool ProfileSyncService::IsFirstSetupInProgress() const {
1382 DCHECK(thread_checker_.CalledOnValidThread()); 1382 DCHECK(thread_checker_.CalledOnValidThread());
1383 return !IsFirstSetupComplete() && startup_controller_->IsSetupInProgress(); 1383 return !IsFirstSetupComplete() && startup_controller_->IsSetupInProgress();
1384 } 1384 }
1385 1385
1386 std::unique_ptr<syncer::SyncSetupInProgressHandle> 1386 std::unique_ptr<syncer::SyncSetupInProgressHandle>
1387 ProfileSyncService::GetSetupInProgressHandle() { 1387 ProfileSyncService::GetSetupInProgressHandle() {
1388 DCHECK(thread_checker_.CalledOnValidThread()); 1388 DCHECK(thread_checker_.CalledOnValidThread());
1389
1389 if (++outstanding_setup_in_progress_handles_ == 1) { 1390 if (++outstanding_setup_in_progress_handles_ == 1) {
1390 DCHECK(!startup_controller_->IsSetupInProgress()); 1391 DCHECK(!startup_controller_->IsSetupInProgress());
1391 startup_controller_->SetSetupInProgress(true); 1392 startup_controller_->SetSetupInProgress(true);
1392 1393
1393 NotifyObservers(); 1394 NotifyObservers();
1394 } 1395 }
1395 1396
1396 return std::unique_ptr<syncer::SyncSetupInProgressHandle>( 1397 return std::unique_ptr<syncer::SyncSetupInProgressHandle>(
1397 new syncer::SyncSetupInProgressHandle( 1398 new syncer::SyncSetupInProgressHandle(
1398 base::Bind(&ProfileSyncService::OnSetupInProgressHandleDestroyed, 1399 base::Bind(&ProfileSyncService::OnSetupInProgressHandleDestroyed,
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2419 return; 2420 return;
2420 2421
2421 DCHECK(startup_controller_->IsSetupInProgress()); 2422 DCHECK(startup_controller_->IsSetupInProgress());
2422 startup_controller_->SetSetupInProgress(false); 2423 startup_controller_->SetSetupInProgress(false);
2423 2424
2424 if (IsEngineInitialized()) 2425 if (IsEngineInitialized())
2425 ReconfigureDatatypeManager(); 2426 ReconfigureDatatypeManager();
2426 NotifyObservers(); 2427 NotifyObservers();
2427 } 2428 }
2428 2429
2430 void ProfileSyncService::ClearServerDataForTest(const base::Closure& callback) {
pavely 2017/03/08 21:15:14 Why is this function placed at the end of file?
wylieb 2017/03/09 18:42:26 Good point. I moved it under ClearAndRestart...
2431 DCHECK(thread_checker_.CalledOnValidThread());
2432 // Sync has a restriction that the engine must be in configuration mode
2433 // in order to run clear server data.
2434 engine_->StartConfiguration();
2435 engine_->ClearServerData(callback);
2436 }
2437
2429 } // namespace browser_sync 2438 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698