diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-12 20:15:31 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-12 20:15:31 +0000 |
commit | 7f198bfa3b28cb534d4b8cedf932309db5217ac3 (patch) | |
tree | 69f000c053517756805c381f4941950b50c2aabf /chrome | |
parent | 289bf6b65d6fe6c45452d8c364e5730aa8bacb03 (diff) | |
download | chromium_src-7f198bfa3b28cb534d4b8cedf932309db5217ac3.zip chromium_src-7f198bfa3b28cb534d4b8cedf932309db5217ac3.tar.gz chromium_src-7f198bfa3b28cb534d4b8cedf932309db5217ac3.tar.bz2 |
Fix SessionRestoreUITest.TwoTabsSecondSelected in single process mode.
This is admitedly a little hacky, but I don't care as much since it's single-process mode and I don't think there's another way to solve it. The problem is that SiteInstance::GetProcess should always reuse an existing renderer "process", but GetExistingProcessHost() won't return the in-process renderer until RenderProcessHost::Init is called, which is after the second GetProcess call. So since we generate the in-process 'pid', I do it in the constructor instead of in Init.
Review URL: http://codereview.chromium.org/42144
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11571 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.cc | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index a3171e3..4a525a7 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -139,6 +139,16 @@ BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile) NotificationType::USER_SCRIPTS_LOADED, NotificationService::AllSources()); + if (run_renderer_in_process()) { + // We need a "renderer pid", but we don't have one when there's no renderer + // process. So pick a value that won't clash with other child process pids. + // Linux has PID_MAX_LIMIT which is 2^22. Windows always uses pids that are + // divisible by 4. So... + static int next_pid = 4 * 1024 * 1024; + next_pid += 3; + SetProcessID(next_pid); + } + // Note: When we create the BrowserRenderProcessHost, it's technically // backgrounded, because it has no visible listeners. But the process // doesn't actually exist yet, so we'll Background it later, after @@ -301,9 +311,7 @@ bool BrowserRenderProcessHost::Init() { cmd_line.AppendSwitchWithValue(switches::kUserDataDir, profile_path); - int process_id; - bool run_in_process = run_renderer_in_process(); - if (run_in_process) { + if (run_renderer_in_process()) { // Crank up a thread and run the initialization there. With the way that // messages flow between the browser and renderer, this thread is required // to prevent a deadlock in single-process mode. When using multiple @@ -319,14 +327,6 @@ bool BrowserRenderProcessHost::Init() { base::Thread::Options options; options.message_loop_type = MessageLoop::TYPE_IO; in_process_renderer_->StartWithOptions(options); - - // We need a "renderer pid", but we don't have one when there's no renderer - // process. So pick a value that won't clash with other child process pids. - // Linux has PID_MAX_LIMIT which is 2^22. Windows always uses pids that are - // divisible by 4. So... - static int next_pid = 4 * 1024 * 1024; - next_pid += 3; - process_id = next_pid; } else { #if defined(OS_WIN) if (in_sandbox) { @@ -410,10 +410,9 @@ bool BrowserRenderProcessHost::Init() { process_.set_handle(process); } - process_id = process_.pid(); + SetProcessID(process_.pid()); } - SetProcessID(process_id); resource_message_filter->Init(pid()); CacheManagerHost::GetInstance()->Add(pid()); RendererSecurityPolicy::GetInstance()->Add(pid()); |