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

Unified Diff: content/browser/background_sync/background_sync_service_impl.h

Issue 1282013004: BackgroundSyncManager tracks client registrations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed test Created 5 years, 3 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_sync/background_sync_service_impl.h
diff --git a/content/browser/background_sync/background_sync_service_impl.h b/content/browser/background_sync/background_sync_service_impl.h
index 5733be960607025bfe23bd5554e56a34acc02792..7e17b7f0b68f7b193184aac0c449ae420aa5372e 100644
--- a/content/browser/background_sync/background_sync_service_impl.h
+++ b/content/browser/background_sync/background_sync_service_impl.h
@@ -5,9 +5,9 @@
#ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_SERVICE_IMPL_H_
#define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_SERVICE_IMPL_H_
-#include <vector>
-
+#include "base/id_map.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_vector.h"
#include "content/browser/background_sync/background_sync_manager.h"
#include "content/common/background_sync_service.mojom.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
@@ -28,15 +28,13 @@ class CONTENT_EXPORT BackgroundSyncServiceImpl
private:
friend class BackgroundSyncServiceImplTest;
-
// BackgroundSyncService methods:
void Register(content::SyncRegistrationPtr options,
int64_t sw_registration_id,
bool requested_from_service_worker,
const RegisterCallback& callback) override;
void Unregister(BackgroundSyncPeriodicity periodicity,
- int64_t id,
- const mojo::String& tag,
+ BackgroundSyncRegistrationHandle::HandleId handle_id,
int64_t sw_registration_id,
const UnregisterCallback& callback) override;
void GetRegistration(BackgroundSyncPeriodicity periodicity,
@@ -50,16 +48,21 @@ class CONTENT_EXPORT BackgroundSyncServiceImpl
BackgroundSyncPeriodicity periodicity,
int64_t sw_registration_id,
const GetPermissionStatusCallback& callback) override;
+ void DuplicateRegistrationHandle(
+ BackgroundSyncRegistrationHandle::HandleId handle_id,
+ const DuplicateRegistrationHandleCallback& callback) override;
+ void ReleaseRegistration(
+ BackgroundSyncRegistrationHandle::HandleId handle_id) override;
void OnRegisterResult(const RegisterCallback& callback,
BackgroundSyncStatus status,
- const BackgroundSyncRegistration& result);
+ scoped_ptr<BackgroundSyncRegistrationHandle> result);
void OnUnregisterResult(const UnregisterCallback& callback,
BackgroundSyncStatus status);
void OnGetRegistrationsResult(
const GetRegistrationsCallback& callback,
BackgroundSyncStatus status,
- const std::vector<BackgroundSyncRegistration>& result);
+ scoped_ptr<ScopedVector<BackgroundSyncRegistrationHandle>> result);
// Called when an error is detected on binding_.
void OnConnectionError();
@@ -69,6 +72,9 @@ class CONTENT_EXPORT BackgroundSyncServiceImpl
mojo::Binding<BackgroundSyncService> binding_;
+ // The registrations that the client might reference.
+ IDMap<BackgroundSyncRegistrationHandle, IDMapOwnPointer> active_handles_;
+
base::WeakPtrFactory<BackgroundSyncServiceImpl> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(BackgroundSyncServiceImpl);

Powered by Google App Engine
This is Rietveld 408576698