author Kershaw Chang <>
Fri, 11 Jan 2019 20:55:07 +0000
changeset 513525 b5904e4ffc0ca4bdab4084a92176c6a70f93f01c
parent 513460 460bbf0849e11fea35612feed9d10201e1fe5213
child 513463 46411c5de3dade8d056fe33b745ee0e4eb7c38f9
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_SocketProcessParent_h
#define mozilla_net_SocketProcessParent_h

#include "mozilla/UniquePtr.h"
#include "mozilla/net/PSocketProcessParent.h"

namespace mozilla {

namespace dom {
class MemoryReport;
class MemoryReportRequestHost;
}  // namespace dom

namespace ipc {
class CrashReporterHost;
}  // namespace ipc

namespace net {

class SocketProcessHost;

// IPC actor of socket process in parent process. This is allocated and managed
// by SocketProcessHost.
class SocketProcessParent final : public PSocketProcessParent {
  friend class SocketProcessHost;

  explicit SocketProcessParent(SocketProcessHost* aHost);

  static SocketProcessParent* GetSingleton();

  mozilla::ipc::IPCResult RecvInitCrashReporter(
      Shmem&& aShmem, const NativeThreadId& aThreadId) override;
  mozilla::ipc::IPCResult RecvAddMemoryReport(
      const MemoryReport& aReport) override;
  mozilla::ipc::IPCResult RecvFinishMemoryReport(
      const uint32_t& aGeneration) override;

  void ActorDestroy(ActorDestroyReason aWhy) override;
  bool SendRequestMemoryReport(const uint32_t& aGeneration,
                               const bool& aAnonymize,
                               const bool& aMinimizeMemoryUsage,
                               const MaybeFileDesc& aDMDFile);

  SocketProcessHost* mHost;
  UniquePtr<ipc::CrashReporterHost> mCrashReporter;
  UniquePtr<dom::MemoryReportRequestHost> mMemoryReportRequest;

  static void Destroy(UniquePtr<SocketProcessParent>&& aParent);

}  // namespace net
}  // namespace mozilla

#endif  // mozilla_net_SocketProcessParent_h