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 moz_dom_ServiceWorkerContainerProxy_h
8 #define moz_dom_ServiceWorkerContainerProxy_h
9 
10 #include "mozilla/dom/ServiceWorkerUtils.h"
11 #include "mozilla/RefPtr.h"
12 
13 namespace mozilla {
14 namespace dom {
15 
16 class ServiceWorkerContainerParent;
17 
18 class ServiceWorkerContainerProxy final {
19   // Background thread only
20   RefPtr<ServiceWorkerContainerParent> mActor;
21 
22   ~ServiceWorkerContainerProxy();
23 
24  public:
25   explicit ServiceWorkerContainerProxy(ServiceWorkerContainerParent* aActor);
26 
27   void RevokeActor(ServiceWorkerContainerParent* aActor);
28 
29   RefPtr<ServiceWorkerRegistrationPromise> Register(
30       const ClientInfo& aClientInfo, const nsCString& aScopeURL,
31       const nsCString& aScriptURL, ServiceWorkerUpdateViaCache aUpdateViaCache);
32 
33   RefPtr<ServiceWorkerRegistrationPromise> GetRegistration(
34       const ClientInfo& aClientInfo, const nsCString& aURL);
35 
36   RefPtr<ServiceWorkerRegistrationListPromise> GetRegistrations(
37       const ClientInfo& aClientInfo);
38 
39   RefPtr<ServiceWorkerRegistrationPromise> GetReady(
40       const ClientInfo& aClientInfo);
41 
42   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ServiceWorkerContainerProxy);
43 };
44 
45 }  // namespace dom
46 }  // namespace mozilla
47 
48 #endif  // moz_dom_ServiceWorkerContainerProxy_h
49