security/sandbox/win/src/remotesandboxbroker/RemoteSandboxBrokerParent.h
author Gabriele Svelto <gsvelto@mozilla.com>
Thu, 15 Aug 2019 12:06:51 +0000
changeset 488342 69224eff4d072682565cc98fcce41f0f4c6be8eb
parent 488040 7710c9d9b6b0b2f8f51b0d3d4e9dea3753201b25
permissions -rw-r--r--
Bug 1571711 - Factorize crash handling out of the various process IPC classes r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D41657

/* -*- 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 https://mozilla.org/MPL/2.0/. */

#ifndef RemoteSandboxBrokerParent_h_
#define RemoteSandboxBrokerParent_h_

#include "mozilla/PRemoteSandboxBrokerParent.h"
#include "RemoteSandboxBrokerProcessParent.h"
#include "mozilla/ipc/CrashReporterHelper.h"

namespace mozilla {

class RemoteSandboxBrokerParent
    : public PRemoteSandboxBrokerParent,
      public ipc::CrashReporterHelper<GeckoProcessType_RemoteSandboxBroker> {
  friend class PRemoteSandboxBrokerParent;

 public:
  bool DuplicateFromLauncher(HANDLE aLauncherHandle, LPHANDLE aOurHandle);

  void Shutdown();

  // Asynchronously launches the launcher process.
  // Note: we rely on the caller to keep this instance alive
  // until this promise resolves.
  RefPtr<GenericPromise> Launch(const nsTArray<uint64_t>& aHandlesToShare);

 private:
  void ActorDestroy(ActorDestroyReason aWhy) override;

  RemoteSandboxBrokerProcessParent* mProcess = nullptr;

  bool mOpened = false;
};

}  // namespace mozilla

#endif  // RemoteSandboxBrokerParent_h_