Line data Source code
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/. */
6 :
7 : #ifndef mozilla_ipc_ProcessChild_h
8 : #define mozilla_ipc_ProcessChild_h
9 :
10 : #include "base/message_loop.h"
11 : #include "base/process.h"
12 :
13 : #include "chrome/common/child_process.h"
14 :
15 : // ProcessChild is the base class for all subprocesses of the main
16 : // browser process. Its code runs on the thread that started in
17 : // main().
18 :
19 : namespace mozilla {
20 : namespace ipc {
21 :
22 : class ProcessChild : public ChildProcess {
23 : protected:
24 : typedef base::ProcessId ProcessId;
25 :
26 : public:
27 : explicit ProcessChild(ProcessId aParentPid);
28 : virtual ~ProcessChild();
29 :
30 : virtual bool Init(int aArgc, char* aArgv[]) = 0;
31 0 : virtual void CleanUp()
32 0 : { }
33 :
34 0 : static MessageLoop* message_loop() {
35 0 : return gProcessChild->mUILoop;
36 : }
37 :
38 : /**
39 : * Exit *now*. Do not shut down XPCOM, do not pass Go, do not run
40 : * static destructors, do not collect $200.
41 : */
42 : static void QuickExit();
43 :
44 : protected:
45 : static ProcessChild* current() {
46 : return gProcessChild;
47 : }
48 :
49 2 : ProcessId ParentPid() {
50 2 : return mParentPid;
51 : }
52 :
53 : private:
54 : static ProcessChild* gProcessChild;
55 :
56 : MessageLoop* mUILoop;
57 : ProcessId mParentPid;
58 :
59 : DISALLOW_EVIL_CONSTRUCTORS(ProcessChild);
60 : };
61 :
62 : } // namespace ipc
63 : } // namespace mozilla
64 :
65 :
66 : #endif // ifndef mozilla_ipc_ProcessChild_h
|