OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ |
6 #define CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/process/process.h" | 12 #include "base/process/process.h" |
13 #include "base/synchronization/waitable_event_watcher.h" | 13 #include "base/synchronization/waitable_event_watcher.h" |
14 #include "content/browser/child_process_launcher.h" | 14 #include "content/browser/child_process_launcher.h" |
15 #include "content/browser/power_monitor_message_broadcaster.h" | 15 #include "content/browser/power_monitor_message_broadcaster.h" |
16 #include "content/public/browser/browser_child_process_host.h" | 16 #include "content/public/browser/browser_child_process_host.h" |
17 #include "content/public/browser/child_process_data.h" | 17 #include "content/public/browser/child_process_data.h" |
18 #include "content/public/common/child_process_host_delegate.h" | 18 #include "content/public/common/child_process_host_delegate.h" |
19 | 19 |
| 20 #if defined(OS_WIN) |
| 21 #include "base/win/object_watcher.h" |
| 22 #endif |
| 23 |
20 namespace base { | 24 namespace base { |
21 class CommandLine; | 25 class CommandLine; |
22 } | 26 } |
23 | 27 |
24 namespace content { | 28 namespace content { |
25 | 29 |
26 class BrowserChildProcessHostIterator; | 30 class BrowserChildProcessHostIterator; |
27 class BrowserChildProcessObserver; | 31 class BrowserChildProcessObserver; |
28 class BrowserMessageFilter; | 32 class BrowserMessageFilter; |
29 | 33 |
30 // Plugins/workers and other child processes that live on the IO thread use this | 34 // Plugins/workers and other child processes that live on the IO thread use this |
31 // class. RenderProcessHostImpl is the main exception that doesn't use this | 35 // class. RenderProcessHostImpl is the main exception that doesn't use this |
32 /// class because it lives on the UI thread. | 36 /// class because it lives on the UI thread. |
33 class CONTENT_EXPORT BrowserChildProcessHostImpl | 37 class CONTENT_EXPORT BrowserChildProcessHostImpl |
34 : public BrowserChildProcessHost, | 38 : public BrowserChildProcessHost, |
35 public NON_EXPORTED_BASE(ChildProcessHostDelegate), | 39 public NON_EXPORTED_BASE(ChildProcessHostDelegate), |
| 40 #if defined(OS_WIN) |
| 41 public base::win::ObjectWatcher::Delegate, |
| 42 #endif |
36 public ChildProcessLauncher::Client { | 43 public ChildProcessLauncher::Client { |
37 public: | 44 public: |
38 BrowserChildProcessHostImpl( | 45 BrowserChildProcessHostImpl( |
39 int process_type, | 46 int process_type, |
40 BrowserChildProcessHostDelegate* delegate); | 47 BrowserChildProcessHostDelegate* delegate); |
41 virtual ~BrowserChildProcessHostImpl(); | 48 virtual ~BrowserChildProcessHostImpl(); |
42 | 49 |
43 // Terminates all child processes and deletes each BrowserChildProcessHost | 50 // Terminates all child processes and deletes each BrowserChildProcessHost |
44 // instance. | 51 // instance. |
45 static void TerminateAll(); | 52 static void TerminateAll(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 static BrowserChildProcessList* GetIterator(); | 100 static BrowserChildProcessList* GetIterator(); |
94 | 101 |
95 static void AddObserver(BrowserChildProcessObserver* observer); | 102 static void AddObserver(BrowserChildProcessObserver* observer); |
96 static void RemoveObserver(BrowserChildProcessObserver* observer); | 103 static void RemoveObserver(BrowserChildProcessObserver* observer); |
97 | 104 |
98 // ChildProcessLauncher::Client implementation. | 105 // ChildProcessLauncher::Client implementation. |
99 virtual void OnProcessLaunched() override; | 106 virtual void OnProcessLaunched() override; |
100 virtual void OnProcessLaunchFailed() override; | 107 virtual void OnProcessLaunchFailed() override; |
101 | 108 |
102 #if defined(OS_WIN) | 109 #if defined(OS_WIN) |
103 void DeleteProcessWaitableEvent(base::WaitableEvent* event); | 110 // ObjectWatcher::Delegate implementation. |
104 void OnProcessExitedEarly(base::WaitableEvent* event); | 111 void OnObjectSignaled(HANDLE object) override; |
105 #endif | 112 #endif |
106 | 113 |
107 ChildProcessData data_; | 114 ChildProcessData data_; |
108 BrowserChildProcessHostDelegate* delegate_; | 115 BrowserChildProcessHostDelegate* delegate_; |
109 scoped_ptr<ChildProcessHost> child_process_host_; | 116 scoped_ptr<ChildProcessHost> child_process_host_; |
110 | 117 |
111 scoped_ptr<ChildProcessLauncher> child_process_; | 118 scoped_ptr<ChildProcessLauncher> child_process_; |
112 | 119 |
113 PowerMonitorMessageBroadcaster power_monitor_message_broadcaster_; | 120 PowerMonitorMessageBroadcaster power_monitor_message_broadcaster_; |
114 | 121 |
115 #if defined(OS_WIN) | 122 #if defined(OS_WIN) |
116 // Watches to see if the child process exits before the IPC channel has | 123 // Watches to see if the child process exits before the IPC channel has |
117 // been connected. Thereafter, its exit is determined by an error on the | 124 // been connected. Thereafter, its exit is determined by an error on the |
118 // IPC channel. | 125 // IPC channel. |
119 base::WaitableEventWatcher early_exit_watcher_; | 126 base::win::ObjectWatcher early_exit_watcher_; |
120 #endif | 127 #endif |
121 }; | 128 }; |
122 | 129 |
123 } // namespace content | 130 } // namespace content |
124 | 131 |
125 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ | 132 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ |
OLD | NEW |