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

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

Issue 72203003: Introduce RenderProcessHostObserver, use it in its first client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/browser/render_process_host_observer.h » ('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) 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_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_
6 #define CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ 6 #define CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/id_map.h" 9 #include "base/id_map.h"
10 #include "base/process/kill.h" 10 #include "base/process/kill.h"
11 #include "base/process/process_handle.h" 11 #include "base/process/process_handle.h"
12 #include "base/supports_user_data.h" 12 #include "base/supports_user_data.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "ipc/ipc_channel_proxy.h" 14 #include "ipc/ipc_channel_proxy.h"
15 #include "ipc/ipc_sender.h" 15 #include "ipc/ipc_sender.h"
16 #include "ui/gfx/native_widget_types.h" 16 #include "ui/gfx/native_widget_types.h"
17 #include "ui/surface/transport_dib.h" 17 #include "ui/surface/transport_dib.h"
18 18
19 class GURL; 19 class GURL;
20 struct ViewMsg_SwapOut_Params; 20 struct ViewMsg_SwapOut_Params;
21 21
22 namespace base { 22 namespace base {
23 class TimeDelta; 23 class TimeDelta;
24 } 24 }
25 25
26 namespace content { 26 namespace content {
27 class BrowserContext; 27 class BrowserContext;
28 class BrowserMessageFilter; 28 class BrowserMessageFilter;
29 class RenderProcessHostObserver;
29 class RenderWidgetHost; 30 class RenderWidgetHost;
30 class StoragePartition; 31 class StoragePartition;
31 32
32 typedef base::Thread* (*RendererMainThreadFactoryFunction)( 33 typedef base::Thread* (*RendererMainThreadFactoryFunction)(
33 const std::string& id); 34 const std::string& id);
34 35
35 // Interface that represents the browser side of the browser <-> renderer 36 // Interface that represents the browser side of the browser <-> renderer
36 // communication channel. There will generally be one RenderProcessHost per 37 // communication channel. There will generally be one RenderProcessHost per
37 // renderer process. 38 // renderer process.
38 class CONTENT_EXPORT RenderProcessHost : public IPC::Sender, 39 class CONTENT_EXPORT RenderProcessHost : public IPC::Sender,
39 public IPC::Listener, 40 public IPC::Listener,
40 public base::SupportsUserData { 41 public base::SupportsUserData {
41 public: 42 public:
42 typedef IDMap<RenderProcessHost>::iterator iterator; 43 typedef IDMap<RenderProcessHost>::iterator iterator;
43 44
44 // Details for RENDERER_PROCESS_CLOSED notifications. 45 // Details for RENDERER_PROCESS_CLOSED notifications.
45 struct RendererClosedDetails { 46 struct RendererClosedDetails {
46 RendererClosedDetails(base::ProcessHandle handle, 47 RendererClosedDetails(base::ProcessHandle handle,
47 base::TerminationStatus status, 48 base::TerminationStatus status,
48 int exit_code) { 49 int exit_code) {
49 this->handle = handle; 50 this->handle = handle;
50 this->status = status; 51 this->status = status;
51 this->exit_code = exit_code; 52 this->exit_code = exit_code;
52 } 53 }
53 base::ProcessHandle handle; 54 base::ProcessHandle handle;
54 base::TerminationStatus status; 55 base::TerminationStatus status;
55 int exit_code; 56 int exit_code;
56 }; 57 };
57 58
59 // General functions ---------------------------------------------------------
60
58 virtual ~RenderProcessHost() {} 61 virtual ~RenderProcessHost() {}
59 62
60 // Initialize the new renderer process, returning true on success. This must 63 // Initialize the new renderer process, returning true on success. This must
61 // be called once before the object can be used, but can be called after 64 // be called once before the object can be used, but can be called after
62 // that with no effect. Therefore, if the caller isn't sure about whether 65 // that with no effect. Therefore, if the caller isn't sure about whether
63 // the process has been created, it should just call Init(). 66 // the process has been created, it should just call Init().
64 virtual bool Init() = 0; 67 virtual bool Init() = 0;
65 68
66 // Gets the next available routing id. 69 // Gets the next available routing id.
67 virtual int GetNextRoutingID() = 0; 70 virtual int GetNextRoutingID() = 0;
68 71
69 // These methods add or remove listener for a specific message routing ID. 72 // These methods add or remove listener for a specific message routing ID.
70 // Used for refcounting, each holder of this object must AddRoute and 73 // Used for refcounting, each holder of this object must AddRoute and
71 // RemoveRoute. This object should be allocated on the heap; when no 74 // RemoveRoute. This object should be allocated on the heap; when no
72 // listeners own it any more, it will delete itself. 75 // listeners own it any more, it will delete itself.
73 virtual void AddRoute(int32 routing_id, IPC::Listener* listener) = 0; 76 virtual void AddRoute(int32 routing_id, IPC::Listener* listener) = 0;
74 virtual void RemoveRoute(int32 routing_id) = 0; 77 virtual void RemoveRoute(int32 routing_id) = 0;
75 78
79 // Add and remove observers for lifecycle events. The order in which
80 // notifications are sent to observers is undefined. Observers must be sure to
81 // remove the observer before they go away.
82 virtual void AddObserver(RenderProcessHostObserver* observer) = 0;
83 virtual void RemoveObserver(RenderProcessHostObserver* observer) = 0;
84
76 // Called to wait for the next UpdateRect message for the specified render 85 // Called to wait for the next UpdateRect message for the specified render
77 // widget. Returns true if successful, and the msg out-param will contain a 86 // widget. Returns true if successful, and the msg out-param will contain a
78 // copy of the received UpdateRect message. 87 // copy of the received UpdateRect message.
79 virtual bool WaitForBackingStoreMsg(int render_widget_id, 88 virtual bool WaitForBackingStoreMsg(int render_widget_id,
80 const base::TimeDelta& max_delay, 89 const base::TimeDelta& max_delay,
81 IPC::Message* msg) = 0; 90 IPC::Message* msg) = 0;
82 91
83 // Called when a received message cannot be decoded. 92 // Called when a received message cannot be decoded.
84 virtual void ReceivedBadMessage() = 0; 93 virtual void ReceivedBadMessage() = 0;
85 94
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // module. 264 // module.
256 static size_t GetMaxRendererProcessCount(); 265 static size_t GetMaxRendererProcessCount();
257 266
258 static void RegisterRendererMainThreadFactory( 267 static void RegisterRendererMainThreadFactory(
259 RendererMainThreadFactoryFunction create); 268 RendererMainThreadFactoryFunction create);
260 }; 269 };
261 270
262 } // namespace content. 271 } // namespace content.
263 272
264 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ 273 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/browser/render_process_host_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698