Commit 6a2be53d authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

SyncService::CanSyncStart: return false after an unrecoverable error

This should make no difference whatsoever in practice (in case of an
unrecoverable error, we won't try to start up again anyway), it just
makes things a bit simpler to reason about.

Bug: 839834
Change-Id: Ie3ac83b172f9fab100b1a176421025aa1f3699dc
Reviewed-on: https://chromium-review.googlesource.com/1138252
Commit-Queue: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575355}
parent 58097ec3
...@@ -14,13 +14,7 @@ SyncSetupInProgressHandle::~SyncSetupInProgressHandle() { ...@@ -14,13 +14,7 @@ SyncSetupInProgressHandle::~SyncSetupInProgressHandle() {
} }
bool SyncService::CanSyncStart() const { bool SyncService::CanSyncStart() const {
int disable_reasons = GetDisableReasons(); return GetDisableReasons() == DISABLE_REASON_NONE;
// An unrecoverable error is currently *not* considered a start-preventing
// disable reason, because it occurs after Sync has already started.
// TODO(crbug.com/839834): Consider changing this, since Sync shuts down and
// won't start up again after an unrecoverable error.
disable_reasons = disable_reasons & ~DISABLE_REASON_UNRECOVERABLE_ERROR;
return disable_reasons == DISABLE_REASON_NONE;
} }
bool SyncService::IsSyncAllowed() const { bool SyncService::IsSyncAllowed() const {
......
...@@ -231,9 +231,8 @@ class SyncService : public DataTypeEncryptionHandler, public KeyedService { ...@@ -231,9 +231,8 @@ class SyncService : public DataTypeEncryptionHandler, public KeyedService {
virtual void OnDataTypeRequestsSyncStartup(ModelType type) = 0; virtual void OnDataTypeRequestsSyncStartup(ModelType type) = 0;
// DEPRECATED! Use GetDisableReasons/HasDisableReason instead. // DEPRECATED! Use GetDisableReasons/HasDisableReason instead.
// Equivalent to having no disable reasons except UNRECOVERABLE_ERROR, i.e. // Equivalent to having no disable reasons, i.e.
// "(GetDisableReasons() & ~DISABLE_REASON_UNRECOVERABLE_ERROR) == // "GetDisableReasons() == DISABLE_REASON_NONE".
// DISABLE_REASON_NONE".
bool CanSyncStart() const; bool CanSyncStart() const;
// Stops sync at the user's request. |data_fate| controls whether the sync // Stops sync at the user's request. |data_fate| controls whether the sync
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment