Bug 1459209 P1 Add IPC actor boilerplate for PServiceWorker, PServiceWorkerContainer, and PServiceWorkerRegistration. r=mrbkap
authorBen Kelly <ben@wanderview.com>
Mon, 09 Jul 2018 16:02:39 -0700
changeset 480802 a20adca36f9c833b37ff5c2f13e3783df775a7b3
parent 480801 09380f0f8aea557beb724192b355985bd1e28e2b
child 480803 a5c3aa4b30f954490724034f71b1ab47ae000b44
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs1459209
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1459209 P1 Add IPC actor boilerplate for PServiceWorker, PServiceWorkerContainer, and PServiceWorkerRegistration. r=mrbkap
dom/serviceworkers/PServiceWorker.ipdl
dom/serviceworkers/PServiceWorkerContainer.ipdl
dom/serviceworkers/PServiceWorkerRegistration.ipdl
dom/serviceworkers/ServiceWorkerActors.cpp
dom/serviceworkers/ServiceWorkerActors.h
dom/serviceworkers/ServiceWorkerChild.cpp
dom/serviceworkers/ServiceWorkerChild.h
dom/serviceworkers/ServiceWorkerContainerChild.cpp
dom/serviceworkers/ServiceWorkerContainerChild.h
dom/serviceworkers/ServiceWorkerContainerParent.cpp
dom/serviceworkers/ServiceWorkerContainerParent.h
dom/serviceworkers/ServiceWorkerParent.cpp
dom/serviceworkers/ServiceWorkerParent.h
dom/serviceworkers/ServiceWorkerPrivate.h
dom/serviceworkers/ServiceWorkerRegistrationChild.cpp
dom/serviceworkers/ServiceWorkerRegistrationChild.h
dom/serviceworkers/ServiceWorkerRegistrationParent.cpp
dom/serviceworkers/ServiceWorkerRegistrationParent.h
dom/serviceworkers/ServiceWorkerUtils.cpp
dom/serviceworkers/ServiceWorkerUtils.h
dom/serviceworkers/moz.build
ipc/glue/BackgroundChildImpl.cpp
ipc/glue/BackgroundChildImpl.h
ipc/glue/BackgroundParentImpl.cpp
ipc/glue/BackgroundParentImpl.h
ipc/glue/PBackground.ipdl
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/PServiceWorker.ipdl
@@ -0,0 +1,22 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+include protocol PBackground;
+
+namespace mozilla {
+namespace dom {
+
+protocol PServiceWorker
+{
+  manager PBackground;
+
+parent:
+  async Teardown();
+
+child:
+  async __delete__();
+};
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/PServiceWorkerContainer.ipdl
@@ -0,0 +1,22 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+include protocol PBackground;
+
+namespace mozilla {
+namespace dom {
+
+protocol PServiceWorkerContainer
+{
+  manager PBackground;
+
+parent:
+  async Teardown();
+
+child:
+  async __delete__();
+};
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/PServiceWorkerRegistration.ipdl
@@ -0,0 +1,22 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+include protocol PBackground;
+
+namespace mozilla {
+namespace dom {
+
+protocol PServiceWorkerRegistration
+{
+  manager PBackground;
+
+parent:
+  async Teardown();
+
+child:
+  async __delete__();
+};
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/ServiceWorkerActors.cpp
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "ServiceWorkerActors.h"
+
+#include "ServiceWorkerChild.h"
+#include "ServiceWorkerContainerChild.h"
+#include "ServiceWorkerContainerParent.h"
+#include "ServiceWorkerParent.h"
+#include "ServiceWorkerRegistrationChild.h"
+#include "ServiceWorkerRegistrationParent.h"
+
+namespace mozilla {
+namespace dom {
+
+PServiceWorkerChild*
+AllocServiceWorkerChild()
+{
+  return new ServiceWorkerChild();
+}
+
+bool
+DeallocServiceWorkerChild(PServiceWorkerChild* aActor)
+{
+  auto actor = static_cast<ServiceWorkerChild*>(aActor);
+  delete actor;
+  return true;
+}
+
+PServiceWorkerParent*
+AllocServiceWorkerParent()
+{
+  return new ServiceWorkerParent();
+}
+
+bool
+DeallocServiceWorkerParent(PServiceWorkerParent* aActor)
+{
+  auto actor = static_cast<ServiceWorkerParent*>(aActor);
+  delete actor;
+  return true;
+}
+
+void
+InitServiceWorkerParent(PServiceWorkerParent* aActor,
+                        const IPCServiceWorkerDescriptor& aDescriptor)
+{
+  auto actor = static_cast<ServiceWorkerParent*>(aActor);
+  actor->Init(aDescriptor);
+}
+
+PServiceWorkerContainerChild*
+AllocServiceWorkerContainerChild()
+{
+  return new ServiceWorkerContainerChild();
+}
+
+bool
+DeallocServiceWorkerContainerChild(PServiceWorkerContainerChild* aActor)
+{
+  auto actor = static_cast<ServiceWorkerContainerChild*>(aActor);
+  delete actor;
+  return true;
+}
+
+PServiceWorkerContainerParent*
+AllocServiceWorkerContainerParent()
+{
+  return new ServiceWorkerContainerParent();
+}
+
+bool
+DeallocServiceWorkerContainerParent(PServiceWorkerContainerParent* aActor)
+{
+  auto actor = static_cast<ServiceWorkerContainerParent*>(aActor);
+  delete actor;
+  return true;
+}
+
+void
+InitServiceWorkerContainerParent(PServiceWorkerContainerParent* aActor)
+{
+  auto actor = static_cast<ServiceWorkerContainerParent*>(aActor);
+  actor->Init();
+}
+
+PServiceWorkerRegistrationChild*
+AllocServiceWorkerRegistrationChild()
+{
+  return new ServiceWorkerRegistrationChild();
+}
+
+bool
+DeallocServiceWorkerRegistrationChild(PServiceWorkerRegistrationChild* aActor)
+{
+  auto actor = static_cast<ServiceWorkerRegistrationChild*>(aActor);
+  delete actor;
+  return true;
+}
+
+PServiceWorkerRegistrationParent*
+AllocServiceWorkerRegistrationParent()
+{
+  return new ServiceWorkerRegistrationParent();
+}
+
+bool
+DeallocServiceWorkerRegistrationParent(PServiceWorkerRegistrationParent* aActor)
+{
+  auto actor = static_cast<ServiceWorkerRegistrationParent*>(aActor);
+  delete actor;
+  return true;
+}
+
+void
+InitServiceWorkerRegistrationParent(PServiceWorkerRegistrationParent* aActor,
+                                    const IPCServiceWorkerRegistrationDescriptor& aDescriptor)
+{
+  auto actor = static_cast<ServiceWorkerRegistrationParent*>(aActor);
+  actor->Init(aDescriptor);
+}
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/ServiceWorkerActors.h
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_serviceworkeractors_h__
+#define mozilla_dom_serviceworkeractors_h__
+
+namespace mozilla {
+namespace dom {
+
+// PServiceWorker
+
+class IPCServiceWorkerDescriptor;
+class PServiceWorkerChild;
+class PServiceWorkerParent;
+
+PServiceWorkerChild*
+AllocServiceWorkerChild();
+
+bool
+DeallocServiceWorkerChild(PServiceWorkerChild* aActor);
+
+PServiceWorkerParent*
+AllocServiceWorkerParent();
+
+bool
+DeallocServiceWorkerParent(PServiceWorkerParent* aActor);
+
+void
+InitServiceWorkerParent(PServiceWorkerParent* aActor,
+                        const IPCServiceWorkerDescriptor& aDescriptor);
+
+// PServiceWorkerContainer
+
+class PServiceWorkerContainerChild;
+class PServiceWorkerContainerParent;
+
+PServiceWorkerContainerChild*
+AllocServiceWorkerContainerChild();
+
+bool
+DeallocServiceWorkerContainerChild(PServiceWorkerContainerChild* aActor);
+
+PServiceWorkerContainerParent*
+AllocServiceWorkerContainerParent();
+
+bool
+DeallocServiceWorkerContainerParent(PServiceWorkerContainerParent* aActor);
+
+void
+InitServiceWorkerContainerParent(PServiceWorkerContainerParent* aActor);
+
+// PServiceWorkerRegistration
+
+class IPCServiceWorkerRegistrationDescriptor;
+class PServiceWorkerRegistrationChild;
+class PServiceWorkerRegistrationParent;
+
+PServiceWorkerRegistrationChild*
+AllocServiceWorkerRegistrationChild();
+
+bool
+DeallocServiceWorkerRegistrationChild(PServiceWorkerRegistrationChild* aActor);
+
+PServiceWorkerRegistrationParent*
+AllocServiceWorkerRegistrationParent();
+
+bool
+DeallocServiceWorkerRegistrationParent(PServiceWorkerRegistrationParent* aActor);
+
+void
+InitServiceWorkerRegistrationParent(PServiceWorkerRegistrationParent* aActor,
+                                    const IPCServiceWorkerRegistrationDescriptor& aDescriptor);
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_serviceworkeractors_h__
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/ServiceWorkerChild.cpp
@@ -0,0 +1,19 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "ServiceWorkerChild.h"
+
+namespace mozilla {
+namespace dom {
+
+void
+ServiceWorkerChild::ActorDestroy(ActorDestroyReason aReason)
+{
+  // TODO
+}
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/ServiceWorkerChild.h
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_serviceworkerchild_h__
+#define mozilla_dom_serviceworkerchild_h__
+
+#include "mozilla/dom/PServiceWorkerChild.h"
+
+namespace mozilla {
+namespace dom {
+
+class ServiceWorkerChild final : public PServiceWorkerChild
+{
+  // PServiceWorkerChild
+  void
+  ActorDestroy(ActorDestroyReason aReason) override;
+
+public:
+  ServiceWorkerChild() = default;
+  ~ServiceWorkerChild() = default;
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_serviceworkerchild_h__
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/ServiceWorkerContainerChild.cpp
@@ -0,0 +1,19 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/dom/PServiceWorkerContainerChild.h"
+
+namespace mozilla {
+namespace dom {
+
+void
+ServiceWorkerContainerChild::ActorDestroy(ActorDestroyReason aReason)
+{
+  // TODO
+}
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/ServiceWorkerContainerChild.h
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_serviceworkercontainerchild_h__
+#define mozilla_dom_serviceworkercontainerchild_h__
+
+#include "mozilla/dom/PServiceWorkerContainerChild.h"
+
+namespace mozilla {
+namespace dom {
+
+class ServiceWorkerContainerChild final : public PServiceWorkerContainerChild
+{
+  // PServiceWorkerContainerChild
+  void
+  ActorDestroy(ActorDestroyReason aReason) override;
+
+public:
+  ServiceWorkerContainerChild() = default;
+  ~ServiceWorkerContainerChild() = default;
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_serviceworkercontainerchild_h__
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/ServiceWorkerContainerParent.cpp
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/dom/PServiceWorkerContainerParent.h"
+
+namespace mozilla {
+namespace dom {
+
+using mozilla::ipc::IPCResult;
+
+void
+ServiceWorkerContainerParent::ActorDestroy(ActorDestroyReason aReason)
+{
+  // TODO
+}
+
+IPCResult
+ServiceWorkerContainerParent::RecvTeardown()
+{
+  // TODO
+  return IPC_OK();
+}
+
+void
+ServiceWorkerContainerParent::Init()
+{
+  // TODO
+}
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/ServiceWorkerContainerParent.h
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_serviceworkercontainerparent_h__
+#define mozilla_dom_serviceworkercontainerparent_h__
+
+#include "mozilla/dom/PServiceWorkerContainerParent.h"
+
+namespace mozilla {
+namespace dom {
+
+class IPCServiceWorkerDescriptor;
+
+class ServiceWorkerContainerParent final : public PServiceWorkerContainerParent
+{
+  // PServiceWorkerContainerParent
+  void
+  ActorDestroy(ActorDestroyReason aReason) override;
+
+  mozilla::ipc::IPCResult
+  RecvTeardown() override;
+
+public:
+  ServiceWorkerContainerParent() = default;
+  ~ServiceWorkerContainerParent() = default;
+
+  void
+  Init();
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_serviceworkercontainerparent_h__
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/ServiceWorkerParent.cpp
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "ServiceWorkerParent.h"
+
+namespace mozilla {
+namespace dom {
+
+using mozilla::ipc::IPCResult;
+
+void
+ServiceWorkerParent::ActorDestroy(ActorDestroyReason aReason)
+{
+  // TODO
+}
+
+IPCResult
+ServiceWorkerParent::RecvTeardown()
+{
+  // TODO
+  return IPC_OK();
+}
+
+void
+ServiceWorkerParent::Init(const IPCServiceWorkerDescriptor& aDescriptor)
+{
+  // TODO
+}
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/ServiceWorkerParent.h
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_serviceworkerparent_h__
+#define mozilla_dom_serviceworkerparent_h__
+
+#include "mozilla/dom/PServiceWorkerParent.h"
+
+namespace mozilla {
+namespace dom {
+
+class IPCServiceWorkerDescriptor;
+
+class ServiceWorkerParent final : public PServiceWorkerParent
+{
+  // PServiceWorkerParent
+  void
+  ActorDestroy(ActorDestroyReason aReason) override;
+
+  mozilla::ipc::IPCResult
+  RecvTeardown() override;
+
+public:
+  ServiceWorkerParent() = default;
+  ~ServiceWorkerParent() = default;
+
+  void
+  Init(const IPCServiceWorkerDescriptor& aDescriptor);
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_serviceworkerparent_h__
--- a/dom/serviceworkers/ServiceWorkerPrivate.h
+++ b/dom/serviceworkers/ServiceWorkerPrivate.h
@@ -9,16 +9,17 @@
 
 #include "nsCOMPtr.h"
 #include "mozilla/dom/WorkerPrivate.h"
 
 #define NOTIFICATION_CLICK_EVENT_NAME "notificationclick"
 #define NOTIFICATION_CLOSE_EVENT_NAME "notificationclose"
 
 class nsIInterceptedChannel;
+class nsIWorkerDebugger;
 
 namespace mozilla {
 
 class JSObjectHolder;
 
 namespace dom {
 
 class ClientInfoAndState;
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/ServiceWorkerRegistrationChild.cpp
@@ -0,0 +1,19 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "ServiceWorkerRegistrationChild.h"
+
+namespace mozilla {
+namespace dom {
+
+void
+ServiceWorkerRegistrationChild::ActorDestroy(ActorDestroyReason aReason)
+{
+  // TODO
+}
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/ServiceWorkerRegistrationChild.h
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_serviceworkerregistrationchild_h__
+#define mozilla_dom_serviceworkerregistrationchild_h__
+
+#include "mozilla/dom/PServiceWorkerRegistrationChild.h"
+
+namespace mozilla {
+namespace dom {
+
+class ServiceWorkerRegistrationChild final : public PServiceWorkerRegistrationChild
+{
+  // PServiceWorkerRegistrationChild
+  void
+  ActorDestroy(ActorDestroyReason aReason) override;
+
+public:
+  ServiceWorkerRegistrationChild() = default;
+  ~ServiceWorkerRegistrationChild() = default;
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_serviceworkerregistrationchild_h__
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/ServiceWorkerRegistrationParent.cpp
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "ServiceWorkerRegistrationParent.h"
+
+namespace mozilla {
+namespace dom {
+
+using mozilla::ipc::IPCResult;
+
+void
+ServiceWorkerRegistrationParent::ActorDestroy(ActorDestroyReason aReason)
+{
+  // TODO
+}
+
+IPCResult
+ServiceWorkerRegistrationParent::RecvTeardown()
+{
+  // TODO
+  return IPC_OK();
+}
+
+void
+ServiceWorkerRegistrationParent::Init(const IPCServiceWorkerRegistrationDescriptor& aDescriptor)
+{
+  // TODO
+}
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/serviceworkers/ServiceWorkerRegistrationParent.h
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_serviceworkerregistrationparent_h__
+#define mozilla_dom_serviceworkerregistrationparent_h__
+
+#include "mozilla/dom/PServiceWorkerRegistrationParent.h"
+
+namespace mozilla {
+namespace dom {
+
+class IPCServiceWorkerRegistrationDescriptor;
+
+class ServiceWorkerRegistrationParent final : public PServiceWorkerRegistrationParent
+{
+  // PServiceWorkerRegistrationParent
+  void
+  ActorDestroy(ActorDestroyReason aReason) override;
+
+  mozilla::ipc::IPCResult
+  RecvTeardown() override;
+
+public:
+  ServiceWorkerRegistrationParent() = default;
+  ~ServiceWorkerRegistrationParent() = default;
+
+  void
+  Init(const IPCServiceWorkerRegistrationDescriptor& aDescriptor);
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_serviceworkerregistrationparent_h__
--- a/dom/serviceworkers/ServiceWorkerUtils.cpp
+++ b/dom/serviceworkers/ServiceWorkerUtils.cpp
@@ -2,16 +2,19 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ServiceWorkerUtils.h"
 
 #include "mozilla/Preferences.h"
+#include "mozilla/dom/ClientInfo.h"
+#include "mozilla/dom/ServiceWorkerRegistrarTypes.h"
+#include "nsIURL.h"
 
 namespace mozilla {
 namespace dom {
 
 
 bool
 ServiceWorkerParentInterceptEnabled()
 {
--- a/dom/serviceworkers/ServiceWorkerUtils.h
+++ b/dom/serviceworkers/ServiceWorkerUtils.h
@@ -5,22 +5,25 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifndef _mozilla_dom_ServiceWorkerUtils_h
 #define _mozilla_dom_ServiceWorkerUtils_h
 
 #include "mozilla/MozPromise.h"
 #include "mozilla/dom/ServiceWorkerRegistrationDescriptor.h"
 #include "nsTArray.h"
 
+class nsIURI;
+
 namespace mozilla {
 
-class ErrorResult;
+class CopyableErrorResult;
 
 namespace dom {
 
+class ClientInfo;
 class ServiceWorkerRegistrationData;
 class ServiceWorkerRegistrationDescriptor;
 
 typedef MozPromise<ServiceWorkerRegistrationDescriptor, CopyableErrorResult, false>
         ServiceWorkerRegistrationPromise;
 
 typedef MozPromise<nsTArray<ServiceWorkerRegistrationDescriptor>, CopyableErrorResult, false>
         ServiceWorkerRegistrationListPromise;
--- a/dom/serviceworkers/moz.build
+++ b/dom/serviceworkers/moz.build
@@ -5,16 +5,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "DOM: Service Workers")
 
 # Public stuff.
 EXPORTS.mozilla.dom += [
     'ServiceWorker.h',
+    'ServiceWorkerActors.h',
     'ServiceWorkerContainer.h',
     'ServiceWorkerDescriptor.h',
     'ServiceWorkerEvents.h',
     'ServiceWorkerInfo.h',
     'ServiceWorkerInterceptController.h',
     'ServiceWorkerIPCUtils.h',
     'ServiceWorkerManager.h',
     'ServiceWorkerManagerChild.h',
@@ -23,49 +24,59 @@ EXPORTS.mozilla.dom += [
     'ServiceWorkerRegistration.h',
     'ServiceWorkerRegistrationDescriptor.h',
     'ServiceWorkerRegistrationInfo.h',
     'ServiceWorkerUtils.h',
 ]
 
 UNIFIED_SOURCES += [
     'ServiceWorker.cpp',
+    'ServiceWorkerActors.cpp',
+    'ServiceWorkerChild.cpp',
     'ServiceWorkerCloneData.cpp',
     'ServiceWorkerContainer.cpp',
+    'ServiceWorkerContainerChild.cpp',
     'ServiceWorkerContainerImpl.cpp',
+    'ServiceWorkerContainerParent.cpp',
     'ServiceWorkerDescriptor.cpp',
     'ServiceWorkerEvents.cpp',
     'ServiceWorkerImpl.cpp',
     'ServiceWorkerInfo.cpp',
     'ServiceWorkerInterceptController.cpp',
     'ServiceWorkerJob.cpp',
     'ServiceWorkerJobQueue.cpp',
     'ServiceWorkerManager.cpp',
     'ServiceWorkerManagerChild.cpp',
     'ServiceWorkerManagerParent.cpp',
     'ServiceWorkerManagerService.cpp',
+    'ServiceWorkerParent.cpp',
     'ServiceWorkerPrivate.cpp',
     'ServiceWorkerRegisterJob.cpp',
     'ServiceWorkerRegistrar.cpp',
     'ServiceWorkerRegistration.cpp',
+    'ServiceWorkerRegistrationChild.cpp',
     'ServiceWorkerRegistrationDescriptor.cpp',
     'ServiceWorkerRegistrationImpl.cpp',
     'ServiceWorkerRegistrationInfo.cpp',
+    'ServiceWorkerRegistrationParent.cpp',
     'ServiceWorkerScriptCache.cpp',
     'ServiceWorkerUnregisterJob.cpp',
     'ServiceWorkerUpdateJob.cpp',
     'ServiceWorkerUpdaterChild.cpp',
     'ServiceWorkerUpdaterParent.cpp',
     'ServiceWorkerUtils.cpp',
 ]
 
 IPDL_SOURCES += [
     'IPCServiceWorkerDescriptor.ipdlh',
     'IPCServiceWorkerRegistrationDescriptor.ipdlh',
+    'PServiceWorker.ipdl',
+    'PServiceWorkerContainer.ipdl',
     'PServiceWorkerManager.ipdl',
+    'PServiceWorkerRegistration.ipdl',
     'PServiceWorkerUpdater.ipdl',
     'ServiceWorkerRegistrarTypes.ipdlh',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
--- a/ipc/glue/BackgroundChildImpl.cpp
+++ b/ipc/glue/BackgroundChildImpl.cpp
@@ -26,16 +26,17 @@
 #include "mozilla/dom/ipc/PendingIPCBlobChild.h"
 #include "mozilla/dom/ipc/TemporaryIPCBlobChild.h"
 #include "mozilla/dom/quota/PQuotaChild.h"
 #include "mozilla/dom/StorageIPC.h"
 #include "mozilla/dom/GamepadEventChannelChild.h"
 #include "mozilla/dom/GamepadTestChannelChild.h"
 #include "mozilla/dom/LocalStorage.h"
 #include "mozilla/dom/MessagePortChild.h"
+#include "mozilla/dom/ServiceWorkerActors.h"
 #include "mozilla/dom/ServiceWorkerManagerChild.h"
 #include "mozilla/dom/TabChild.h"
 #include "mozilla/dom/TabGroup.h"
 #include "mozilla/ipc/IPCStreamAlloc.h"
 #include "mozilla/ipc/PBackgroundTestChild.h"
 #include "mozilla/ipc/PChildToParentStreamChild.h"
 #include "mozilla/ipc/PParentToChildStreamChild.h"
 #include "mozilla/layout/VsyncChild.h"
@@ -81,16 +82,19 @@ namespace ipc {
 using mozilla::dom::UDPSocketChild;
 using mozilla::net::PUDPSocketChild;
 
 using mozilla::dom::asmjscache::PAsmJSCacheEntryChild;
 using mozilla::dom::cache::PCacheChild;
 using mozilla::dom::cache::PCacheStorageChild;
 using mozilla::dom::cache::PCacheStreamControlChild;
 using mozilla::dom::LocalStorage;
+using mozilla::dom::PServiceWorkerChild;
+using mozilla::dom::PServiceWorkerContainerChild;
+using mozilla::dom::PServiceWorkerRegistrationChild;
 using mozilla::dom::StorageDBChild;
 
 using mozilla::dom::WebAuthnTransactionChild;
 
 using mozilla::dom::PMIDIPortChild;
 using mozilla::dom::PMIDIManagerChild;
 
 // -----------------------------------------------------------------------------
@@ -670,16 +674,52 @@ BackgroundChildImpl::DeallocPHttpBackgro
   // The reference is increased in BackgroundChannelCreateCallback::ActorCreated
   // of HttpBackgroundChannelChild.cpp. We should decrease it after IPC
   // destroyed.
   RefPtr<net::HttpBackgroundChannelChild> child =
     dont_AddRef(static_cast<net::HttpBackgroundChannelChild*>(aActor));
   return true;
 }
 
+PServiceWorkerChild*
+BackgroundChildImpl::AllocPServiceWorkerChild(const IPCServiceWorkerDescriptor&)
+{
+  return dom::AllocServiceWorkerChild();
+}
+
+bool
+BackgroundChildImpl::DeallocPServiceWorkerChild(PServiceWorkerChild* aActor)
+{
+  return dom::DeallocServiceWorkerChild(aActor);
+}
+
+PServiceWorkerContainerChild*
+BackgroundChildImpl::AllocPServiceWorkerContainerChild()
+{
+  return dom::AllocServiceWorkerContainerChild();
+}
+
+bool
+BackgroundChildImpl::DeallocPServiceWorkerContainerChild(PServiceWorkerContainerChild* aActor)
+{
+  return dom::DeallocServiceWorkerContainerChild(aActor);
+}
+
+PServiceWorkerRegistrationChild*
+BackgroundChildImpl::AllocPServiceWorkerRegistrationChild(const IPCServiceWorkerRegistrationDescriptor&)
+{
+  return dom::AllocServiceWorkerRegistrationChild();
+}
+
+bool
+BackgroundChildImpl::DeallocPServiceWorkerRegistrationChild(PServiceWorkerRegistrationChild* aActor)
+{
+  return dom::DeallocServiceWorkerRegistrationChild(aActor);
+}
+
 mozilla::ipc::IPCResult
 BackgroundChildImpl::RecvDispatchLocalStorageChange(
                                             const nsString& aDocumentURI,
                                             const nsString& aKey,
                                             const nsString& aOldValue,
                                             const nsString& aNewValue,
                                             const PrincipalInfo& aPrincipalInfo,
                                             const bool& aIsPrivate)
--- a/ipc/glue/BackgroundChildImpl.h
+++ b/ipc/glue/BackgroundChildImpl.h
@@ -239,16 +239,34 @@ protected:
   GetMessageSchedulerGroups(const Message& aMsg, SchedulerGroupSet& aGroups) override;
 
   virtual PMIDIPortChild* AllocPMIDIPortChild(const MIDIPortInfo& aPortInfo,
                                               const bool& aSysexEnabled) override;
   virtual bool DeallocPMIDIPortChild(PMIDIPortChild*) override;
 
   virtual PMIDIManagerChild* AllocPMIDIManagerChild() override;
   virtual bool DeallocPMIDIManagerChild(PMIDIManagerChild*) override;
+
+  virtual PServiceWorkerChild*
+  AllocPServiceWorkerChild(const IPCServiceWorkerDescriptor&) override;
+
+  virtual bool
+  DeallocPServiceWorkerChild(PServiceWorkerChild*) override;
+
+  virtual PServiceWorkerContainerChild*
+  AllocPServiceWorkerContainerChild() override;
+
+  virtual bool
+  DeallocPServiceWorkerContainerChild(PServiceWorkerContainerChild*) override;
+
+  virtual PServiceWorkerRegistrationChild*
+  AllocPServiceWorkerRegistrationChild(const IPCServiceWorkerRegistrationDescriptor&) override;
+
+  virtual bool
+  DeallocPServiceWorkerRegistrationChild(PServiceWorkerRegistrationChild*) override;
 };
 
 class BackgroundChildImpl::ThreadLocal final
 {
   friend class nsAutoPtr<ThreadLocal>;
 
 public:
   nsAutoPtr<mozilla::dom::indexedDB::ThreadLocal> mIndexedDBThreadLocal;
--- a/ipc/glue/BackgroundParentImpl.cpp
+++ b/ipc/glue/BackgroundParentImpl.cpp
@@ -18,16 +18,17 @@
 #include "mozilla/dom/DOMTypes.h"
 #include "mozilla/dom/FileSystemBase.h"
 #include "mozilla/dom/FileSystemRequestParent.h"
 #include "mozilla/dom/GamepadEventChannelParent.h"
 #include "mozilla/dom/GamepadTestChannelParent.h"
 #include "mozilla/dom/PGamepadEventChannelParent.h"
 #include "mozilla/dom/PGamepadTestChannelParent.h"
 #include "mozilla/dom/MessagePortParent.h"
+#include "mozilla/dom/ServiceWorkerActors.h"
 #include "mozilla/dom/ServiceWorkerManagerParent.h"
 #include "mozilla/dom/ServiceWorkerRegistrar.h"
 #include "mozilla/dom/StorageActivityService.h"
 #include "mozilla/dom/asmjscache/AsmJSCache.h"
 #include "mozilla/dom/cache/ActorUtils.h"
 #include "mozilla/dom/indexedDB/ActorsParent.h"
 #include "mozilla/dom/ipc/IPCBlobInputStreamParent.h"
 #include "mozilla/dom/ipc/PendingIPCBlobParent.h"
@@ -67,16 +68,19 @@ using mozilla::ipc::AssertIsOnBackground
 using mozilla::dom::asmjscache::PAsmJSCacheEntryParent;
 using mozilla::dom::cache::PCacheParent;
 using mozilla::dom::cache::PCacheStorageParent;
 using mozilla::dom::cache::PCacheStreamControlParent;
 using mozilla::dom::FileSystemBase;
 using mozilla::dom::FileSystemRequestParent;
 using mozilla::dom::MessagePortParent;
 using mozilla::dom::PMessagePortParent;
+using mozilla::dom::PServiceWorkerParent;
+using mozilla::dom::PServiceWorkerContainerParent;
+using mozilla::dom::PServiceWorkerRegistrationParent;
 using mozilla::dom::UDPSocketParent;
 using mozilla::dom::WebAuthnTransactionParent;
 using mozilla::AssertIsOnMainThread;
 using mozilla::dom::PMIDIPortParent;
 using mozilla::dom::PMIDIManagerParent;
 using mozilla::dom::MIDIPortParent;
 using mozilla::dom::MIDIManagerParent;
 using mozilla::dom::MIDIPlatformService;
@@ -1045,16 +1049,75 @@ BackgroundParentImpl::RecvPClientManager
 
 IPCResult
 BackgroundParentImpl::RecvStorageActivity(const PrincipalInfo& aPrincipalInfo)
 {
   dom::StorageActivityService::SendActivity(aPrincipalInfo);
   return IPC_OK();
 }
 
+PServiceWorkerParent*
+BackgroundParentImpl::AllocPServiceWorkerParent(const IPCServiceWorkerDescriptor&)
+{
+  return dom::AllocServiceWorkerParent();
+}
+
+bool
+BackgroundParentImpl::DeallocPServiceWorkerParent(PServiceWorkerParent* aActor)
+{
+  return dom::DeallocServiceWorkerParent(aActor);
+}
+
+IPCResult
+BackgroundParentImpl::RecvPServiceWorkerConstructor(PServiceWorkerParent* aActor,
+                                                    const IPCServiceWorkerDescriptor& aDescriptor)
+{
+  dom::InitServiceWorkerParent(aActor, aDescriptor);
+  return IPC_OK();
+}
+
+PServiceWorkerContainerParent*
+BackgroundParentImpl::AllocPServiceWorkerContainerParent()
+{
+  return dom::AllocServiceWorkerContainerParent();
+}
+
+bool
+BackgroundParentImpl::DeallocPServiceWorkerContainerParent(PServiceWorkerContainerParent* aActor)
+{
+  return dom::DeallocServiceWorkerContainerParent(aActor);
+}
+
+mozilla::ipc::IPCResult
+BackgroundParentImpl::RecvPServiceWorkerContainerConstructor(PServiceWorkerContainerParent* aActor)
+{
+  dom::InitServiceWorkerContainerParent(aActor);
+  return IPC_OK();
+}
+
+PServiceWorkerRegistrationParent*
+BackgroundParentImpl::AllocPServiceWorkerRegistrationParent(const IPCServiceWorkerRegistrationDescriptor&)
+{
+  return dom::AllocServiceWorkerRegistrationParent();
+}
+
+bool
+BackgroundParentImpl::DeallocPServiceWorkerRegistrationParent(PServiceWorkerRegistrationParent* aActor)
+{
+  return dom::DeallocServiceWorkerRegistrationParent(aActor);
+}
+
+mozilla::ipc::IPCResult
+BackgroundParentImpl::RecvPServiceWorkerRegistrationConstructor(PServiceWorkerRegistrationParent* aActor,
+                                                                const IPCServiceWorkerRegistrationDescriptor& aDescriptor)
+{
+  dom::InitServiceWorkerRegistrationParent(aActor, aDescriptor);
+  return IPC_OK();
+}
+
 } // namespace ipc
 } // namespace mozilla
 
 void
 TestParent::ActorDestroy(ActorDestroyReason aWhy)
 {
   mozilla::ipc::AssertIsInMainProcess();
   AssertIsOnBackgroundThread();
--- a/ipc/glue/BackgroundParentImpl.h
+++ b/ipc/glue/BackgroundParentImpl.h
@@ -282,14 +282,43 @@ protected:
   virtual PMIDIManagerParent*
   AllocPMIDIManagerParent() override;
 
   virtual bool
   DeallocPMIDIManagerParent(PMIDIManagerParent* aActor) override;
 
   virtual mozilla::ipc::IPCResult
   RecvStorageActivity(const PrincipalInfo& aPrincipalInfo) override;
+
+  virtual PServiceWorkerParent*
+  AllocPServiceWorkerParent(const IPCServiceWorkerDescriptor&) override;
+
+  virtual bool
+  DeallocPServiceWorkerParent(PServiceWorkerParent*) override;
+
+  virtual mozilla::ipc::IPCResult
+  RecvPServiceWorkerConstructor(PServiceWorkerParent* aActor,
+                                const IPCServiceWorkerDescriptor& aDescriptor) override;
+
+  virtual PServiceWorkerContainerParent*
+  AllocPServiceWorkerContainerParent() override;
+
+  virtual bool
+  DeallocPServiceWorkerContainerParent(PServiceWorkerContainerParent*) override;
+
+  virtual mozilla::ipc::IPCResult
+  RecvPServiceWorkerContainerConstructor(PServiceWorkerContainerParent* aActor) override;
+
+  virtual PServiceWorkerRegistrationParent*
+  AllocPServiceWorkerRegistrationParent(const IPCServiceWorkerRegistrationDescriptor&) override;
+
+  virtual bool
+  DeallocPServiceWorkerRegistrationParent(PServiceWorkerRegistrationParent*) override;
+
+  virtual mozilla::ipc::IPCResult
+  RecvPServiceWorkerRegistrationConstructor(PServiceWorkerRegistrationParent* aActor,
+                                            const IPCServiceWorkerRegistrationDescriptor& aDescriptor) override;
 };
 
 } // namespace ipc
 } // namespace mozilla
 
 #endif // mozilla_ipc_backgroundparentimpl_h__
--- a/ipc/glue/PBackground.ipdl
+++ b/ipc/glue/PBackground.ipdl
@@ -22,30 +22,36 @@ include protocol PPendingIPCBlob;
 include protocol PTemporaryIPCBlob;
 include protocol PMessagePort;
 include protocol PCameras;
 include protocol PMIDIManager;
 include protocol PMIDIPort;
 include protocol PQuota;
 include protocol PChildToParentStream;
 include protocol PParentToChildStream;
+include protocol PServiceWorker;
+include protocol PServiceWorkerContainer;
 include protocol PServiceWorkerManager;
+include protocol PServiceWorkerRegistration;
 include protocol PWebAuthnTransaction;
 include protocol PUDPSocket;
 include protocol PVsync;
 
 include DOMTypes;
 include IPCBlob;
+include IPCServiceWorkerDescriptor;
+include IPCServiceWorkerRegistrationDescriptor;
 include PBackgroundSharedTypes;
 include PBackgroundIDBSharedTypes;
 include PFileSystemParams;
 include ProtocolTypes;
 include MIDITypes;
 
 include "mozilla/dom/cache/IPCUtils.h";
+include "mozilla/layers/LayersMessageUtils.h";
 
 using mozilla::dom::cache::Namespace
   from "mozilla/dom/cache/Types.h";
 
 using mozilla::dom::asmjscache::OpenMode
   from "mozilla/dom/asmjscache/AsmJSCache.h";
 
 using mozilla::dom::asmjscache::WriteParams
@@ -76,17 +82,20 @@ sync protocol PBackground
   manages PTemporaryIPCBlob;
   manages PMessagePort;
   manages PCameras;
   manages PMIDIManager;
   manages PMIDIPort;
   manages PQuota;
   manages PChildToParentStream;
   manages PParentToChildStream;
+  manages PServiceWorker;
+  manages PServiceWorkerContainer;
   manages PServiceWorkerManager;
+  manages PServiceWorkerRegistration;
   manages PWebAuthnTransaction;
   manages PUDPSocket;
   manages PVsync;
 
 parent:
   // Only called at startup during mochitests to check the basic infrastructure.
   async PBackgroundTest(nsCString testArg);
 
@@ -147,16 +156,22 @@ parent:
 
   async PMIDIManager();
   async PMIDIPort(MIDIPortInfo portInfo, bool sysexEnabled);
 
   // This method is used to propagate storage activities from the child actor
   // to the parent actor. See StorageActivityService.
   async StorageActivity(PrincipalInfo principalInfo);
 
+  async PServiceWorker(IPCServiceWorkerDescriptor aDescriptor);
+
+  async PServiceWorkerContainer();
+
+  async PServiceWorkerRegistration(IPCServiceWorkerRegistrationDescriptor aDescriptor);
+
 child:
   async PCache();
   async PCacheStreamControl();
 
   async PParentToChildStream();
 
   async PPendingIPCBlob(IPCBlob blob);