Bug 1908670 - Home and newtab topic personalization needs region controls r=home...
[gecko.git] / ipc / glue / ForkServer.h
blobc530e5131cfc9abde1ff2be38aa1ded588bf73e5
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"
13 namespace mozilla {
14 namespace ipc {
16 class ForkServer {
17 public:
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;
22 ForkServer();
23 ~ForkServer() {};
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);
33 private:
34 UniquePtr<MiniTransceiver> mTcver;
35 UniquePtr<base::AppProcessBuilder> mAppProcBuilder;
38 enum {
39 Msg_ForkNewSubprocess__ID = 0x7f0, // a random picked number
40 Reply_ForkNewSubprocess__ID,
43 } // namespace ipc
44 } // namespace mozilla
46 #endif // __FORKSERVER_H_