| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/background_sync/background_sync_registration.h" | 5 #include "content/browser/background_sync/background_sync_registration.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 const BackgroundSyncRegistration::RegistrationId | 15 const BackgroundSyncRegistration::RegistrationId |
| 16 BackgroundSyncRegistration::kInvalidRegistrationId = -1; | 16 BackgroundSyncRegistration::kInvalidRegistrationId = -1; |
| 17 | 17 |
| 18 const BackgroundSyncRegistration::RegistrationId | 18 const BackgroundSyncRegistration::RegistrationId |
| 19 BackgroundSyncRegistration::kInitialId = 0; | 19 BackgroundSyncRegistration::kInitialId = 0; |
| 20 | 20 |
| 21 BackgroundSyncRegistration::BackgroundSyncRegistration() = default; | |
| 22 BackgroundSyncRegistration::~BackgroundSyncRegistration() = default; | |
| 23 | |
| 24 bool BackgroundSyncRegistration::Equals( | 21 bool BackgroundSyncRegistration::Equals( |
| 25 const BackgroundSyncRegistration& other) const { | 22 const BackgroundSyncRegistration& other) const { |
| 26 return options_.Equals(other.options_); | 23 return options_.Equals(other.options_); |
| 27 } | 24 } |
| 28 | 25 |
| 29 bool BackgroundSyncRegistration::IsValid() const { | 26 bool BackgroundSyncRegistration::IsValid() const { |
| 30 return id_ != kInvalidRegistrationId; | 27 return id_ != kInvalidRegistrationId; |
| 31 } | 28 } |
| 32 | 29 |
| 33 bool BackgroundSyncRegistration::IsFiring() const { | 30 bool BackgroundSyncRegistration::IsFiring() const { |
| 34 switch (sync_state_) { | 31 switch (sync_state_) { |
| 35 case BackgroundSyncState::FIRING: | 32 case BackgroundSyncState::FIRING: |
| 36 case BackgroundSyncState::REREGISTERED_WHILE_FIRING: | 33 case BackgroundSyncState::REREGISTERED_WHILE_FIRING: |
| 37 return true; | 34 return true; |
| 38 case BackgroundSyncState::PENDING: | 35 case BackgroundSyncState::PENDING: |
| 39 return false; | 36 return false; |
| 40 } | 37 } |
| 41 NOTREACHED(); | 38 NOTREACHED(); |
| 42 return false; | 39 return false; |
| 43 } | 40 } |
| 44 | 41 |
| 45 } // namespace content | 42 } // namespace content |
| OLD | NEW |