author Kershaw Chang <>
Fri, 11 Jan 2019 20:55:07 +0000
changeset 513525 b5904e4ffc0ca4bdab4084a92176c6a70f93f01c
parent 513460 460bbf0849e11fea35612feed9d10201e1fe5213
child 513462 de65c456aad6dbd598f81138509c342152ae4047
permissions -rw-r--r--
Bug 1513057 - P5: Create IPC between content process and socket process r=dragana,mayhemer Differential Revision:

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 */

#ifndef mozilla_net_SocketProcessChild_h
#define mozilla_net_SocketProcessChild_h

#include "mozilla/net/PSocketProcessChild.h"
#include "nsRefPtrHashtable.h"

namespace mozilla {
namespace net {

class SocketProcessBridgeParent;

// The IPC actor implements PSocketProcessChild in child process.
// This is allocated and kept alive by SocketProcessImpl.
class SocketProcessChild final : public PSocketProcessChild {

  static SocketProcessChild* GetSingleton();

  bool Init(base::ProcessId aParentPid, const char* aParentBuildID,
            MessageLoop* aIOLoop, IPC::Channel* aChannel);

  void ActorDestroy(ActorDestroyReason aWhy) override;

  mozilla::ipc::IPCResult RecvPreferenceUpdate(const Pref& aPref) override;
  mozilla::ipc::IPCResult RecvRequestMemoryReport(
      const uint32_t& generation, const bool& anonymize,
      const bool& minimizeMemoryUsage, const MaybeFileDesc& DMDFile) override;
  mozilla::ipc::IPCResult RecvSetOffline(const bool& aOffline) override;
  mozilla::ipc::IPCResult RecvInitSocketProcessBridgeParent(
      const ProcessId& aContentProcessId,
      Endpoint<mozilla::net::PSocketProcessBridgeParent>&& aEndpoint) override;

  void CleanUp();
  void DestroySocketProcessBridgeParent(ProcessId aId);

  // Mapping of content process id and the SocketProcessBridgeParent.
  // This table keeps SocketProcessBridgeParent alive in socket process.
  nsRefPtrHashtable<nsUint32HashKey, SocketProcessBridgeParent>

}  // namespace net
}  // namespace mozilla

#endif  // mozilla_net_SocketProcessChild_h