summaryrefslogtreecommitdiffstats
path: root/content/browser/background_sync/background_sync_registration.cc
diff options
context:
space:
mode:
Diffstat (limited to 'content/browser/background_sync/background_sync_registration.cc')
-rw-r--r--content/browser/background_sync/background_sync_registration.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/content/browser/background_sync/background_sync_registration.cc b/content/browser/background_sync/background_sync_registration.cc
index 30bbf9e..d3da8e8 100644
--- a/content/browser/background_sync/background_sync_registration.cc
+++ b/content/browser/background_sync/background_sync_registration.cc
@@ -62,4 +62,20 @@ bool BackgroundSyncRegistration::HasCompleted() const {
return false;
}
+void BackgroundSyncRegistration::SetUnregisteredState() {
+ DCHECK(!HasCompleted());
+ bool firing = sync_state_ == BACKGROUND_SYNC_STATE_FIRING ||
+ sync_state_ == BACKGROUND_SYNC_STATE_UNREGISTERED_WHILE_FIRING;
+
+ sync_state_ = firing ? BACKGROUND_SYNC_STATE_UNREGISTERED_WHILE_FIRING
+ : BACKGROUND_SYNC_STATE_UNREGISTERED;
+
+ if (!firing) {
+ // If the registration is currently firing then wait to run
+ // RunDoneCallbacks until after it has finished as it might
+ // change state to SUCCESS first.
+ RunDoneCallbacks();
+ }
+}
+
} // namespace content