ipc/chromium/src/chrome/common/child_process.h

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
     2 // Use of this source code is governed by a BSD-style license that can be
     3 // found in the LICENSE file.
     5 #ifndef CHROME_COMMON_CHILD_PROCESS_H__
     6 #define CHROME_COMMON_CHILD_PROCESS_H__
     8 #include <string>
     9 #include <vector>
    10 #include "base/basictypes.h"
    11 #include "base/message_loop.h"
    12 #include "base/scoped_ptr.h"
    13 #include "base/waitable_event.h"
    15 class ChildThread;
    18 // Base class for child processes of the browser process (i.e. renderer and
    19 // plugin host). This is a singleton object for each child process.
    20 class ChildProcess {
    21  public:
    22   // Child processes should have an object that derives from this class.  The
    23   // constructor will return once ChildThread has started.
    24   ChildProcess(ChildThread* child_thread);
    25   virtual ~ChildProcess();
    27   // Getter for this process' main thread.
    28   ChildThread* child_thread() { return child_thread_.get(); }
    30   // A global event object that is signalled when the main thread's message
    31   // loop exits.  This gives background threads a way to observe the main
    32   // thread shutting down.  This can be useful when a background thread is
    33   // waiting for some information from the browser process.  If the browser
    34   // process goes away prematurely, the background thread can at least notice
    35   // the child processes's main thread exiting to determine that it should give
    36   // up waiting.
    37   // For example, see the renderer code used to implement
    38   // webkit_glue::GetCookies.
    39   base::WaitableEvent* GetShutDownEvent();
    41   // These are used for ref-counting the child process.  The process shuts
    42   // itself down when the ref count reaches 0.
    43   // For example, in the renderer process, generally each tab managed by this
    44   // process will hold a reference to the process, and release when closed.
    45   void AddRefProcess();
    46   void ReleaseProcess();
    48   // Getter for the one ChildProcess object for this process.
    49   static ChildProcess* current() { return child_process_; }
    51  private:
    52   // NOTE: make sure that child_thread_ is listed before shutdown_event_, since
    53   // it depends on it (indirectly through IPC::SyncChannel).
    54   scoped_ptr<ChildThread> child_thread_;
    56   int ref_count_;
    58   // An event that will be signalled when we shutdown.
    59   base::WaitableEvent shutdown_event_;
    61   // The singleton instance for this process.
    62   static ChildProcess* child_process_;
    64   DISALLOW_EVIL_CONSTRUCTORS(ChildProcess);
    65 };
    67 #endif  // CHROME_COMMON_CHILD_PROCESS_H__

mercurial