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/common/histogram_synchronizer.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/common/histogram_synchronizer.cc')
-rw-r--r-- | chrome/common/histogram_synchronizer.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/chrome/common/histogram_synchronizer.cc b/chrome/common/histogram_synchronizer.cc index 9ed94b0..ab46d47 100644 --- a/chrome/common/histogram_synchronizer.cc +++ b/chrome/common/histogram_synchronizer.cc @@ -56,9 +56,10 @@ void HistogramSynchronizer::FetchRendererHistogramsSynchronously( int sequence_number = GetNextAvaibleSequenceNumber( SYNCHRONOUS_HISTOGRAMS, RenderProcessHost::size()); - for (RenderProcessHost::iterator it = RenderProcessHost::begin(); - it != RenderProcessHost::end(); ++it) { - it->second->Send(new ViewMsg_GetRendererHistograms(sequence_number)); + for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); + !it.IsAtEnd(); it.Advance()) { + it.GetCurrentValue()->Send( + new ViewMsg_GetRendererHistograms(sequence_number)); } TimeTicks start = TimeTicks::Now(); @@ -111,9 +112,10 @@ void HistogramSynchronizer::FetchRendererHistogramsAsynchronously( int sequence_number = current_synchronizer->GetNextAvaibleSequenceNumber( ASYNC_HISTOGRAMS, RenderProcessHost::size()); - for (RenderProcessHost::iterator it = RenderProcessHost::begin(); - it != RenderProcessHost::end(); ++it) { - it->second->Send(new ViewMsg_GetRendererHistograms(sequence_number)); + for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); + !it.IsAtEnd(); it.Advance()) { + it.GetCurrentValue()->Send( + new ViewMsg_GetRendererHistograms(sequence_number)); } // Post a task that would be called after waiting for wait_time. |