diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-10 21:55:21 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-10 21:55:21 +0000 |
commit | 7c27203a71841cb6de9b630ff4730a13f454a90a (patch) | |
tree | 9fba51a19fca8a11ceb7a29500ec5b44eda175c6 /chrome | |
parent | 8ada8c50ea727c2fa0a93a7ac1e7256a80a2e53f (diff) | |
download | chromium_src-7c27203a71841cb6de9b630ff4730a13f454a90a.zip chromium_src-7c27203a71841cb6de9b630ff4730a13f454a90a.tar.gz chromium_src-7c27203a71841cb6de9b630ff4730a13f454a90a.tar.bz2 |
Get rid of --start-renderers-manually since it's been broken for a long time (the browser needs the renderer's handle to duplicate handles).
Review URL: http://codereview.chromium.org/43035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11379 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser_init.cc | 6 | ||||
-rw-r--r-- | chrome/browser/browser_init.h | 4 | ||||
-rw-r--r-- | chrome/browser/browser_main.cc | 4 | ||||
-rw-r--r-- | chrome/browser/browser_prefs.cc | 1 | ||||
-rw-r--r-- | chrome/browser/process_singleton_win.cc | 2 | ||||
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.cc | 170 | ||||
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.h | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 5 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 3 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 1 |
11 files changed, 75 insertions, 125 deletions
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index eb9e965..328507cb 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -417,8 +417,7 @@ void BrowserInit::LaunchWithProfile::AddStartupURLs( bool BrowserInit::ProcessCommandLine( const CommandLine& command_line, const std::wstring& cur_dir, - PrefService* prefs, bool process_startup, Profile* profile, - int* return_code) { + bool process_startup, Profile* profile, int* return_code) { DCHECK(profile); if (process_startup) { const std::wstring popup_count_string = @@ -473,9 +472,6 @@ bool BrowserInit::ProcessCommandLine( // Allow the command line to override the persisted setting of home page. SetOverrideHomePage(command_line, profile->GetPrefs()); - if (command_line.HasSwitch(switches::kBrowserStartRenderersManually)) - prefs->transient()->SetBoolean(prefs::kStartRenderersManually, true); - bool silent_launch = false; if (command_line.HasSwitch(switches::kAutomationClientChannelID)) { std::wstring automation_channel_id = diff --git a/chrome/browser/browser_init.h b/chrome/browser/browser_init.h index 050d403..290ec12 100644 --- a/chrome/browser/browser_init.h +++ b/chrome/browser/browser_init.h @@ -93,8 +93,8 @@ class BrowserInit { // ProcessSingleton::OnCopyData). static bool ProcessCommandLine(const CommandLine& command_line, const std::wstring& cur_dir, - PrefService* prefs, bool process_startup, - Profile* profile, int* return_code); + bool process_startup, Profile* profile, + int* return_code); // Helper function to launch a new browser based on command-line arguments // This function takes in a specific profile to use. diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 1d097b5..4b5ce2c 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -553,8 +553,8 @@ int BrowserMain(const MainFunctionParams& parameters) { MessageLoopForUI::current()->PostTask(FROM_HERE, parameters.ui_task); RunUIMessageLoop(browser_process.get()); } else if (BrowserInit::ProcessCommandLine(parsed_command_line, - std::wstring(), local_state, true, - profile, &result_code)) { + std::wstring(), true, profile, + &result_code)) { if (pool) pool->Recycle(); RunUIMessageLoop(browser_process.get()); } diff --git a/chrome/browser/browser_prefs.cc b/chrome/browser/browser_prefs.cc index 5a50444..cf3b942 100644 --- a/chrome/browser/browser_prefs.cc +++ b/chrome/browser/browser_prefs.cc @@ -38,7 +38,6 @@ void RegisterAllPrefs(PrefService* user_prefs, PrefService* local_state) { // Prefs in Local State GoogleURLTracker::RegisterPrefs(local_state); Browser::RegisterPrefs(local_state); - BrowserRenderProcessHost::RegisterPrefs(local_state); CacheManagerHost::RegisterPrefs(local_state); SafeBrowsingService::RegisterPrefs(local_state); MetricsLog::RegisterPrefs(local_state); diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc index f082c8c..190804f 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -229,7 +229,7 @@ LRESULT ProcessSingleton::OnCopyData(HWND hwnd, const COPYDATASTRUCT* cds) { // Run the browser startup sequence again, with the command line of the // signalling process. - BrowserInit::ProcessCommandLine(parsed_command_line, cur_dir, prefs, false, + BrowserInit::ProcessCommandLine(parsed_command_line, cur_dir, false, profile, NULL); return TRUE; } diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 03bdbc8..fd5ba33 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -121,11 +121,6 @@ bool GetRendererPath(std::wstring* cmd_line) { const wchar_t* const kDesktopName = L"ChromeRendererDesktop"; -// static -void BrowserRenderProcessHost::RegisterPrefs(PrefService* prefs) { - prefs->RegisterBooleanPref(prefs::kStartRenderersManually, false); -} - BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile) : RenderProcessHost(profile), visible_widgets_(0), @@ -179,27 +174,6 @@ BrowserRenderProcessHost::~BrowserRenderProcessHost() { ClearTransportDIBCache(); } -// When we're started with the --start-renderers-manually flag, we pop up a -// modal dialog requesting the user manually start up a renderer. -// |cmd_line| is the command line to start the renderer with. -static void RunStartRenderersManuallyDialog(const CommandLine& cmd_line) { -#if defined(OS_WIN) - std::wstring message = - L"Please start a renderer process using:\n" + - cmd_line.command_line_string(); - - // We don't know the owner window for RenderProcessHost and therefore we - // pass a NULL HWND argument. - win_util::MessageBox(NULL, - message, - switches::kBrowserStartRenderersManually, - MB_OK); -#else - // TODO(port): refactor above code / pop up a message box here. - NOTIMPLEMENTED(); -#endif -} - bool BrowserRenderProcessHost::Init() { // calling Init() more than once does nothing, this makes it more convenient // for the view host which may not be sure in some cases @@ -350,92 +324,86 @@ bool BrowserRenderProcessHost::Init() { options.message_loop_type = MessageLoop::TYPE_IO; in_process_renderer_->StartWithOptions(options); } else { - if (g_browser_process->local_state() && - g_browser_process->local_state()->GetBoolean( - prefs::kStartRenderersManually)) { - RunStartRenderersManuallyDialog(cmd_line); - } else { #if defined(OS_WIN) - if (in_sandbox) { - // spawn the child process in the sandbox - sandbox::BrokerServices* broker_service = - g_browser_process->broker_services(); - - sandbox::ResultCode result; - PROCESS_INFORMATION target = {0}; - sandbox::TargetPolicy* policy = broker_service->CreatePolicy(); - policy->SetJobLevel(sandbox::JOB_LOCKDOWN, 0); - - sandbox::TokenLevel initial_token = sandbox::USER_UNPROTECTED; - if (win_util::GetWinVersion() > win_util::WINVERSION_XP) { - // On 2003/Vista the initial token has to be restricted if the main - // token is restricted. - initial_token = sandbox::USER_RESTRICTED_SAME_ACCESS; - } - - policy->SetTokenLevel(initial_token, sandbox::USER_LOCKDOWN); - policy->SetDelayedIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW); + if (in_sandbox) { + // spawn the child process in the sandbox + sandbox::BrokerServices* broker_service = + g_browser_process->broker_services(); + + sandbox::ResultCode result; + PROCESS_INFORMATION target = {0}; + sandbox::TargetPolicy* policy = broker_service->CreatePolicy(); + policy->SetJobLevel(sandbox::JOB_LOCKDOWN, 0); + + sandbox::TokenLevel initial_token = sandbox::USER_UNPROTECTED; + if (win_util::GetWinVersion() > win_util::WINVERSION_XP) { + // On 2003/Vista the initial token has to be restricted if the main + // token is restricted. + initial_token = sandbox::USER_RESTRICTED_SAME_ACCESS; + } - HDESK desktop = CreateDesktop(kDesktopName, NULL, NULL, 0, - DESKTOP_CREATEWINDOW, NULL); - if (desktop) { - policy->SetDesktop(kDesktopName); - } else { - DLOG(WARNING) << "Failed to apply desktop security to the renderer"; - } + policy->SetTokenLevel(initial_token, sandbox::USER_LOCKDOWN); + policy->SetDelayedIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW); - if (!AddGenericPolicy(policy)) { - NOTREACHED(); - return false; - } + HDESK desktop = CreateDesktop(kDesktopName, NULL, NULL, 0, + DESKTOP_CREATEWINDOW, NULL); + if (desktop) { + policy->SetDesktop(kDesktopName); + } else { + DLOG(WARNING) << "Failed to apply desktop security to the renderer"; + } - if (browser_command_line.HasSwitch(switches::kGearsInRenderer)) { - if (!AddPolicyForGearsInRenderer(policy)) { - NOTREACHED(); - return false; - } - } + if (!AddGenericPolicy(policy)) { + NOTREACHED(); + return false; + } - if (!AddDllEvictionPolicy(policy)) { + if (browser_command_line.HasSwitch(switches::kGearsInRenderer)) { + if (!AddPolicyForGearsInRenderer(policy)) { NOTREACHED(); return false; } + } - result = - broker_service->SpawnTarget(renderer_path.c_str(), - cmd_line.command_line_string().c_str(), - policy, &target); - policy->Release(); - - if (desktop) - CloseDesktop(desktop); - - if (sandbox::SBOX_ALL_OK != result) - return false; + if (!AddDllEvictionPolicy(policy)) { + NOTREACHED(); + return false; + } - bool on_sandbox_desktop = (desktop != NULL); - NotificationService::current()->Notify( - NotificationType::RENDERER_PROCESS_IN_SBOX, - Source<BrowserRenderProcessHost>(this), - Details<bool>(&on_sandbox_desktop)); - - ResumeThread(target.hThread); - CloseHandle(target.hThread); - process_.set_handle(target.hProcess); - - // Help the process a little. It can't start the debugger by itself if - // the process is in a sandbox. - if (child_needs_help) - DebugUtil::SpawnDebuggerOnProcess(target.dwProcessId); - } else + result = + broker_service->SpawnTarget(renderer_path.c_str(), + cmd_line.command_line_string().c_str(), + policy, &target); + policy->Release(); + + if (desktop) + CloseDesktop(desktop); + + if (sandbox::SBOX_ALL_OK != result) + return false; + + bool on_sandbox_desktop = (desktop != NULL); + NotificationService::current()->Notify( + NotificationType::RENDERER_PROCESS_IN_SBOX, + Source<BrowserRenderProcessHost>(this), + Details<bool>(&on_sandbox_desktop)); + + ResumeThread(target.hThread); + CloseHandle(target.hThread); + process_.set_handle(target.hProcess); + + // Help the process a little. It can't start the debugger by itself if + // the process is in a sandbox. + if (child_needs_help) + DebugUtil::SpawnDebuggerOnProcess(target.dwProcessId); + } else #endif // OS_WIN and sandbox - { - // spawn child process - base::ProcessHandle process = 0; - if (!SpawnChild(cmd_line, channel_.get(), &process)) - return false; - process_.set_handle(process); - } + { + // spawn child process + base::ProcessHandle process = 0; + if (!SpawnChild(cmd_line, channel_.get(), &process)) + return false; + process_.set_handle(process); } } diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h index 62a7dc6..556bbfc 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.h +++ b/chrome/browser/renderer_host/browser_render_process_host.h @@ -23,7 +23,6 @@ class CommandLine; class GURL; -class PrefService; class RendererMainThread; class RenderWidgetHelper; class WebContents; @@ -76,8 +75,6 @@ class BrowserRenderProcessHost : public RenderProcessHost, virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); - static void RegisterPrefs(PrefService* prefs); - // If the a process has sent a message that cannot be decoded, it is deemed // corrupted and thus needs to be terminated using this call. This function // can be safely called from any thread. diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 1ea18e8..cf1a56b 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -63,11 +63,6 @@ const wchar_t kTestingChannelID[] = L"testing-channel"; // that the UI tests don't depend on what comes up for http://google.com. const wchar_t kHomePage[] = L"homepage"; -// When this switch is present, the browser will throw up a dialog box -// asking the user to start a renderer process independently rather -// than launching the renderer itself. (This is useful for debugging.) -const wchar_t kBrowserStartRenderersManually[] = L"start-renderers-manually"; - // Causes the process to run as renderer instead of as browser. const wchar_t kRendererProcess[] = L"renderer"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 7a01d2e..7083d7a 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -26,7 +26,6 @@ extern const wchar_t kPluginLauncher[]; extern const wchar_t kProcessChannelID[]; extern const wchar_t kTestingChannelID[]; extern const wchar_t kHomePage[]; -extern const wchar_t kBrowserStartRenderersManually[]; extern const wchar_t kRendererProcess[]; extern const wchar_t kRendererPath[]; extern const wchar_t kPluginProcess[]; diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index e120347..d2608c5 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -381,9 +381,6 @@ const wchar_t kUninstallLastLaunchTimeSec[] = const wchar_t kUninstallLastObservedRunTimeSec[] = L"uninstall_metrics.last_observed_running_time_sec"; -// If true, the user will be prompted to manually launch renderer processes. -const wchar_t kStartRenderersManually[] = L"renderer.start_manually"; - // A collection of position, size, and other data relating to the browser // window to restore on startup. const wchar_t kBrowserWindowPlacement[] = L"browser.window_placement"; diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 718fb9a..f3c2b15 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -130,7 +130,6 @@ extern const wchar_t kUninstallMetricsUptimeSec[]; extern const wchar_t kUninstallLastLaunchTimeSec[]; extern const wchar_t kUninstallLastObservedRunTimeSec[]; -extern const wchar_t kStartRenderersManually[]; extern const wchar_t kBrowserWindowPlacement[]; extern const wchar_t kTaskManagerWindowPlacement[]; extern const wchar_t kPageInfoWindowPlacement[]; |