| 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" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 BrowserChildProcessHostImpl( | 38 BrowserChildProcessHostImpl( |
| 39 int process_type, | 39 int process_type, |
| 40 BrowserChildProcessHostDelegate* delegate); | 40 BrowserChildProcessHostDelegate* delegate); |
| 41 virtual ~BrowserChildProcessHostImpl(); | 41 virtual ~BrowserChildProcessHostImpl(); |
| 42 | 42 |
| 43 // Terminates all child processes and deletes each BrowserChildProcessHost | 43 // Terminates all child processes and deletes each BrowserChildProcessHost |
| 44 // instance. | 44 // instance. |
| 45 static void TerminateAll(); | 45 static void TerminateAll(); |
| 46 | 46 |
| 47 // BrowserChildProcessHost implementation: | 47 // BrowserChildProcessHost implementation: |
| 48 virtual bool Send(IPC::Message* message) OVERRIDE; | 48 virtual bool Send(IPC::Message* message) override; |
| 49 virtual void Launch( | 49 virtual void Launch( |
| 50 SandboxedProcessLauncherDelegate* delegate, | 50 SandboxedProcessLauncherDelegate* delegate, |
| 51 base::CommandLine* cmd_line) OVERRIDE; | 51 base::CommandLine* cmd_line) override; |
| 52 virtual const ChildProcessData& GetData() const OVERRIDE; | 52 virtual const ChildProcessData& GetData() const override; |
| 53 virtual ChildProcessHost* GetHost() const OVERRIDE; | 53 virtual ChildProcessHost* GetHost() const override; |
| 54 virtual base::TerminationStatus GetTerminationStatus( | 54 virtual base::TerminationStatus GetTerminationStatus( |
| 55 bool known_dead, int* exit_code) OVERRIDE; | 55 bool known_dead, int* exit_code) override; |
| 56 virtual void SetName(const base::string16& name) OVERRIDE; | 56 virtual void SetName(const base::string16& name) override; |
| 57 virtual void SetHandle(base::ProcessHandle handle) OVERRIDE; | 57 virtual void SetHandle(base::ProcessHandle handle) override; |
| 58 | 58 |
| 59 // ChildProcessHostDelegate implementation: | 59 // ChildProcessHostDelegate implementation: |
| 60 virtual bool CanShutdown() OVERRIDE; | 60 virtual bool CanShutdown() override; |
| 61 virtual void OnChildDisconnected() OVERRIDE; | 61 virtual void OnChildDisconnected() override; |
| 62 virtual base::ProcessHandle GetHandle() const OVERRIDE; | 62 virtual base::ProcessHandle GetHandle() const override; |
| 63 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 63 virtual bool OnMessageReceived(const IPC::Message& message) override; |
| 64 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 64 virtual void OnChannelConnected(int32 peer_pid) override; |
| 65 virtual void OnChannelError() OVERRIDE; | 65 virtual void OnChannelError() override; |
| 66 virtual void OnBadMessageReceived(const IPC::Message& message) OVERRIDE; | 66 virtual void OnBadMessageReceived(const IPC::Message& message) override; |
| 67 | 67 |
| 68 // Removes this host from the host list. Calls ChildProcessHost::ForceShutdown | 68 // Removes this host from the host list. Calls ChildProcessHost::ForceShutdown |
| 69 void ForceShutdown(); | 69 void ForceShutdown(); |
| 70 | 70 |
| 71 // Callers can reduce the BrowserChildProcess' priority. | 71 // Callers can reduce the BrowserChildProcess' priority. |
| 72 void SetBackgrounded(bool backgrounded); | 72 void SetBackgrounded(bool backgrounded); |
| 73 | 73 |
| 74 // Controls whether the child process should be terminated on browser | 74 // Controls whether the child process should be terminated on browser |
| 75 // shutdown. Default is to always terminate. | 75 // shutdown. Default is to always terminate. |
| 76 void SetTerminateChildOnShutdown(bool terminate_on_shutdown); | 76 void SetTerminateChildOnShutdown(bool terminate_on_shutdown); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 89 private: | 89 private: |
| 90 friend class BrowserChildProcessHostIterator; | 90 friend class BrowserChildProcessHostIterator; |
| 91 friend class BrowserChildProcessObserver; | 91 friend class BrowserChildProcessObserver; |
| 92 | 92 |
| 93 static BrowserChildProcessList* GetIterator(); | 93 static BrowserChildProcessList* GetIterator(); |
| 94 | 94 |
| 95 static void AddObserver(BrowserChildProcessObserver* observer); | 95 static void AddObserver(BrowserChildProcessObserver* observer); |
| 96 static void RemoveObserver(BrowserChildProcessObserver* observer); | 96 static void RemoveObserver(BrowserChildProcessObserver* observer); |
| 97 | 97 |
| 98 // ChildProcessLauncher::Client implementation. | 98 // ChildProcessLauncher::Client implementation. |
| 99 virtual void OnProcessLaunched() OVERRIDE; | 99 virtual void OnProcessLaunched() override; |
| 100 virtual void OnProcessLaunchFailed() OVERRIDE; | 100 virtual void OnProcessLaunchFailed() override; |
| 101 | 101 |
| 102 #if defined(OS_WIN) | 102 #if defined(OS_WIN) |
| 103 void DeleteProcessWaitableEvent(base::WaitableEvent* event); | 103 void DeleteProcessWaitableEvent(base::WaitableEvent* event); |
| 104 void OnProcessExitedEarly(base::WaitableEvent* event); | 104 void OnProcessExitedEarly(base::WaitableEvent* event); |
| 105 #endif | 105 #endif |
| 106 | 106 |
| 107 ChildProcessData data_; | 107 ChildProcessData data_; |
| 108 BrowserChildProcessHostDelegate* delegate_; | 108 BrowserChildProcessHostDelegate* delegate_; |
| 109 scoped_ptr<ChildProcessHost> child_process_host_; | 109 scoped_ptr<ChildProcessHost> child_process_host_; |
| 110 | 110 |
| 111 scoped_ptr<ChildProcessLauncher> child_process_; | 111 scoped_ptr<ChildProcessLauncher> child_process_; |
| 112 | 112 |
| 113 PowerMonitorMessageBroadcaster power_monitor_message_broadcaster_; | 113 PowerMonitorMessageBroadcaster power_monitor_message_broadcaster_; |
| 114 | 114 |
| 115 #if defined(OS_WIN) | 115 #if defined(OS_WIN) |
| 116 // Watches to see if the child process exits before the IPC channel has | 116 // 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 | 117 // been connected. Thereafter, its exit is determined by an error on the |
| 118 // IPC channel. | 118 // IPC channel. |
| 119 base::WaitableEventWatcher early_exit_watcher_; | 119 base::WaitableEventWatcher early_exit_watcher_; |
| 120 #endif | 120 #endif |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 } // namespace content | 123 } // namespace content |
| 124 | 124 |
| 125 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ | 125 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ |
| OLD | NEW |