summaryrefslogtreecommitdiffstats
path: root/chrome/common/child_process.h
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 00:25:06 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 00:25:06 +0000
commitf784592cd075d7866c74e410833768c8b6f9b622 (patch)
tree8512d6dc402faef8df803c7ff07ba5b77eecda3f /chrome/common/child_process.h
parenta63f220009f90657fc1070d4a9bde26726deb6b4 (diff)
downloadchromium_src-f784592cd075d7866c74e410833768c8b6f9b622.zip
chromium_src-f784592cd075d7866c74e410833768c8b6f9b622.tar.gz
chromium_src-f784592cd075d7866c74e410833768c8b6f9b622.tar.bz2
Switch the first thread in a child process to be the main thread, and make theIO thread be the second thread. The change is needed for plugins on mac.
Review URL: http://codereview.chromium.org/155944 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21355 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/child_process.h')
-rw-r--r--chrome/common/child_process.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/chrome/common/child_process.h b/chrome/common/child_process.h
index 1366a02..5e125bc 100644
--- a/chrome/common/child_process.h
+++ b/chrome/common/child_process.h
@@ -7,21 +7,23 @@
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
+#include "base/thread.h"
#include "base/waitable_event.h"
-
-class ChildThread;
+#include "chrome/common/child_thread.h"
// Base class for child processes of the browser process (i.e. renderer and
// plugin host). This is a singleton object for each child process.
class ChildProcess {
public:
- // Child processes should have an object that derives from this class. The
- // constructor will return once ChildThread has started.
- ChildProcess(ChildThread* child_thread);
+ // Child processes should have an object that derives from this class.
+ ChildProcess();
virtual ~ChildProcess();
- // Getter for this process' main thread.
- ChildThread* child_thread() { return child_thread_.get(); }
+ // Getter for the child process' main thread.
+ ChildThread* main_thread() { return main_thread_.get(); }
+ void set_main_thread(ChildThread* thread) { main_thread_.reset(thread); }
+
+ MessageLoop* io_message_loop() { return io_thread_.message_loop(); }
// A global event object that is signalled when the main thread's message
// loop exits. This gives background threads a way to observe the main
@@ -45,15 +47,19 @@ class ChildProcess {
static ChildProcess* current() { return child_process_; }
private:
- // NOTE: make sure that child_thread_ is listed before shutdown_event_, since
- // it depends on it (indirectly through IPC::SyncChannel).
- scoped_ptr<ChildThread> child_thread_;
-
int ref_count_;
// An event that will be signalled when we shutdown.
base::WaitableEvent shutdown_event_;
+ // The thread that handles IO events.
+ base::Thread io_thread_;
+
+ // NOTE: make sure that main_thread_ is listed after shutdown_event_, since
+ // it depends on it (indirectly through IPC::SyncChannel). Same for
+ // io_thread_.
+ scoped_ptr<ChildThread> main_thread_;
+
// The singleton instance for this process.
static ChildProcess* child_process_;