OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <queue> | 11 #include <queue> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "app/surface/transport_dib.h" | 14 #include "app/surface/transport_dib.h" |
| 15 #include "base/mp/mp_child_process_launcher.h" |
15 #include "base/process.h" | 16 #include "base/process.h" |
16 #include "base/scoped_ptr.h" | 17 #include "base/scoped_ptr.h" |
17 #include "base/timer.h" | 18 #include "base/timer.h" |
18 #include "chrome/browser/child_process_launcher.h" | 19 #include "chrome/browser/child_process_context.h" |
19 #include "chrome/browser/renderer_host/render_process_host.h" | 20 #include "chrome/browser/renderer_host/render_process_host.h" |
20 #include "chrome/common/notification_registrar.h" | 21 #include "chrome/common/notification_registrar.h" |
21 #include "third_party/WebKit/WebKit/chromium/public/WebCache.h" | 22 #include "third_party/WebKit/WebKit/chromium/public/WebCache.h" |
22 | 23 |
23 class AudioRendererHost; | 24 class AudioRendererHost; |
24 class CommandLine; | 25 class CommandLine; |
25 class GURL; | 26 class GURL; |
26 class RendererMainThread; | 27 class RendererMainThread; |
27 class RenderWidgetHelper; | 28 class RenderWidgetHelper; |
28 class TabContents; | 29 class TabContents; |
(...skipping 17 matching lines...) Expand all Loading... |
46 // This object is refcounted so that it can release its resources when all | 47 // This object is refcounted so that it can release its resources when all |
47 // hosts using it go away. | 48 // hosts using it go away. |
48 // | 49 // |
49 // This object communicates back and forth with the RenderProcess object | 50 // This object communicates back and forth with the RenderProcess object |
50 // running in the renderer process. Each RenderProcessHost and RenderProcess | 51 // running in the renderer process. Each RenderProcessHost and RenderProcess |
51 // keeps a list of RenderView (renderer) and TabContents (browser) which | 52 // keeps a list of RenderView (renderer) and TabContents (browser) which |
52 // are correlated with IDs. This way, the Views and the corresponding ViewHosts | 53 // are correlated with IDs. This way, the Views and the corresponding ViewHosts |
53 // communicate through the two process objects. | 54 // communicate through the two process objects. |
54 class BrowserRenderProcessHost : public RenderProcessHost, | 55 class BrowserRenderProcessHost : public RenderProcessHost, |
55 public NotificationObserver, | 56 public NotificationObserver, |
56 public ChildProcessLauncher::Client { | 57 public base::MpChildProcessLauncher::Client { |
57 public: | 58 public: |
58 explicit BrowserRenderProcessHost(Profile* profile); | 59 explicit BrowserRenderProcessHost(Profile* profile); |
59 ~BrowserRenderProcessHost(); | 60 ~BrowserRenderProcessHost(); |
60 | 61 |
61 // RenderProcessHost implementation (public portion). | 62 // RenderProcessHost implementation (public portion). |
62 virtual bool Init(bool is_extensions_process, | 63 virtual bool Init(bool is_extensions_process, |
63 URLRequestContextGetter* request_context); | 64 URLRequestContextGetter* request_context); |
64 virtual int GetNextRoutingID(); | 65 virtual int GetNextRoutingID(); |
65 virtual void CancelResourceRequests(int render_widget_id); | 66 virtual void CancelResourceRequests(int render_widget_id); |
66 virtual void CrossSiteClosePageACK(const ViewMsg_ClosePage_Params& params); | 67 virtual void CrossSiteClosePageACK(const ViewMsg_ClosePage_Params& params); |
(...skipping 24 matching lines...) Expand all Loading... |
91 // corrupted and thus needs to be terminated using this call. This function | 92 // corrupted and thus needs to be terminated using this call. This function |
92 // can be safely called from any thread. | 93 // can be safely called from any thread. |
93 static void BadMessageTerminateProcess(uint32 msg_type, | 94 static void BadMessageTerminateProcess(uint32 msg_type, |
94 base::ProcessHandle renderer); | 95 base::ProcessHandle renderer); |
95 | 96 |
96 // NotificationObserver implementation. | 97 // NotificationObserver implementation. |
97 virtual void Observe(NotificationType type, | 98 virtual void Observe(NotificationType type, |
98 const NotificationSource& source, | 99 const NotificationSource& source, |
99 const NotificationDetails& details); | 100 const NotificationDetails& details); |
100 | 101 |
101 // ChildProcessLauncher::Client implementation. | 102 // base::MpChildProcessLauncher::Client implementation. |
102 virtual void OnProcessLaunched(); | 103 virtual void OnProcessLaunched(); |
103 | 104 |
104 private: | 105 private: |
105 friend class VisitRelayingRenderProcessHost; | 106 friend class VisitRelayingRenderProcessHost; |
106 | 107 |
107 // Control message handlers. | 108 // Control message handlers. |
108 void OnUpdatedCacheStats(const WebKit::WebCache::UsageStats& stats); | 109 void OnUpdatedCacheStats(const WebKit::WebCache::UsageStats& stats); |
109 void SuddenTerminationChanged(bool enabled); | 110 void SuddenTerminationChanged(bool enabled); |
110 void OnExtensionAddListener(const std::string& event_name); | 111 void OnExtensionAddListener(const std::string& event_name); |
111 void OnExtensionRemoveListener(const std::string& event_name); | 112 void OnExtensionRemoveListener(const std::string& event_name); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 scoped_ptr<RendererMainThread> in_process_renderer_; | 192 scoped_ptr<RendererMainThread> in_process_renderer_; |
192 | 193 |
193 // Buffer visited links and send them to to renderer. | 194 // Buffer visited links and send them to to renderer. |
194 scoped_ptr<VisitedLinkUpdater> visited_link_updater_; | 195 scoped_ptr<VisitedLinkUpdater> visited_link_updater_; |
195 | 196 |
196 // True iff this process is being used as an extension process. Not valid | 197 // True iff this process is being used as an extension process. Not valid |
197 // when running in single-process mode. | 198 // when running in single-process mode. |
198 bool extension_process_; | 199 bool extension_process_; |
199 | 200 |
200 // Usedt to launch and terminate the process without blocking the UI thread. | 201 // Usedt to launch and terminate the process without blocking the UI thread. |
201 scoped_ptr<ChildProcessLauncher> child_process_; | 202 scoped_ptr<base::MpChildProcessLauncher> child_process_; |
202 | 203 |
203 // Messages we queue while waiting for the process handle. We queue them here | 204 // Messages we queue while waiting for the process handle. We queue them here |
204 // instead of in the channel so that we ensure they're sent after init related | 205 // instead of in the channel so that we ensure they're sent after init related |
205 // messages that are sent once the process handle is available. This is | 206 // messages that are sent once the process handle is available. This is |
206 // because the queued messages may have dependencies on the init messages. | 207 // because the queued messages may have dependencies on the init messages. |
207 std::queue<IPC::Message*> queued_messages_; | 208 std::queue<IPC::Message*> queued_messages_; |
208 | 209 |
| 210 ChildProcessContext context_; |
| 211 |
209 DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost); | 212 DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost); |
210 }; | 213 }; |
211 | 214 |
212 #endif // CHROME_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ | 215 #endif // CHROME_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ |
OLD | NEW |