2016-05-28 00:54:31 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-02-04 01:17:09 +03:00
|
|
|
|
2010-05-11 08:18:00 +04:00
|
|
|
#ifndef mozilla_ipc_ProcessChild_h
|
|
|
|
#define mozilla_ipc_ProcessChild_h
|
2010-02-04 01:17:09 +03:00
|
|
|
|
2010-05-11 08:18:00 +04:00
|
|
|
#include "base/message_loop.h"
|
|
|
|
#include "base/process.h"
|
2010-02-04 01:17:09 +03:00
|
|
|
|
2010-05-11 08:18:00 +04:00
|
|
|
#include "chrome/common/child_process.h"
|
|
|
|
|
|
|
|
// ProcessChild is the base class for all subprocesses of the main
|
|
|
|
// browser process. Its code runs on the thread that started in
|
|
|
|
// main().
|
2010-02-05 00:00:00 +03:00
|
|
|
|
2010-02-04 01:17:09 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace ipc {
|
|
|
|
|
2010-05-11 08:18:00 +04:00
|
|
|
class ProcessChild : public ChildProcess {
|
|
|
|
protected:
|
2015-04-01 11:40:35 +03:00
|
|
|
typedef base::ProcessId ProcessId;
|
2010-05-11 08:18:00 +04:00
|
|
|
|
|
|
|
public:
|
2015-04-01 11:40:35 +03:00
|
|
|
explicit ProcessChild(ProcessId aParentPid);
|
2010-05-11 08:18:00 +04:00
|
|
|
virtual ~ProcessChild();
|
|
|
|
|
2017-02-05 08:52:38 +03:00
|
|
|
virtual bool Init(int aArgc, char* aArgv[]) = 0;
|
2010-05-11 08:18:00 +04:00
|
|
|
virtual void CleanUp() {}
|
|
|
|
|
|
|
|
static MessageLoop* message_loop() { return gProcessChild->mUILoop; }
|
|
|
|
|
2020-05-22 21:21:59 +03:00
|
|
|
static void NotifyImpendingShutdown();
|
|
|
|
|
|
|
|
static bool ExpectingShutdown();
|
|
|
|
|
2016-04-11 11:12:33 +03:00
|
|
|
/**
|
|
|
|
* Exit *now*. Do not shut down XPCOM, do not pass Go, do not run
|
|
|
|
* static destructors, do not collect $200.
|
|
|
|
*/
|
|
|
|
static void QuickExit();
|
|
|
|
|
2010-05-11 08:18:00 +04:00
|
|
|
protected:
|
|
|
|
static ProcessChild* current() { return gProcessChild; }
|
|
|
|
|
2015-04-01 11:40:35 +03:00
|
|
|
ProcessId ParentPid() { return mParentPid; }
|
2010-05-11 08:18:00 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
static ProcessChild* gProcessChild;
|
|
|
|
|
|
|
|
MessageLoop* mUILoop;
|
2015-04-01 11:40:35 +03:00
|
|
|
ProcessId mParentPid;
|
2010-05-11 08:18:00 +04:00
|
|
|
|
|
|
|
DISALLOW_EVIL_CONSTRUCTORS(ProcessChild);
|
|
|
|
};
|
2010-02-04 01:17:09 +03:00
|
|
|
|
|
|
|
} // namespace ipc
|
|
|
|
} // namespace mozilla
|
2010-05-11 08:18:00 +04:00
|
|
|
|
|
|
|
#endif // ifndef mozilla_ipc_ProcessChild_h
|