ipc/glue/ProcessChild.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/glue/ProcessChild.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,61 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * vim: sw=2 ts=8 et :
     1.6 + */
     1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +#ifndef mozilla_ipc_ProcessChild_h
    1.12 +#define mozilla_ipc_ProcessChild_h
    1.13 +
    1.14 +#include "base/message_loop.h"
    1.15 +#include "base/process.h"
    1.16 +
    1.17 +#include "chrome/common/child_process.h"
    1.18 +
    1.19 +// ProcessChild is the base class for all subprocesses of the main
    1.20 +// browser process.  Its code runs on the thread that started in
    1.21 +// main().
    1.22 +
    1.23 +namespace mozilla {
    1.24 +namespace ipc {
    1.25 +
    1.26 +class ProcessChild : public ChildProcess {
    1.27 +protected:
    1.28 +  typedef base::ProcessHandle ProcessHandle;
    1.29 +
    1.30 +public:
    1.31 +  ProcessChild(ProcessHandle parentHandle);
    1.32 +  virtual ~ProcessChild();
    1.33 +
    1.34 +  virtual bool Init() = 0;
    1.35 +  virtual void CleanUp()
    1.36 +  { }
    1.37 +
    1.38 +  static MessageLoop* message_loop() {
    1.39 +    return gProcessChild->mUILoop;
    1.40 +  }
    1.41 +
    1.42 +protected:
    1.43 +  static ProcessChild* current() {
    1.44 +    return gProcessChild;
    1.45 +  }
    1.46 +
    1.47 +  ProcessHandle ParentHandle() {
    1.48 +    return mParentHandle;
    1.49 +  }
    1.50 +
    1.51 +private:
    1.52 +  static ProcessChild* gProcessChild;
    1.53 +
    1.54 +  MessageLoop* mUILoop;
    1.55 +  ProcessHandle mParentHandle;
    1.56 +
    1.57 +  DISALLOW_EVIL_CONSTRUCTORS(ProcessChild);
    1.58 +};
    1.59 +
    1.60 +} // namespace ipc
    1.61 +} // namespace mozilla
    1.62 +
    1.63 +
    1.64 +#endif // ifndef mozilla_ipc_ProcessChild_h

mercurial