OLD | NEW |
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_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // This should only be used for process-per-site mode, which can be enabled | 177 // This should only be used for process-per-site mode, which can be enabled |
178 // globally with a command line flag or per-site, as determined by | 178 // globally with a command line flag or per-site, as determined by |
179 // SiteInstanceImpl::ShouldUseProcessPerSite. | 179 // SiteInstanceImpl::ShouldUseProcessPerSite. |
180 static void RegisterProcessHostForSite( | 180 static void RegisterProcessHostForSite( |
181 BrowserContext* browser_context, | 181 BrowserContext* browser_context, |
182 RenderProcessHost* process, | 182 RenderProcessHost* process, |
183 const GURL& url); | 183 const GURL& url); |
184 | 184 |
185 static base::MessageLoop* GetInProcessRendererThreadForTesting(); | 185 static base::MessageLoop* GetInProcessRendererThreadForTesting(); |
186 | 186 |
| 187 void SetChildProcessLauncherFactory( |
| 188 const base::Callback<scoped_ptr<ChildProcessLauncher>( |
| 189 #if defined(OS_WIN) |
| 190 SandboxedProcessLauncherDelegate* delegate, |
| 191 #elif defined(OS_POSIX) |
| 192 bool use_zygote, |
| 193 const base::EnvironmentVector& environ, |
| 194 int ipcfd, |
| 195 #endif |
| 196 CommandLine* cmd_line, |
| 197 int child_process_id, |
| 198 ChildProcessLauncher::Client* client)>& factory) { |
| 199 child_process_launcher_factory_ = factory; |
| 200 } |
| 201 |
187 protected: | 202 protected: |
188 // A proxy for our IPC::Channel that lives on the IO thread (see | 203 // A proxy for our IPC::Channel that lives on the IO thread (see |
189 // browser_process.h) | 204 // browser_process.h) |
190 scoped_ptr<IPC::ChannelProxy> channel_; | 205 scoped_ptr<IPC::ChannelProxy> channel_; |
191 | 206 |
192 // The registered render widget hosts. When this list is empty or all NULL, | 207 // The registered render widget hosts. When this list is empty or all NULL, |
193 // we should delete ourselves | 208 // we should delete ourselves |
194 IDMap<RenderWidgetHost> render_widget_hosts_; | 209 IDMap<RenderWidgetHost> render_widget_hosts_; |
195 | 210 |
196 // True if fast shutdown has been performed on this RPH. | 211 // True if fast shutdown has been performed on this RPH. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // This is used to clear our cache five seconds after the last use. | 286 // This is used to clear our cache five seconds after the last use. |
272 base::DelayTimer<RenderProcessHostImpl> cached_dibs_cleaner_; | 287 base::DelayTimer<RenderProcessHostImpl> cached_dibs_cleaner_; |
273 | 288 |
274 // Used in single-process mode. | 289 // Used in single-process mode. |
275 scoped_ptr<RendererMainThread> in_process_renderer_; | 290 scoped_ptr<RendererMainThread> in_process_renderer_; |
276 | 291 |
277 // True after Init() has been called. We can't just check channel_ because we | 292 // True after Init() has been called. We can't just check channel_ because we |
278 // also reset that in the case of process termination. | 293 // also reset that in the case of process termination. |
279 bool is_initialized_; | 294 bool is_initialized_; |
280 | 295 |
| 296 // Used to mock out child_process_launcher_ in tests. See |
| 297 // NewChildProcessLauncher() for the interface. |
| 298 base::Callback<scoped_ptr<ChildProcessLauncher>( |
| 299 #if defined(OS_WIN) |
| 300 SandboxedProcessLauncherDelegate* delegate, |
| 301 #elif defined(OS_POSIX) |
| 302 bool use_zygote, |
| 303 const base::EnvironmentVector& environ, |
| 304 int ipcfd, |
| 305 #endif |
| 306 CommandLine* cmd_line, |
| 307 int child_process_id, |
| 308 ChildProcessLauncher::Client* client)> |
| 309 child_process_launcher_factory_; |
| 310 |
281 // Used to launch and terminate the process without blocking the UI thread. | 311 // Used to launch and terminate the process without blocking the UI thread. |
282 scoped_ptr<ChildProcessLauncher> child_process_launcher_; | 312 scoped_ptr<ChildProcessLauncher> child_process_launcher_; |
283 | 313 |
284 // Messages we queue while waiting for the process handle. We queue them here | 314 // Messages we queue while waiting for the process handle. We queue them here |
285 // instead of in the channel so that we ensure they're sent after init related | 315 // instead of in the channel so that we ensure they're sent after init related |
286 // messages that are sent once the process handle is available. This is | 316 // messages that are sent once the process handle is available. This is |
287 // because the queued messages may have dependencies on the init messages. | 317 // because the queued messages may have dependencies on the init messages. |
288 std::queue<IPC::Message*> queued_messages_; | 318 std::queue<IPC::Message*> queued_messages_; |
289 | 319 |
290 // The globally-unique identifier for this RPH. | 320 // The globally-unique identifier for this RPH. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 // Prevents the class from being added as a GpuDataManagerImpl observer more | 364 // Prevents the class from being added as a GpuDataManagerImpl observer more |
335 // than once. | 365 // than once. |
336 bool gpu_observer_registered_; | 366 bool gpu_observer_registered_; |
337 | 367 |
338 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); | 368 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); |
339 }; | 369 }; |
340 | 370 |
341 } // namespace content | 371 } // namespace content |
342 | 372 |
343 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ | 373 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ |
OLD | NEW |