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

Unified Diff: content/browser/background_fetch/background_fetch_registration_id.cc

Issue 2770393003: Add a type to uniquely identify a Background Fetch (Closed)
Patch Set: Created 3 years, 9 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
Index: content/browser/background_fetch/background_fetch_registration_id.cc
diff --git a/content/browser/background_fetch/background_fetch_registration_id.cc b/content/browser/background_fetch/background_fetch_registration_id.cc
new file mode 100644
index 0000000000000000000000000000000000000000..46d6c67928a51a2ca0b82c054392680dfbe8a6de
--- /dev/null
+++ b/content/browser/background_fetch/background_fetch_registration_id.cc
@@ -0,0 +1,41 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/background_fetch/background_fetch_registration_id.h"
+
+namespace content {
+
+BackgroundFetchRegistrationId::BackgroundFetchRegistrationId(
+ int64_t service_worker_registration_id,
+ const url::Origin& origin,
+ const std::string& tag)
+ : service_worker_registration_id_(service_worker_registration_id),
+ origin_(origin),
+ tag_(tag) {}
+
+BackgroundFetchRegistrationId::BackgroundFetchRegistrationId(
+ BackgroundFetchRegistrationId&& other) = default;
+
+BackgroundFetchRegistrationId::~BackgroundFetchRegistrationId() = default;
+
+bool BackgroundFetchRegistrationId::operator==(
+ const BackgroundFetchRegistrationId& other) const {
+ return other.service_worker_registration_id_ ==
+ service_worker_registration_id_ &&
+ other.origin_ == origin_ && other.tag_ == tag_;
+}
+
+bool BackgroundFetchRegistrationId::operator!=(
+ const BackgroundFetchRegistrationId& other) const {
+ return !(*this == other);
+}
+
+bool BackgroundFetchRegistrationId::operator<(
+ const BackgroundFetchRegistrationId& other) const {
+ return service_worker_registration_id_ <
+ other.service_worker_registration_id_ ||
+ origin_ < other.origin_ || tag_ < other.tag_;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698