Bug 1858509 add thread-safety annotations around MediaSourceDemuxer::mMonitor r=alwu
[gecko.git] / ipc / glue / ProcessChild.h
blob29948a912730d3d5a599232c72f59a65da909e79
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
10 #include "Endpoint.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
20 // main().
22 namespace mozilla {
23 namespace ipc {
25 class ProcessChild : public ChildProcess {
26 protected:
27 typedef base::ProcessId ProcessId;
29 public:
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();
51 /**
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();
57 protected:
58 static ProcessChild* current() { return gProcessChild; }
60 ProcessId ParentPid() { return mParentPid; }
62 UntypedEndpoint TakeInitialEndpoint();
64 private:
65 static ProcessChild* gProcessChild;
67 MessageLoop* mUILoop;
68 ProcessId mParentPid;
69 nsID mMessageChannelId;
72 } // namespace ipc
73 } // namespace mozilla
75 #endif // ifndef mozilla_ipc_ProcessChild_h