ipc/glue/ProcessChild.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:bf39a78fabfe
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: sw=2 ts=8 et :
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
8 #ifndef mozilla_ipc_ProcessChild_h
9 #define mozilla_ipc_ProcessChild_h
10
11 #include "base/message_loop.h"
12 #include "base/process.h"
13
14 #include "chrome/common/child_process.h"
15
16 // ProcessChild is the base class for all subprocesses of the main
17 // browser process. Its code runs on the thread that started in
18 // main().
19
20 namespace mozilla {
21 namespace ipc {
22
23 class ProcessChild : public ChildProcess {
24 protected:
25 typedef base::ProcessHandle ProcessHandle;
26
27 public:
28 ProcessChild(ProcessHandle parentHandle);
29 virtual ~ProcessChild();
30
31 virtual bool Init() = 0;
32 virtual void CleanUp()
33 { }
34
35 static MessageLoop* message_loop() {
36 return gProcessChild->mUILoop;
37 }
38
39 protected:
40 static ProcessChild* current() {
41 return gProcessChild;
42 }
43
44 ProcessHandle ParentHandle() {
45 return mParentHandle;
46 }
47
48 private:
49 static ProcessChild* gProcessChild;
50
51 MessageLoop* mUILoop;
52 ProcessHandle mParentHandle;
53
54 DISALLOW_EVIL_CONSTRUCTORS(ProcessChild);
55 };
56
57 } // namespace ipc
58 } // namespace mozilla
59
60
61 #endif // ifndef mozilla_ipc_ProcessChild_h

mercurial