diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-02 18:11:09 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-02 18:11:09 +0000 |
commit | bfe4c158cd0372fa7a602997f65b42a92645aaf3 (patch) | |
tree | dbda26fa776eb9c3b5fcca2e1b1fa956db1985e8 /chrome/browser/browser_shutdown.cc | |
parent | 5fa6d7fa100a6836cc7b791a094468f8c384807b (diff) | |
download | chromium_src-bfe4c158cd0372fa7a602997f65b42a92645aaf3.zip chromium_src-bfe4c158cd0372fa7a602997f65b42a92645aaf3.tar.gz chromium_src-bfe4c158cd0372fa7a602997f65b42a92645aaf3.tar.bz2 |
Any time we are shutting down a tab, try to use fast shutdown.
BUG=http://crbug.com/5638
TEST=existing tab strip model tests, Fast shutdown ui tests, new tab strip model fast shutdown test
Review URL: http://codereview.chromium.org/235050
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27865 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_shutdown.cc')
-rw-r--r-- | chrome/browser/browser_shutdown.cc | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index 3e8622a..22f4507 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -52,34 +52,34 @@ void RegisterPrefs(PrefService* local_state) { local_state->RegisterIntegerPref(prefs::kShutdownNumProcessesSlow, 0); } +ShutdownType GetShutdownType() { + return shutdown_type_; +} + void OnShutdownStarting(ShutdownType type) { - // TODO(erikkay): http://b/753080 when onbeforeunload is supported at - // shutdown, fix this to allow these variables to be reset. - if (shutdown_type_ == NOT_VALID) { - shutdown_type_ = type; - // For now, we're only counting the number of renderer processes - // since we can't safely count the number of plugin processes from this - // thread, and we'd really like to avoid anything which might add further - // delays to shutdown time. - shutdown_started_ = Time::Now(); - - // Call FastShutdown on all of the RenderProcessHosts. This will be - // a no-op in some cases, so we still need to go through the normal - // shutdown path for the ones that didn't exit here. - shutdown_num_processes_ = 0; - shutdown_num_processes_slow_ = 0; - RenderProcessHost::iterator hosts(RenderProcessHost::AllHostsIterator()); - while (!hosts.IsAtEnd()) { - shutdown_num_processes_++; - if (!hosts.GetCurrentValue()->FastShutdownIfPossible()) { - // TODO(ojan): I think now that we deal with beforeunload/unload - // higher up, it's not possible to get here. Confirm this and change - // FastShutdownIfPossible to just be FastShutdown. - shutdown_num_processes_slow_++; - } - - hosts.Advance(); + if (shutdown_type_ != NOT_VALID) + return; + + shutdown_type_ = type; + // For now, we're only counting the number of renderer processes + // since we can't safely count the number of plugin processes from this + // thread, and we'd really like to avoid anything which might add further + // delays to shutdown time. + shutdown_started_ = Time::Now(); + + // Call FastShutdown on all of the RenderProcessHosts. This will be + // a no-op in some cases, so we still need to go through the normal + // shutdown path for the ones that didn't exit here. + shutdown_num_processes_ = 0; + shutdown_num_processes_slow_ = 0; + RenderProcessHost::iterator hosts(RenderProcessHost::AllHostsIterator()); + while (!hosts.IsAtEnd()) { + shutdown_num_processes_++; + if (!hosts.GetCurrentValue()->FastShutdownIfPossible()) { + shutdown_num_processes_slow_++; } + + hosts.Advance(); } } |