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_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.h" | 10 #include "base/process.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 | 224 |
225 // Get an existing RenderProcessHost associated with the given browser | 225 // Get an existing RenderProcessHost associated with the given browser |
226 // context, if possible. The renderer process is chosen randomly from | 226 // context, if possible. The renderer process is chosen randomly from |
227 // suitable renderers that share the same context and type (determined by the | 227 // suitable renderers that share the same context and type (determined by the |
228 // site url). | 228 // site url). |
229 // Returns NULL if no suitable renderer process is available, in which case | 229 // Returns NULL if no suitable renderer process is available, in which case |
230 // the caller is free to create a new renderer. | 230 // the caller is free to create a new renderer. |
231 static RenderProcessHost* GetExistingProcessHost( | 231 static RenderProcessHost* GetExistingProcessHost( |
232 content::BrowserContext* browser_context, const GURL& site_url); | 232 content::BrowserContext* browser_context, const GURL& site_url); |
233 | 233 |
234 // Returns whether the process-per-site model is in use (globally or just for | |
235 // the current site), in which case we should ensure there is only one | |
236 // RenderProcessHost per site for the entire browser context. | |
237 static bool ShouldUseProcessPerSite(content::BrowserContext* browser_context, | |
238 const GURL& url); | |
239 | |
240 // Returns an existing RenderProcessHost for |url| in |browser_context|, | |
241 // if one exists. Otherwise a new RenderProcessHost should be created and | |
242 // registered using RegisterProcessHostForSite. | |
awong
2012/06/27 00:26:54
RegisterProcessHostForSite -> RegisterProcessHostF
Charlie Reis
2012/06/27 20:53:43
Done.
| |
243 // This should only be used for process-per-site mode, which can be enabled | |
244 // globally with a command line flag or per-site, as determined by | |
245 // SiteInstanceImpl::ShouldUseProcessPerSite. | |
246 static RenderProcessHost* GetProcessHostForSite( | |
247 content::BrowserContext* browser_context, | |
248 const GURL& url); | |
249 | |
250 // Registers the given |process| to be used for any instance of |url| | |
251 // within |browser_context|. | |
252 // This should only be used for process-per-site mode, which can be enabled | |
253 // globally with a command line flag or per-site, as determined by | |
254 // SiteInstanceImpl::ShouldUseProcessPerSite. | |
255 static void RegisterProcessHostForSite( | |
256 content::BrowserContext* browser_context, | |
257 RenderProcessHost* process, | |
258 const GURL& url); | |
259 | |
234 // Overrides the default heuristic for limiting the max renderer process | 260 // Overrides the default heuristic for limiting the max renderer process |
235 // count. This is useful for unit testing process limit behaviors. It is | 261 // count. This is useful for unit testing process limit behaviors. It is |
236 // also used to allow a command line parameter to configure the max number of | 262 // also used to allow a command line parameter to configure the max number of |
237 // renderer processes and should only be called once during startup. | 263 // renderer processes and should only be called once during startup. |
238 // A value of zero means to use the default heuristic. | 264 // A value of zero means to use the default heuristic. |
239 static void SetMaxRendererProcessCount(size_t count); | 265 static void SetMaxRendererProcessCount(size_t count); |
240 | 266 |
241 // Returns the current max number of renderer processes used by the content | 267 // Returns the current max number of renderer processes used by the content |
242 // module. | 268 // module. |
243 static size_t GetMaxRendererProcessCount(); | 269 static size_t GetMaxRendererProcessCount(); |
244 }; | 270 }; |
245 | 271 |
246 } // namespace content. | 272 } // namespace content. |
247 | 273 |
248 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ | 274 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ |
OLD | NEW |