| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_RENDER_PROCESS_HOST_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // RenderProcessHost rather than creating a new one. | 250 // RenderProcessHost rather than creating a new one. |
| 251 static bool ShouldTryToUseExistingProcessHost(); | 251 static bool ShouldTryToUseExistingProcessHost(); |
| 252 | 252 |
| 253 // Get an existing RenderProcessHost associated with the given profile, if | 253 // Get an existing RenderProcessHost associated with the given profile, if |
| 254 // possible. The renderer process is chosen randomly from suitable renderers | 254 // possible. The renderer process is chosen randomly from suitable renderers |
| 255 // that share the same profile and type. | 255 // that share the same profile and type. |
| 256 // Returns NULL if no suitable renderer process is available, in which case | 256 // Returns NULL if no suitable renderer process is available, in which case |
| 257 // the caller is free to create a new renderer. | 257 // the caller is free to create a new renderer. |
| 258 static RenderProcessHost* GetExistingProcessHost(Profile* profile, Type type); | 258 static RenderProcessHost* GetExistingProcessHost(Profile* profile, Type type); |
| 259 | 259 |
| 260 // Overrides the default heuristic for limiting the max renderer process |
| 261 // count. This is useful for unit testing process limit behaviors. |
| 262 // A value of zero means to use the default heuristic. |
| 263 static void SetMaxRendererProcessCount(size_t count); |
| 264 |
| 260 protected: | 265 protected: |
| 261 // A proxy for our IPC::Channel that lives on the IO thread (see | 266 // A proxy for our IPC::Channel that lives on the IO thread (see |
| 262 // browser_process.h) | 267 // browser_process.h) |
| 263 scoped_ptr<IPC::SyncChannel> channel_; | 268 scoped_ptr<IPC::SyncChannel> channel_; |
| 264 | 269 |
| 265 // The registered listeners. When this list is empty or all NULL, we should | 270 // The registered listeners. When this list is empty or all NULL, we should |
| 266 // delete ourselves | 271 // delete ourselves |
| 267 IDMap<IPC::Channel::Listener> listeners_; | 272 IDMap<IPC::Channel::Listener> listeners_; |
| 268 | 273 |
| 269 // The maximum page ID we've ever seen from the renderer process. | 274 // The maximum page ID we've ever seen from the renderer process. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // Factory object for RenderProcessHosts. Using this factory allows tests to | 310 // Factory object for RenderProcessHosts. Using this factory allows tests to |
| 306 // swap out a different one to use a TestRenderProcessHost. | 311 // swap out a different one to use a TestRenderProcessHost. |
| 307 class RenderProcessHostFactory { | 312 class RenderProcessHostFactory { |
| 308 public: | 313 public: |
| 309 virtual ~RenderProcessHostFactory() {} | 314 virtual ~RenderProcessHostFactory() {} |
| 310 virtual RenderProcessHost* CreateRenderProcessHost( | 315 virtual RenderProcessHost* CreateRenderProcessHost( |
| 311 Profile* profile) const = 0; | 316 Profile* profile) const = 0; |
| 312 }; | 317 }; |
| 313 | 318 |
| 314 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ | 319 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ |
| OLD | NEW |