Bug 1708422: part 12) Move some code into `mozInlineSpellChecker::SpellCheckerTimeSli...
[gecko.git] / netwerk / ipc / SocketProcessBridgeParent.cpp
blobf28fa989250944f9af0cd14d10a59734ccdebde3
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "SocketProcessBridgeParent.h"
7 #include "SocketProcessLogging.h"
9 #include "mozilla/ipc/BackgroundParent.h"
10 #include "mozilla/ipc/Endpoint.h"
11 #include "SocketProcessChild.h"
13 namespace mozilla {
14 namespace net {
16 SocketProcessBridgeParent::SocketProcessBridgeParent(
17 ProcessId aId, Endpoint<PSocketProcessBridgeParent>&& aEndpoint)
18 : mId(aId), mClosed(false) {
19 LOG((
20 "CONSTRUCT SocketProcessBridgeParent::SocketProcessBridgeParent mId=%d\n",
21 mId));
22 MOZ_COUNT_CTOR(SocketProcessBridgeParent);
23 DebugOnly<bool> ok = aEndpoint.Bind(this);
24 MOZ_ASSERT(ok);
27 SocketProcessBridgeParent::~SocketProcessBridgeParent() {
28 LOG(("DESTRUCT SocketProcessBridgeParent::SocketProcessBridgeParent mId=%d\n",
29 mId));
30 MOZ_COUNT_DTOR(SocketProcessBridgeParent);
33 mozilla::ipc::IPCResult SocketProcessBridgeParent::RecvTest() {
34 LOG(("SocketProcessBridgeParent::RecvTest\n"));
35 Unused << SendTest();
36 return IPC_OK();
39 mozilla::ipc::IPCResult SocketProcessBridgeParent::RecvInitBackground(
40 Endpoint<PBackgroundParent>&& aEndpoint) {
41 LOG(("SocketProcessBridgeParent::RecvInitBackground mId=%d\n", mId));
42 if (!ipc::BackgroundParent::Alloc(nullptr, std::move(aEndpoint))) {
43 return IPC_FAIL(this, "BackgroundParent::Alloc failed");
46 return IPC_OK();
49 void SocketProcessBridgeParent::ActorDestroy(ActorDestroyReason aWhy) {
50 LOG(("SocketProcessBridgeParent::ActorDestroy mId=%d\n", mId));
52 mClosed = true;
53 GetCurrentSerialEventTarget()->Dispatch(
54 NewRunnableMethod("net::SocketProcessBridgeParent::DeferredDestroy", this,
55 &SocketProcessBridgeParent::DeferredDestroy));
58 void SocketProcessBridgeParent::DeferredDestroy() {
59 if (SocketProcessChild* child = SocketProcessChild::GetSingleton()) {
60 child->DestroySocketProcessBridgeParent(mId);
64 } // namespace net
65 } // namespace mozilla