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

Unified Diff: trunk/src/sync/engine/sync_scheduler_impl.cc

Issue 23658030: Revert 222154 "sync: Gracefully handle very early shutdown" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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
« no previous file with comments | « trunk/src/sync/engine/sync_scheduler_impl.h ('k') | trunk/src/sync/engine/sync_scheduler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/sync/engine/sync_scheduler_impl.cc
===================================================================
--- trunk/src/sync/engine/sync_scheduler_impl.cc (revision 222204)
+++ trunk/src/sync/engine/sync_scheduler_impl.cc (working copy)
@@ -174,7 +174,7 @@
SyncSchedulerImpl::~SyncSchedulerImpl() {
DCHECK(CalledOnValidThread());
- Stop();
+ StopImpl();
}
void SyncSchedulerImpl::OnCredentialsUpdated() {
@@ -643,9 +643,17 @@
}
}
-void SyncSchedulerImpl::Stop() {
+void SyncSchedulerImpl::RequestStop() {
+ syncer_->RequestEarlyExit(); // Safe to call from any thread.
+ DCHECK(weak_handle_this_.IsInitialized());
+ SDVLOG(3) << "Posting StopImpl";
+ weak_handle_this_.Call(FROM_HERE,
+ &SyncSchedulerImpl::StopImpl);
+}
+
+void SyncSchedulerImpl::StopImpl() {
DCHECK(CalledOnValidThread());
- SDVLOG(2) << "Stop called";
+ SDVLOG(2) << "StopImpl called";
// Kill any in-flight method calls.
weak_ptr_factory_.InvalidateWeakPtrs();
@@ -853,7 +861,7 @@
void SyncSchedulerImpl::OnShouldStopSyncingPermanently() {
DCHECK(CalledOnValidThread());
SDVLOG(2) << "OnShouldStopSyncingPermanently";
- Stop();
+ syncer_->RequestEarlyExit(); // Thread-safe.
Notify(SyncEngineEvent::STOP_SYNCING_PERMANENTLY);
}
@@ -872,7 +880,7 @@
if (ShouldRequestEarlyExit(
snapshot.model_neutral_state().sync_protocol_error)) {
SDVLOG(2) << "Sync Scheduler requesting early exit.";
- Stop();
+ syncer_->RequestEarlyExit(); // Thread-safe.
}
if (IsActionableError(snapshot.model_neutral_state().sync_protocol_error))
OnActionableError(snapshot);
« no previous file with comments | « trunk/src/sync/engine/sync_scheduler_impl.h ('k') | trunk/src/sync/engine/sync_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698