Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: content/public/browser/render_process_host_observer.h

Issue 1245903004: Switch RenderFrameHostManager to use RenderProcessHostObserver, remove NOTIFICATION_RENDERER_PROCES… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_PUBLIC_BROWSER_RENDER_PROCESS_HOST_OBSERVER_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_OBSERVER_H_
6 #define CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_OBSERVER_H_ 6 #define CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_OBSERVER_H_
7 7
8 #include "base/process/kill.h" 8 #include "base/process/kill.h"
9 #include "base/process/process_handle.h" 9 #include "base/process/process_handle.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 class RenderProcessHost; 14 class RenderProcessHost;
15 15
16 // An observer API implemented by classes which are interested 16 // An observer API implemented by classes which are interested
17 // in RenderProcessHost lifecycle events. 17 // in RenderProcessHost lifecycle events.
18 class CONTENT_EXPORT RenderProcessHostObserver { 18 class CONTENT_EXPORT RenderProcessHostObserver {
19 public: 19 public:
20 // This method is invoked when the process is going to exit and should not be
21 // used for further navigations. Note that this is a COURTESY callback, not
22 // guaranteed to be called for any particular process. Because this is the
23 // first step in an orderly shutdown of a render process, do not expect that
ncarter (slow) 2015/07/21 20:58:28 This is a lot clearer, thanks!
24 // a new render process will be hosted with this RenderProcessHost.
25 virtual void RenderProcessWillExit(RenderProcessHost* host) {}
26
20 // This method is invoked when the process of the observed RenderProcessHost 27 // This method is invoked when the process of the observed RenderProcessHost
21 // exits (either normally or with a crash). To determine if the process closed 28 // exits (either normally or with a crash). To determine if the process closed
22 // normally or crashed, examine the |status| parameter. 29 // normally or crashed, examine the |status| parameter.
23 // 30 //
31 // A new render process may be spawned for this RenderProcessHost, but there
32 // are no guarantees (e.g. if shutdown is occurring, the HostDestroyed
33 // callback will happen soon and that will be it, but if the renderer crashed
34 // and the user clicks 'reload', a new render process will be spawned).
35 //
24 // This will cause a call to WebContentsObserver::RenderProcessGone() for the 36 // This will cause a call to WebContentsObserver::RenderProcessGone() for the
25 // active renderer process for the top-level frame; for code that needs to be 37 // active renderer process for the top-level frame; for code that needs to be
26 // a WebContentsObserver anyway, consider whether that API might be a better 38 // a WebContentsObserver anyway, consider whether that API might be a better
27 // choice. 39 // choice.
28 virtual void RenderProcessExited(RenderProcessHost* host, 40 virtual void RenderProcessExited(RenderProcessHost* host,
29 base::TerminationStatus status, 41 base::TerminationStatus status,
30 int exit_code) {} 42 int exit_code) {}
31 43
32 // This method is invoked when the observed RenderProcessHost itself is 44 // This method is invoked when the observed RenderProcessHost itself is
33 // destroyed. This is guaranteed to be the last call made to the observer. 45 // destroyed. This is guaranteed to be the last call made to the observer, so
46 // if the observer is tied to the observed RenderProcessHost, it is safe to
47 // delete it.
34 virtual void RenderProcessHostDestroyed(RenderProcessHost* host) {} 48 virtual void RenderProcessHostDestroyed(RenderProcessHost* host) {}
35 49
36 protected: 50 protected:
37 virtual ~RenderProcessHostObserver() {} 51 virtual ~RenderProcessHostObserver() {}
38 }; 52 };
39 53
40 } // namespace content 54 } // namespace content
41 55
42 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_OBSERVER_H_ 56 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_OBSERVER_H_
OLDNEW
« no previous file with comments | « content/public/browser/notification_types.h ('k') | content/test/content_browser_test_utils_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698