OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 5 #ifndef CHROME_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
6 #define CHROME_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 6 #define CHROME_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 void Launch( | 67 void Launch( |
68 #if defined(OS_WIN) | 68 #if defined(OS_WIN) |
69 const FilePath& exposed_dir, | 69 const FilePath& exposed_dir, |
70 #elif defined(OS_POSIX) | 70 #elif defined(OS_POSIX) |
71 bool use_zygote, | 71 bool use_zygote, |
72 const base::environment_vector& environ, | 72 const base::environment_vector& environ, |
73 #endif | 73 #endif |
74 CommandLine* cmd_line); | 74 CommandLine* cmd_line); |
75 | 75 |
76 // ChildProcessLauncher::Client implementation. | 76 // ChildProcessLauncher::Client implementation. |
77 virtual void OnProcessLaunched() { } | 77 virtual void OnProcessLaunched() {} |
78 | 78 |
79 // Derived classes can override this to know if the process crashed. | 79 // Derived classes can override this to know if the process crashed. |
80 virtual void OnProcessCrashed() {} | 80 // |exit_code| is the status returned when the process crashed (for |
| 81 // posix, as returned from waitpid(), for Windows, as returned from |
| 82 // GetExitCodeProcess()). |
| 83 virtual void OnProcessCrashed(int exit_code) {} |
81 | 84 |
82 virtual bool DidChildCrash(); | 85 // Derived classes can override this to know if the process was |
| 86 // killed. |exit_code| is the status returned when the process |
| 87 // was killed (for posix, as returned from waitpid(), for Windows, |
| 88 // as returned from GetExitCodeProcess()). |
| 89 virtual void OnProcessWasKilled(int exit_code) {} |
| 90 |
| 91 // Returns the termination status of a child. |exit_code| is the |
| 92 // status returned when the process exited (for posix, as returned |
| 93 // from waitpid(), for Windows, as returned from |
| 94 // GetExitCodeProcess()). |exit_code| may be NULL. |
| 95 virtual base::TerminationStatus GetChildTerminationStatus(int* exit_code); |
83 | 96 |
84 // Overrides from ChildProcessHost | 97 // Overrides from ChildProcessHost |
85 virtual void OnChildDied(); | 98 virtual void OnChildDied(); |
86 virtual bool InterceptMessageFromChild(const IPC::Message& msg); | 99 virtual bool InterceptMessageFromChild(const IPC::Message& msg); |
87 virtual void Notify(NotificationType type); | 100 virtual void Notify(NotificationType type); |
88 // Extends the base class implementation and removes this host from | 101 // Extends the base class implementation and removes this host from |
89 // the host list. Calls ChildProcessHost::ForceShutdown | 102 // the host list. Calls ChildProcessHost::ForceShutdown |
90 virtual void ForceShutdown(); | 103 virtual void ForceShutdown(); |
91 | 104 |
92 private: | 105 private: |
93 // By using an internal class as the ChildProcessLauncher::Client, we can | 106 // By using an internal class as the ChildProcessLauncher::Client, we can |
94 // intercept OnProcessLaunched and do our own processing before | 107 // intercept OnProcessLaunched and do our own processing before |
95 // calling the subclass' implementation. | 108 // calling the subclass' implementation. |
96 class ClientHook : public ChildProcessLauncher::Client { | 109 class ClientHook : public ChildProcessLauncher::Client { |
97 public: | 110 public: |
98 explicit ClientHook(BrowserChildProcessHost* host); | 111 explicit ClientHook(BrowserChildProcessHost* host); |
99 virtual void OnProcessLaunched(); | 112 virtual void OnProcessLaunched(); |
100 private: | 113 private: |
101 BrowserChildProcessHost* host_; | 114 BrowserChildProcessHost* host_; |
102 }; | 115 }; |
103 ClientHook client_; | 116 ClientHook client_; |
104 // May be NULL if this current process has no resource dispatcher host. | 117 // May be NULL if this current process has no resource dispatcher host. |
105 ResourceDispatcherHost* resource_dispatcher_host_; | 118 ResourceDispatcherHost* resource_dispatcher_host_; |
106 scoped_ptr<ChildProcessLauncher> child_process_; | 119 scoped_ptr<ChildProcessLauncher> child_process_; |
107 }; | 120 }; |
108 | 121 |
109 #endif // CHROME_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 122 #endif // CHROME_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
110 | |
OLD | NEW |