1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 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/. */
7 #ifndef mozilla_ipc_ProcessChild_h
8 #define mozilla_ipc_ProcessChild_h
11 #include "base/message_loop.h"
12 #include "base/process.h"
14 #include "chrome/common/child_process.h"
16 #include "mozilla/ipc/ProcessUtils.h"
18 // ProcessChild is the base class for all subprocesses of the main
19 // browser process. Its code runs on the thread that started in
25 class ProcessChild
: public ChildProcess
{
27 typedef base::ProcessId ProcessId
;
30 explicit ProcessChild(ProcessId aParentPid
, const nsID
& aMessageChannelId
);
32 ProcessChild(const ProcessChild
&) = delete;
33 ProcessChild
& operator=(const ProcessChild
&) = delete;
35 virtual ~ProcessChild();
37 virtual bool Init(int aArgc
, char* aArgv
[]) = 0;
39 static void AddPlatformBuildID(std::vector
<std::string
>& aExtraArgs
);
41 static bool InitPrefs(int aArgc
, char* aArgv
[]);
43 virtual void CleanUp() {}
45 static MessageLoop
* message_loop() { return gProcessChild
->mUILoop
; }
47 static void NotifiedImpendingShutdown();
49 static bool ExpectingShutdown();
52 * Exit *now*. Do not shut down XPCOM, do not pass Go, do not run
53 * static destructors, do not collect $200.
55 static void QuickExit();
58 static ProcessChild
* current() { return gProcessChild
; }
60 ProcessId
ParentPid() { return mParentPid
; }
62 UntypedEndpoint
TakeInitialEndpoint();
65 static ProcessChild
* gProcessChild
;
69 nsID mMessageChannelId
;
73 } // namespace mozilla
75 #endif // ifndef mozilla_ipc_ProcessChild_h