Commit ffcd348d authored by erikchen's avatar erikchen Committed by Commit Bot

Fix infinite loop in ProcessMemoryMetricsEmitter::CollateResults.

Bug: 842790
Change-Id: Ibb0ad4d30ba9c52f8e0b1627fd314fe738a413cd
Reviewed-on: https://chromium-review.googlesource.com/1058010Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarLeonard Grey <lgrey@chromium.org>
Commit-Queue: Ilya Sherman <isherman@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558463}
parent ba2f0e59
......@@ -377,18 +377,19 @@ int ProcessMemoryMetricsEmitter::GetNumberOfExtensions(base::ProcessId pid) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
// Retrieve the renderer process host for the given pid.
int rph_id = -1;
auto iter = content::RenderProcessHost::AllHostsIterator();
while (!iter.IsAtEnd()) {
bool found = false;
for (auto iter = content::RenderProcessHost::AllHostsIterator();
!iter.IsAtEnd(); iter.Advance()) {
if (!iter.GetCurrentValue()->GetProcess().IsValid())
continue;
if (iter.GetCurrentValue()->GetProcess().Pid() == pid) {
found = true;
rph_id = iter.GetCurrentValue()->GetID();
break;
}
iter.Advance();
}
if (iter.IsAtEnd())
if (!found)
return 0;
// Count the number of extensions associated with that renderer process host
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment