Commit d065863f authored by jkarlin's avatar jkarlin Committed by Commit bot

[BackgroundSync] Remove RegistrationKey

Now that periodic syncs are out of the BackgroundSyncManager we no
longer need the RegistrationKey and can index registrations by tag.

BUG=592599

Review URL: https://codereview.chromium.org/1774603002

Cr-Commit-Position: refs/heads/master@{#381542}
parent 356ff332
...@@ -128,25 +128,8 @@ class CONTENT_EXPORT BackgroundSyncManager ...@@ -128,25 +128,8 @@ class CONTENT_EXPORT BackgroundSyncManager
friend class TestBackgroundSyncManager; friend class TestBackgroundSyncManager;
friend class BackgroundSyncManagerTest; friend class BackgroundSyncManagerTest;
class RegistrationKey {
public:
explicit RegistrationKey(const BackgroundSyncRegistration& registration);
explicit RegistrationKey(const BackgroundSyncRegistrationOptions& options);
RegistrationKey(const std::string& tag);
RegistrationKey(const RegistrationKey& other) = default;
RegistrationKey& operator=(const RegistrationKey& other) = default;
bool operator<(const RegistrationKey& rhs) const {
return value_ < rhs.value_;
}
private:
std::string value_;
};
struct BackgroundSyncRegistrations { struct BackgroundSyncRegistrations {
using RegistrationMap = using RegistrationMap = std::map<std::string, BackgroundSyncRegistration>;
std::map<RegistrationKey, BackgroundSyncRegistration>;
BackgroundSyncRegistrations(); BackgroundSyncRegistrations();
BackgroundSyncRegistrations(const BackgroundSyncRegistrations& other); BackgroundSyncRegistrations(const BackgroundSyncRegistrations& other);
...@@ -178,7 +161,7 @@ class CONTENT_EXPORT BackgroundSyncManager ...@@ -178,7 +161,7 @@ class CONTENT_EXPORT BackgroundSyncManager
// Returns the existing registration or nullptr if it cannot be found. // Returns the existing registration or nullptr if it cannot be found.
BackgroundSyncRegistration* LookupActiveRegistration( BackgroundSyncRegistration* LookupActiveRegistration(
int64_t sw_registration_id, int64_t sw_registration_id,
const RegistrationKey& registration_key); const std::string& tag);
// Write all registrations for a given |sw_registration_id| to persistent // Write all registrations for a given |sw_registration_id| to persistent
// storage. // storage.
...@@ -187,7 +170,7 @@ class CONTENT_EXPORT BackgroundSyncManager ...@@ -187,7 +170,7 @@ class CONTENT_EXPORT BackgroundSyncManager
// Removes the active registration if it is in the map. // Removes the active registration if it is in the map.
void RemoveActiveRegistration(int64_t sw_registration_id, void RemoveActiveRegistration(int64_t sw_registration_id,
const RegistrationKey& registration_key); const std::string& tag);
void AddActiveRegistration( void AddActiveRegistration(
int64_t sw_registration_id, int64_t sw_registration_id,
...@@ -243,7 +226,7 @@ class CONTENT_EXPORT BackgroundSyncManager ...@@ -243,7 +226,7 @@ class CONTENT_EXPORT BackgroundSyncManager
void FireReadyEvents(); void FireReadyEvents();
void FireReadyEventsImpl(const base::Closure& callback); void FireReadyEventsImpl(const base::Closure& callback);
void FireReadyEventsDidFindRegistration( void FireReadyEventsDidFindRegistration(
const RegistrationKey& registration_key, const std::string& tag,
BackgroundSyncRegistration::RegistrationId registration_id, BackgroundSyncRegistration::RegistrationId registration_id,
const base::Closure& event_fired_callback, const base::Closure& event_fired_callback,
const base::Closure& event_completed_callback, const base::Closure& event_completed_callback,
...@@ -256,11 +239,11 @@ class CONTENT_EXPORT BackgroundSyncManager ...@@ -256,11 +239,11 @@ class CONTENT_EXPORT BackgroundSyncManager
void EventComplete(const scoped_refptr<ServiceWorkerRegistration>& void EventComplete(const scoped_refptr<ServiceWorkerRegistration>&
service_worker_registration, service_worker_registration,
int64_t service_worker_id, int64_t service_worker_id,
const RegistrationKey& registration_key, const std::string& tag,
const base::Closure& callback, const base::Closure& callback,
ServiceWorkerStatusCode status_code); ServiceWorkerStatusCode status_code);
void EventCompleteImpl(int64_t service_worker_id, void EventCompleteImpl(int64_t service_worker_id,
const RegistrationKey& registration_key, const std::string& tag,
ServiceWorkerStatusCode status_code, ServiceWorkerStatusCode status_code,
const base::Closure& callback); const base::Closure& callback);
void EventCompleteDidStore(int64_t service_worker_id, void EventCompleteDidStore(int64_t service_worker_id,
......
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