1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #ifndef mozilla_dom_remoteserviceworkercontainerimpl_h__
8 #define mozilla_dom_remoteserviceworkercontainerimpl_h__
9 
10 #include "ServiceWorkerContainer.h"
11 
12 namespace mozilla {
13 namespace dom {
14 
15 class ServiceWorkerContainerChild;
16 
17 class RemoteServiceWorkerContainerImpl final
18     : public ServiceWorkerContainer::Inner {
19   RefPtr<ServiceWorkerContainerChild> mActor;
20   ServiceWorkerContainer* mOuter;
21   bool mShutdown;
22 
23   ~RemoteServiceWorkerContainerImpl();
24 
25   void Shutdown();
26 
27   // ServiceWorkerContainer::Inner implementation
28   void AddContainer(ServiceWorkerContainer* aOuter) override;
29 
30   void RemoveContainer(ServiceWorkerContainer* aOuter) override;
31 
32   void Register(const ClientInfo& aClientInfo, const nsACString& aScopeURL,
33                 const nsACString& aScriptURL,
34                 ServiceWorkerUpdateViaCache aUpdateViaCache,
35                 ServiceWorkerRegistrationCallback&& aSuccessCB,
36                 ServiceWorkerFailureCallback&& aFailureCB) const override;
37 
38   void GetRegistration(
39       const ClientInfo& aClientInfo, const nsACString& aURL,
40       ServiceWorkerRegistrationCallback&& aSuccessCB,
41       ServiceWorkerFailureCallback&& aFailureCB) const override;
42 
43   void GetRegistrations(
44       const ClientInfo& aClientInfo,
45       ServiceWorkerRegistrationListCallback&& aSuccessCB,
46       ServiceWorkerFailureCallback&& aFailureCB) const override;
47 
48   void GetReady(const ClientInfo& aClientInfo,
49                 ServiceWorkerRegistrationCallback&& aSuccessCB,
50                 ServiceWorkerFailureCallback&& aFailureCB) const override;
51 
52  public:
53   RemoteServiceWorkerContainerImpl();
54 
55   void RevokeActor(ServiceWorkerContainerChild* aActor);
56 
57   NS_INLINE_DECL_REFCOUNTING(RemoteServiceWorkerContainerImpl, override)
58 };
59 
60 }  // namespace dom
61 }  // namespace mozilla
62 
63 #endif  // mozilla_dom_remoteserviceworkercontainerimpl_h__
64