| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" |
| 14 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 17 #include "base/single_thread_task_runner.h" |
| 15 #include "base/synchronization/waitable_event_watcher.h" | 18 #include "base/synchronization/waitable_event_watcher.h" |
| 16 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 17 #include "content/browser/child_process_launcher.h" | 20 #include "content/browser/child_process_launcher.h" |
| 18 #include "content/browser/power_monitor_message_broadcaster.h" | 21 #include "content/browser/power_monitor_message_broadcaster.h" |
| 19 #include "content/public/browser/browser_child_process_host.h" | 22 #include "content/public/browser/browser_child_process_host.h" |
| 20 #include "content/public/browser/child_process_data.h" | 23 #include "content/public/browser/child_process_data.h" |
| 21 #include "content/public/common/child_process_host_delegate.h" | 24 #include "content/public/common/child_process_host_delegate.h" |
| 22 | 25 |
| 23 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
| 24 #include "base/win/object_watcher.h" | 27 #include "base/win/object_watcher.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 static void RemoveObserver(BrowserChildProcessObserver* observer); | 113 static void RemoveObserver(BrowserChildProcessObserver* observer); |
| 111 | 114 |
| 112 // ChildProcessLauncher::Client implementation. | 115 // ChildProcessLauncher::Client implementation. |
| 113 void OnProcessLaunched() override; | 116 void OnProcessLaunched() override; |
| 114 void OnProcessLaunchFailed(int error_code) override; | 117 void OnProcessLaunchFailed(int error_code) override; |
| 115 | 118 |
| 116 // Returns true if the process has successfully launched. Must only be called | 119 // Returns true if the process has successfully launched. Must only be called |
| 117 // on the IO thread. | 120 // on the IO thread. |
| 118 bool IsProcessLaunched() const; | 121 bool IsProcessLaunched() const; |
| 119 | 122 |
| 123 static void OnMojoError( |
| 124 base::WeakPtr<BrowserChildProcessHostImpl> process, |
| 125 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 126 const std::string& error); |
| 127 |
| 120 #if defined(OS_WIN) | 128 #if defined(OS_WIN) |
| 121 // ObjectWatcher::Delegate implementation. | 129 // ObjectWatcher::Delegate implementation. |
| 122 void OnObjectSignaled(HANDLE object) override; | 130 void OnObjectSignaled(HANDLE object) override; |
| 123 #endif | 131 #endif |
| 124 | 132 |
| 125 ChildProcessData data_; | 133 ChildProcessData data_; |
| 126 BrowserChildProcessHostDelegate* delegate_; | 134 BrowserChildProcessHostDelegate* delegate_; |
| 127 std::unique_ptr<ChildProcessHost> child_process_host_; | 135 std::unique_ptr<ChildProcessHost> child_process_host_; |
| 128 const std::string mojo_child_token_; | 136 const std::string mojo_child_token_; |
| 129 | 137 |
| 130 std::unique_ptr<ChildProcessLauncher> child_process_; | 138 std::unique_ptr<ChildProcessLauncher> child_process_; |
| 131 | 139 |
| 132 PowerMonitorMessageBroadcaster power_monitor_message_broadcaster_; | 140 PowerMonitorMessageBroadcaster power_monitor_message_broadcaster_; |
| 133 | 141 |
| 134 #if defined(OS_WIN) | 142 #if defined(OS_WIN) |
| 135 // Watches to see if the child process exits before the IPC channel has | 143 // Watches to see if the child process exits before the IPC channel has |
| 136 // been connected. Thereafter, its exit is determined by an error on the | 144 // been connected. Thereafter, its exit is determined by an error on the |
| 137 // IPC channel. | 145 // IPC channel. |
| 138 base::win::ObjectWatcher early_exit_watcher_; | 146 base::win::ObjectWatcher early_exit_watcher_; |
| 139 #endif | 147 #endif |
| 140 | 148 |
| 141 bool is_channel_connected_; | 149 bool is_channel_connected_; |
| 142 bool notify_child_disconnected_; | 150 bool notify_child_disconnected_; |
| 151 |
| 152 base::WeakPtrFactory<BrowserChildProcessHostImpl> weak_factory_; |
| 143 }; | 153 }; |
| 144 | 154 |
| 145 } // namespace content | 155 } // namespace content |
| 146 | 156 |
| 147 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ | 157 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ |
| OLD | NEW |