Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_CLIENT_BACKGROUND_SYNC_REGISTRATION_H_ | |
| 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_CLIENT_BACKGROUND_SYNC_REGISTRATION_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "content/browser/background_sync/background_sync_registration.h" | |
| 10 #include "content/browser/background_sync/background_sync_status.h" | |
| 11 #include "content/common/content_export.h" | |
| 12 | |
| 13 namespace content { | |
| 14 | |
| 15 class BackgroundSyncManager; | |
| 16 | |
| 17 // BackgroundSyncRegistrations that are exposed to clients. They call | |
| 18 // ReleaseRegistration on deletion and provide access to Unregister. | |
| 19 // ClientBackgroundSyncRegistration objects must be deleted before the | |
| 20 // BackgroundSyncManager is deleted. | |
| 21 class CONTENT_EXPORT ClientBackgroundSyncRegistration | |
| 22 : public BackgroundSyncRegistration { | |
|
michaeln
2015/08/19 01:56:01
This derivation seems a little odd to me.
(I thin
jkarlin
2015/08/19 12:47:06
That's fair. Perhaps it shouldn't be a sub-class o
jkarlin
2015/08/19 17:24:22
Ah, I think perhaps you're getting at something li
| |
| 23 public: | |
| 24 using StatusCallback = base::Callback<void(BackgroundSyncStatus)>; | |
| 25 | |
| 26 explicit ClientBackgroundSyncRegistration( | |
| 27 BackgroundSyncManager* background_sync_manager); | |
| 28 ~ClientBackgroundSyncRegistration() override; | |
| 29 | |
| 30 // Unregisters the background sync registration. Calls |callback| | |
| 31 // with BACKGROUND_SYNC_STATUS_OK if it succeeds. | |
| 32 void Unregister(int64 service_worker_id, const StatusCallback& callback); | |
|
michaeln
2015/08/19 01:56:01
ah, now i see there unregister has gone
jkarlin
2015/08/19 12:47:06
Acknowledged.
| |
| 33 | |
| 34 bool IsValid() const override; | |
| 35 | |
| 36 private: | |
| 37 // This object must be deleted before the BackgroundSyncManager | |
| 38 // is deleted. | |
|
michaeln
2015/08/19 01:56:01
It might be worth using weakptrs here since these
jkarlin
2015/08/19 12:47:06
There is a DCHECK to verify that clients call it p
| |
| 39 BackgroundSyncManager* background_sync_manager_; | |
| 40 | |
| 41 DISALLOW_COPY_AND_ASSIGN(ClientBackgroundSyncRegistration); | |
| 42 }; | |
| 43 | |
| 44 } // namespace | |
| 45 | |
| 46 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_CLIENT_BACKGROUND_SYNC_REGISTRATION_H _ | |
| OLD | NEW |