render_process_host_observer.h revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
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
3// found in the LICENSE file.
4
5#ifndef CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_OBSERVER_H_
6#define CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_OBSERVER_H_
7
8#include "base/process/kill.h"
9#include "base/process/process_handle.h"
10#include "content/common/content_export.h"
11
12namespace content {
13
14class RenderProcessHost;
15
16// An observer API implemented by classes which are interested
17// in RenderProcessHost lifecycle events.
18class CONTENT_EXPORT RenderProcessHostObserver {
19 public:
20  // This method is invoked when a render process exited (either normally or
21  // with a crash). To determine if the process closed normally or crashed,
22  // examine the |status| parameter.
23  //
24  // Note that this is equivalent to WebContentsObserver::RenderProcessGone().
25  virtual void RenderProcessExited(RenderProcessHost* host,
26                                   base::ProcessHandle handle,
27                                   base::TerminationStatus status,
28                                   int exit_code) {}
29
30  // This method is invoked when the observed RenderProcessHost itself is
31  // destroyed. This is guaranteed to be the last call made to the observer.
32  virtual void RenderProcessHostDestroyed(RenderProcessHost* host) {}
33
34 protected:
35  virtual ~RenderProcessHostObserver() {}
36};
37
38}  // namespace content
39
40#endif  // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_OBSERVER_H_
41