diff options
-rw-r--r-- | chrome/browser/chrome_browser_main.cc | 8 | ||||
-rw-r--r-- | chrome/test/base/in_process_browser_test.cc | 2 | ||||
-rw-r--r-- | chrome_frame/test/net/fake_external_tab.cc | 2 | ||||
-rw-r--r-- | content/browser/browser_main_loop.cc | 7 | ||||
-rw-r--r-- | content/browser/browser_main_runner.cc | 4 | ||||
-rw-r--r-- | content/browser/renderer_host/render_process_host_impl.cc | 12 | ||||
-rw-r--r-- | content/public/browser/render_process_host.h | 5 | ||||
-rw-r--r-- | content/renderer/render_thread_impl.cc | 7 | ||||
-rw-r--r-- | content/test/content_browser_test.cc | 1 |
9 files changed, 25 insertions, 23 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 30ceb88..edad343 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -99,7 +99,6 @@ #include "chrome/common/startup_metric_utils.h" #include "chrome/installer/util/google_update_settings.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/render_process_host.h" #include "content/public/common/content_client.h" #include "content/public/common/main_function_params.h" #include "grit/app_locale_settings.h" @@ -649,13 +648,6 @@ DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded() { // content::BrowserMainParts implementation ------------------------------------ void ChromeBrowserMainParts::PreEarlyInitialization() { - // Single-process is an unsupported and not fully tested mode, so - // don't enable it for official Chrome builds (except on Android). -#if defined(GOOGLE_CHROME_BUILD) && !defined(OS_ANDROID) - if (content::RenderProcessHost::run_renderer_in_process()) - content::RenderProcessHost::set_run_renderer_in_process(false); -#endif - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) chrome_extra_parts_[i]->PreEarlyInitialization(); } diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc index 58fd0b4..6b842dd 100644 --- a/chrome/test/base/in_process_browser_test.cc +++ b/chrome/test/base/in_process_browser_test.cc @@ -36,7 +36,6 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" -#include "content/public/browser/render_process_host.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_browser_thread.h" #include "content/public/test/test_launcher.h" @@ -110,7 +109,6 @@ void InProcessBrowserTest::SetUp() { // Single-process mode is not set in BrowserMain, so process it explicitly, // and set up renderer. if (command_line->HasSwitch(switches::kSingleProcess)) { - content::RenderProcessHost::set_run_renderer_in_process(true); single_process_renderer_client_.reset( new chrome::ChromeContentRendererClient); content::GetContentClient()->set_renderer_for_testing( diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index 470b296..33601e2 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -491,7 +491,7 @@ void FakeExternalTab::Initialize() { DCHECK(g_browser_process); g_browser_process->SetApplicationLocale("en-US"); - content::RenderProcessHost::set_run_renderer_in_process(true); + content::RenderProcessHost::SetRunRendererInProcess(true); browser_process_->local_state()->RegisterBooleanPref( prefs::kMetricsReportingEnabled, false); diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index cf59b5d..c384ea5 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -364,6 +364,13 @@ void BrowserMainLoop::CreateThreads() { if (parts_.get()) result_code_ = parts_->PreCreateThreads(); +#if !defined(OS_IOS) && (!defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID)) + // Single-process is an unsupported and not fully tested mode, so + // don't enable it for official Chrome builds (except on Android). + if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) + RenderProcessHost::SetRunRendererInProcess(true); +#endif + if (result_code_ > 0) return; diff --git a/content/browser/browser_main_runner.cc b/content/browser/browser_main_runner.cc index f5208d0..061c7d4 100644 --- a/content/browser/browser_main_runner.cc +++ b/content/browser/browser_main_runner.cc @@ -14,7 +14,6 @@ #include "content/browser/browser_main_loop.h" #include "content/browser/notification_service_impl.h" #include "content/common/child_process.h" -#include "content/public/browser/render_process_host.h" #include "content/public/common/content_switches.h" #include "content/public/common/main_function_params.h" @@ -57,9 +56,6 @@ class BrowserMainRunnerImpl : public content::BrowserMainRunner { // child process (e.g. when launched by PyAuto). if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) ChildProcess::WaitForDebugger("Browser"); - - if (parameters.command_line.HasSwitch(switches::kSingleProcess)) - content::RenderProcessHost::set_run_renderer_in_process(true); #endif // !defined(OS_IOS) #if defined(OS_WIN) diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 7672d87..509c95d 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -1292,8 +1292,18 @@ bool RenderProcessHost::run_renderer_in_process() { return g_run_renderer_in_process_; } -void RenderProcessHost::set_run_renderer_in_process(bool value) { +// static +void RenderProcessHost::SetRunRendererInProcess(bool value) { g_run_renderer_in_process_ = value; + + CommandLine* command_line = CommandLine::ForCurrentProcess(); + if (value && !command_line->HasSwitch(switches::kLang)) { + // Modify the current process' command line to include the browser locale, + // as the renderer expects this flag to be set. + const std::string locale = + GetContentClient()->browser()->GetApplicationLocale(); + command_line->AppendSwitchASCII(switches::kLang, locale); + } } RenderProcessHost::iterator RenderProcessHost::AllHostsIterator() { diff --git a/content/public/browser/render_process_host.h b/content/public/browser/render_process_host.h index 20441cd..1faeae9 100644 --- a/content/public/browser/render_process_host.h +++ b/content/public/browser/render_process_host.h @@ -212,7 +212,10 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Sender, // Renderer is the same, it's just not crossing a process boundary. static bool run_renderer_in_process(); - static void set_run_renderer_in_process(bool value); + + // This also calls out to ContentBrowserClient::GetApplicationLocale and + // modifies the current process' command line. + static void SetRunRendererInProcess(bool value); // Allows iteration over all the RenderProcessHosts in the browser. Note // that each host may not be active, and therefore may have NULL channels. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index db10c25..ce15565 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -473,14 +473,11 @@ IPC::SyncChannel* RenderThreadImpl::GetChannel() { std::string RenderThreadImpl::GetLocale() { // The browser process should have passed the locale to the renderer via the - // --lang command line flag. In single process mode, this will return the - // wrong value. TODO(tc): Fix this for single process mode. + // --lang command line flag. const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); const std::string& lang = parsed_command_line.GetSwitchValueASCII(switches::kLang); - DCHECK(!lang.empty() || - (!parsed_command_line.HasSwitch(switches::kRendererProcess) && - !parsed_command_line.HasSwitch(switches::kPluginProcess))); + DCHECK(!lang.empty()); return lang; } diff --git a/content/test/content_browser_test.cc b/content/test/content_browser_test.cc index 13488f9..f7eeed6 100644 --- a/content/test/content_browser_test.cc +++ b/content/test/content_browser_test.cc @@ -59,7 +59,6 @@ void ContentBrowserTest::SetUp() { // Single-process mode is not set in BrowserMain, so process it explicitly, // and set up renderer. if (command_line->HasSwitch(switches::kSingleProcess)) { - RenderProcessHost::set_run_renderer_in_process(true); single_process_renderer_client_.reset(new ShellContentRendererClient); content::GetContentClient()->set_renderer_for_testing( single_process_renderer_client_.get()); |