Chromium Code Reviews

Side by Side Diff: chrome/browser/browser_child_process_host.h

Issue 5172009: This adds some plumbing for propagating the reason for a renderer's death (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Final review changes Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
« no previous file with comments | « base/process_util_win.cc ('k') | chrome/browser/browser_child_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 60 matching lines...)
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 // Returns the handle of the child process. This must be called only after 76 // Returns the handle of the child process. This must be called only after
77 // OnProcessLaunched is called or it will be invalid and may crash. 77 // OnProcessLaunched is called or it will be invalid and may crash.
78 base::ProcessHandle GetChildProcessHandle() const; 78 base::ProcessHandle GetChildProcessHandle() const;
79 79
80 // ChildProcessLauncher::Client implementation. 80 // ChildProcessLauncher::Client implementation.
81 virtual void OnProcessLaunched() { } 81 virtual void OnProcessLaunched() {}
82 82
83 // Derived classes can override this to know if the process crashed. 83 // Derived classes can override this to know if the process crashed.
84 virtual void OnProcessCrashed() {} 84 // |exit_code| is the status returned when the process crashed (for
85 // posix, as returned from waitpid(), for Windows, as returned from
86 // GetExitCodeProcess()).
87 virtual void OnProcessCrashed(int exit_code) {}
85 88
86 virtual bool DidChildCrash(); 89 // Derived classes can override this to know if the process was
90 // killed. |exit_code| is the status returned when the process
91 // was killed (for posix, as returned from waitpid(), for Windows,
92 // as returned from GetExitCodeProcess()).
93 virtual void OnProcessWasKilled(int exit_code) {}
94
95 // Returns the termination status of a child. |exit_code| is the
96 // status returned when the process exited (for posix, as returned
97 // from waitpid(), for Windows, as returned from
98 // GetExitCodeProcess()). |exit_code| may be NULL.
99 virtual base::TerminationStatus GetChildTerminationStatus(int* exit_code);
87 100
88 // Overrides from ChildProcessHost 101 // Overrides from ChildProcessHost
89 virtual void OnChildDied(); 102 virtual void OnChildDied();
90 virtual bool InterceptMessageFromChild(const IPC::Message& msg); 103 virtual bool InterceptMessageFromChild(const IPC::Message& msg);
91 virtual void Notify(NotificationType type); 104 virtual void Notify(NotificationType type);
92 // Extends the base class implementation and removes this host from 105 // Extends the base class implementation and removes this host from
93 // the host list. Calls ChildProcessHost::ForceShutdown 106 // the host list. Calls ChildProcessHost::ForceShutdown
94 virtual void ForceShutdown(); 107 virtual void ForceShutdown();
95 108
96 private: 109 private:
97 // By using an internal class as the ChildProcessLauncher::Client, we can 110 // By using an internal class as the ChildProcessLauncher::Client, we can
98 // intercept OnProcessLaunched and do our own processing before 111 // intercept OnProcessLaunched and do our own processing before
99 // calling the subclass' implementation. 112 // calling the subclass' implementation.
100 class ClientHook : public ChildProcessLauncher::Client { 113 class ClientHook : public ChildProcessLauncher::Client {
101 public: 114 public:
102 explicit ClientHook(BrowserChildProcessHost* host); 115 explicit ClientHook(BrowserChildProcessHost* host);
103 virtual void OnProcessLaunched(); 116 virtual void OnProcessLaunched();
104 private: 117 private:
105 BrowserChildProcessHost* host_; 118 BrowserChildProcessHost* host_;
106 }; 119 };
107 ClientHook client_; 120 ClientHook client_;
108 // May be NULL if this current process has no resource dispatcher host. 121 // May be NULL if this current process has no resource dispatcher host.
109 ResourceDispatcherHost* resource_dispatcher_host_; 122 ResourceDispatcherHost* resource_dispatcher_host_;
110 scoped_ptr<ChildProcessLauncher> child_process_; 123 scoped_ptr<ChildProcessLauncher> child_process_;
111 }; 124 };
112 125
113 #endif // CHROME_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ 126 #endif // CHROME_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_
114
OLDNEW
« no previous file with comments | « base/process_util_win.cc ('k') | chrome/browser/browser_child_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine