1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* vim: set ts=8 sts=4 et sw=4 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef __FORKSERVER_H_
7 #define __FORKSERVER_H_
9 #include "mozilla/UniquePtr.h"
10 #include "base/process_util.h"
11 #include "mozilla/ipc/MiniTransceiver.h"
18 // NOTE: This can re-use the same ID as the initial IPC::Channel, as the
19 // initial IPC::Channel will not be used by the fork server.
20 static constexpr int kClientPipeFd
= 3;
25 void InitProcess(int* aArgc
, char*** aArgv
);
26 bool HandleMessages();
28 // Called when a message is received.
29 void OnMessageReceived(UniquePtr
<IPC::Message
> message
);
31 static bool RunForkServer(int* aArgc
, char*** aArgv
);
34 UniquePtr
<MiniTransceiver
> mTcver
;
35 UniquePtr
<base::AppProcessBuilder
> mAppProcBuilder
;
39 Msg_ForkNewSubprocess__ID
= 0x7f0, // a random picked number
40 Reply_ForkNewSubprocess__ID
,
44 } // namespace mozilla
46 #endif // __FORKSERVER_H_