| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 static void SetRunRendererInProcess(bool value); | 225 static void SetRunRendererInProcess(bool value); |
| 226 | 226 |
| 227 // Allows iteration over all the RenderProcessHosts in the browser. Note | 227 // Allows iteration over all the RenderProcessHosts in the browser. Note |
| 228 // that each host may not be active, and therefore may have NULL channels. | 228 // that each host may not be active, and therefore may have NULL channels. |
| 229 static iterator AllHostsIterator(); | 229 static iterator AllHostsIterator(); |
| 230 | 230 |
| 231 // Returns the RenderProcessHost given its ID. Returns NULL if the ID does | 231 // Returns the RenderProcessHost given its ID. Returns NULL if the ID does |
| 232 // not correspond to a live RenderProcessHost. | 232 // not correspond to a live RenderProcessHost. |
| 233 static RenderProcessHost* FromID(int render_process_id); | 233 static RenderProcessHost* FromID(int render_process_id); |
| 234 | 234 |
| 235 // Returns whether the process-per-site model is in use (globally or just for |
| 236 // the current site), in which case we should ensure there is only one |
| 237 // RenderProcessHost per site for the entire browser context. |
| 238 static bool ShouldUseProcessPerSite(content::BrowserContext* browser_context, |
| 239 const GURL& url); |
| 240 |
| 235 // Returns true if the caller should attempt to use an existing | 241 // Returns true if the caller should attempt to use an existing |
| 236 // RenderProcessHost rather than creating a new one. | 242 // RenderProcessHost rather than creating a new one. |
| 237 static bool ShouldTryToUseExistingProcessHost( | 243 static bool ShouldTryToUseExistingProcessHost( |
| 238 content::BrowserContext* browser_context, const GURL& site_url); | 244 content::BrowserContext* browser_context, const GURL& site_url); |
| 239 | 245 |
| 240 // Get an existing RenderProcessHost associated with the given browser | 246 // Get an existing RenderProcessHost associated with the given browser |
| 241 // context, if possible. The renderer process is chosen randomly from | 247 // context, if possible. The renderer process is chosen randomly from |
| 242 // suitable renderers that share the same context and type (determined by the | 248 // suitable renderers that share the same context and type (determined by the |
| 243 // site url). | 249 // site url). |
| 244 // Returns NULL if no suitable renderer process is available, in which case | 250 // Returns NULL if no suitable renderer process is available, in which case |
| 245 // the caller is free to create a new renderer. | 251 // the caller is free to create a new renderer. |
| 246 static RenderProcessHost* GetExistingProcessHost( | 252 static RenderProcessHost* GetExistingProcessHost( |
| 247 content::BrowserContext* browser_context, const GURL& site_url); | 253 content::BrowserContext* browser_context, const GURL& site_url); |
| 248 | 254 |
| 249 // Overrides the default heuristic for limiting the max renderer process | 255 // Overrides the default heuristic for limiting the max renderer process |
| 250 // count. This is useful for unit testing process limit behaviors. It is | 256 // count. This is useful for unit testing process limit behaviors. It is |
| 251 // also used to allow a command line parameter to configure the max number of | 257 // also used to allow a command line parameter to configure the max number of |
| 252 // renderer processes and should only be called once during startup. | 258 // renderer processes and should only be called once during startup. |
| 253 // A value of zero means to use the default heuristic. | 259 // A value of zero means to use the default heuristic. |
| 254 static void SetMaxRendererProcessCount(size_t count); | 260 static void SetMaxRendererProcessCount(size_t count); |
| 255 | 261 |
| 256 // Returns the current max number of renderer processes used by the content | 262 // Returns the current max number of renderer processes used by the content |
| 257 // module. | 263 // module. |
| 258 static size_t GetMaxRendererProcessCount(); | 264 static size_t GetMaxRendererProcessCount(); |
| 259 }; | 265 }; |
| 260 | 266 |
| 261 } // namespace content. | 267 } // namespace content. |
| 262 | 268 |
| 263 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ | 269 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ |
| OLD | NEW |