mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 21:00:50 +00:00

This changes the way we deal with page use counters so that we can handle out of process iframes. Currently, when a parent document is being destroyed, we poke into all of the sub-documents to merge their use counters into the parent's page use counters, which we then report via Telemetry. With Fission enabled, the sub-documents may be out of process. We can't simply turn these into async IPC calls, since the parent document will be destroyed shortly, as might the content processes holding the sub-documents. So instead, each document during its initialization identifies which ancestor document it will contribute its page use counters to, and stores its WindowContext id to identify that ancestor. A message is sent to the parent process to notify it that page use counter data will be sent at some later point. That later point is when the document loses its window. It doesn't matter if the ancestor document has already been destroyed at this point, since all we need is its WindowContext id to uniquely identify it. Once the parent process has received all of the use counters it expects to accumulate to a given WindowContext Id, it reports them via Telemetry. Reporting of document use counters remains unchanged and is done by each document in their content process. While we're here, we also: * Limit use counters to be reported for a pre-defined set of document URL schemes, rather than be based on the document principal. * Add proper MOZ_LOG logging for use counters instead of printfs. Differential Revision: https://phabricator.services.mozilla.com/D87188