Closed Bug 1663418 Opened 11 months ago Closed 11 months ago

Get rid of the O(n^2) loop in ChromeUtils::RequestProcessInfo

Categories

(Core :: DOM: Content Processes, defect)

defect

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: Yoric, Assigned: Yoric)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

No description provided.
Assignee: nobody → dteller

Prior to this patch, RequestProcInfo attempts to examine all processes from mozilla::ipc::GeckoChildProcessHost::GetAll callbacks.

This causes two issues:

  • lifetime management for raw ContentProcess* used during the callbacks works but is complicated to audit;
  • for each GeckoChildProcessHost identified as a ContentProcess, we need to perform a linear lookup within content processes during each callback, which makes the code O(n^2) where n is the number of content processes.

This patch rewrites this section of RequestProcInfo by splitting it as follows:

  1. We use the same GeckoChildProcessHost::GetAll callback to examine non-ContentProcess, without any lookup.
  2. We use the list of ContentProcess to examine ContentProcesses, without any lookup.

New code is a bit longer (138 loc vs. 115) but not as deeply nested, which should be an acceptable tradeoff.

Pushed by dteller@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b0e9cfc9e157
Faster path for ContentProcess in RequestProcInfo;r=froydnj
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
You need to log in before you can comment on or make changes to this bug.