| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_fetch/background_fetch_registration_id.h" | 5 #include "content/browser/background_fetch/background_fetch_registration_id.h" |
| 6 | 6 |
| 7 #include <tuple> |
| 8 |
| 7 #include "content/common/service_worker/service_worker_types.h" | 9 #include "content/common/service_worker/service_worker_types.h" |
| 8 | 10 |
| 9 namespace content { | 11 namespace content { |
| 10 | 12 |
| 11 BackgroundFetchRegistrationId::BackgroundFetchRegistrationId() | 13 BackgroundFetchRegistrationId::BackgroundFetchRegistrationId() |
| 12 : service_worker_registration_id_(kInvalidServiceWorkerRegistrationId) {} | 14 : service_worker_registration_id_(kInvalidServiceWorkerRegistrationId) {} |
| 13 | 15 |
| 14 BackgroundFetchRegistrationId::BackgroundFetchRegistrationId( | 16 BackgroundFetchRegistrationId::BackgroundFetchRegistrationId( |
| 15 int64_t service_worker_registration_id, | 17 int64_t service_worker_registration_id, |
| 16 const url::Origin& origin, | 18 const url::Origin& origin, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 37 other.origin_ == origin_ && other.tag_ == tag_; | 39 other.origin_ == origin_ && other.tag_ == tag_; |
| 38 } | 40 } |
| 39 | 41 |
| 40 bool BackgroundFetchRegistrationId::operator!=( | 42 bool BackgroundFetchRegistrationId::operator!=( |
| 41 const BackgroundFetchRegistrationId& other) const { | 43 const BackgroundFetchRegistrationId& other) const { |
| 42 return !(*this == other); | 44 return !(*this == other); |
| 43 } | 45 } |
| 44 | 46 |
| 45 bool BackgroundFetchRegistrationId::operator<( | 47 bool BackgroundFetchRegistrationId::operator<( |
| 46 const BackgroundFetchRegistrationId& other) const { | 48 const BackgroundFetchRegistrationId& other) const { |
| 47 return service_worker_registration_id_ < | 49 return std::tie(service_worker_registration_id_, origin_, tag_) < |
| 48 other.service_worker_registration_id_ || | 50 std::tie(other.service_worker_registration_id_, other.origin_, |
| 49 origin_ < other.origin_ || tag_ < other.tag_; | 51 other.tag_); |
| 50 } | 52 } |
| 51 | 53 |
| 52 bool BackgroundFetchRegistrationId::is_null() const { | 54 bool BackgroundFetchRegistrationId::is_null() const { |
| 53 return service_worker_registration_id_ == kInvalidServiceWorkerRegistrationId; | 55 return service_worker_registration_id_ == kInvalidServiceWorkerRegistrationId; |
| 54 } | 56 } |
| 55 | 57 |
| 56 } // namespace content | 58 } // namespace content |
| OLD | NEW |