diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-17 20:13:53 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-17 20:13:53 +0000 |
commit | 9de09f8474427fe1341201b946d9afe20ab01b07 (patch) | |
tree | f0ac3acf7bdba7a3259124908d627489a99f44da /chrome/browser/browser_shutdown.cc | |
parent | 6b2aedb4e7f4a62a74df55b8126a2f4ed6793760 (diff) | |
download | chromium_src-9de09f8474427fe1341201b946d9afe20ab01b07.zip chromium_src-9de09f8474427fe1341201b946d9afe20ab01b07.tar.gz chromium_src-9de09f8474427fe1341201b946d9afe20ab01b07.tar.bz2 |
Refactor IDMap to support safe removing of elements during iteration.
TEST=Covered by unit_tests and other automated tests.
http://crbug.com/19202
Review URL: http://codereview.chromium.org/164518
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_shutdown.cc')
-rw-r--r-- | chrome/browser/browser_shutdown.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index b67542d..c762cc2 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -66,18 +66,19 @@ void OnShutdownStarting(ShutdownType type) { // shutdown path for the ones that didn't exit here. shutdown_num_processes_slow_ = 0; size_t start_rph_size = RenderProcessHost::size(); - for (RenderProcessHost::iterator hosts = RenderProcessHost::begin(); - hosts != RenderProcessHost::end(); - ++hosts) { - RenderProcessHost* rph = hosts->second; - if (!rph->FastShutdownIfPossible()) + RenderProcessHost::iterator hosts(RenderProcessHost::AllHostsIterator()); + while (!hosts.IsAtEnd()) { + 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_++; + } // The number of RPHs should not have changed as the result of invoking // FastShutdownIfPossible. CHECK(start_rph_size == RenderProcessHost::size()); + + hosts.Advance(); } } } |