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

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

Issue 1282013004: BackgroundSyncManager tracks client registrations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android fix Created 5 years, 4 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/client_background_sync_registration.h
diff --git a/content/browser/background_sync/client_background_sync_registration.h b/content/browser/background_sync/client_background_sync_registration.h
new file mode 100644
index 0000000000000000000000000000000000000000..f0f8a8fc41e00cd42b90af784ab9bf009494e55b
--- /dev/null
+++ b/content/browser/background_sync/client_background_sync_registration.h
@@ -0,0 +1,42 @@
+// Copyright 2015 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.
+
+#ifndef CONTENT_BROWSER_BACKGROUND_SYNC_CLIENT_BACKGROUND_SYNC_REGISTRATION_H_
+#define CONTENT_BROWSER_BACKGROUND_SYNC_CLIENT_BACKGROUND_SYNC_REGISTRATION_H_
+
+#include "base/callback.h"
+#include "content/browser/background_sync/background_sync_registration.h"
+#include "content/browser/background_sync/background_sync_status.h"
+#include "content/common/content_export.h"
+
+namespace content {
+
+class BackgroundSyncManager;
+
+// BackgroundSyncRegistrations that are exposed to clients. They call
+// ReleaseRegistration on deletion and provide access to Unregister.
+// ClientBackgroundSyncRegistration objects must be deleted before the
+// BackgroundSyncManager is deleted.
+class CONTENT_EXPORT ClientBackgroundSyncRegistration
+ : public BackgroundSyncRegistration {
+ public:
+ using StatusCallback = base::Callback<void(BackgroundSyncStatus)>;
+
+ explicit ClientBackgroundSyncRegistration(
+ BackgroundSyncManager* background_sync_manager);
+ ~ClientBackgroundSyncRegistration() override;
+
+ void Unregister(int64 service_worker_id, const StatusCallback& callback);
+
+ private:
+ // This object must be deleted before the BackgroundSyncManager
+ // is deleted.
+ BackgroundSyncManager* background_sync_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClientBackgroundSyncRegistration);
+};
+
+} // namespace
+
+#endif // CONTENT_BROWSER_BACKGROUND_SYNC_CLIENT_BACKGROUND_SYNC_REGISTRATION_H_

Powered by Google App Engine
This is Rietveld 408576698