Closed Bug 1540776 Opened 5 years ago Closed 4 years ago

Move GetICMProfileW calls from content to parent

Categories

(Core :: Graphics, enhancement, P1)

Unspecified
Windows
enhancement

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox68 --- wontfix
firefox75 --- wontfix
firefox76 --- wontfix
firefox77 --- fixed

People

(Reporter: jimm, Assigned: cmartin)

References

Details

Attachments

(2 files, 7 obsolete files)

This api use needs to move to parent.

Summary: Move calls to GetICMProfileW from content → Move GetICMProfileW calls from content to parent
Attached patch wip - reorg cms profile routines (obsolete) — Splinter Review
Attached patch wip - reorg cms profile routines (obsolete) — Splinter Review
Attachment #9054920 - Attachment is obsolete: true
Attachment #9054931 - Attachment is obsolete: true

I will try to get to this tomorrow.

Currently, the GetCMSOutputProfile() and related methods pass their output
using the old C-style "ptr, len" parameters. This makes them more difficult
to deal with later in this change when they need to be safely passed over IPC.

This refactors them to return nsTArray<uint8_t> results instead. I also
removed some old cruft, refactored the code, and fixed a bug that has gone
unnoticed for a long time.

This change is needed for Win32k lowndown. I have the refactoring change above, and I will add the color profile code shortly.

Assignee: jmathies → cmartin
Pushed by cmartin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/504aca5e5357
Change CMSOutputProfile functions to return nsArray r=gcp
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75

Oops - Forgot to set as leave-open. There's a few more changes on their way for this.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---

In the content process, Windows won't perform any of the common logic for
CMS profile loading anymore. That means that it is no longer "common logic",
and that profile loading is now always platform-specific.

This change refactors out the "common logic" into a callable function that
the platform-specific functions can call if they want to. Soon, the Windows
logic won't call it in the content process.

Once Win32k lockdown is enabled, we can't call GetICMProfileW() in the child,
nor can we access whatever arbitrary file
"gfx.color_management.display_profile" points to.

As a result, we must collect the data from these files in the parent process
and pass it to child.

Depends on D64674

Attachment #9129631 - Attachment is obsolete: true
Attachment #9129630 - Attachment is obsolete: true
Attachment #9128002 - Attachment is obsolete: true
Attachment #9128002 - Attachment is obsolete: false
Attachment #9055217 - Attachment is obsolete: true
Attachment #9055216 - Attachment is obsolete: true
Attachment #9055215 - Attachment is obsolete: true

For Win32k lockdown, we need to remove the content processes' ability to
call GetICMProfileW(). Since it needs this to retrieve the output color
profile, a new synchronous call is added that allows it to request the
parent process to read this file on its behalf.

The contents of the file are now being cached as well, as this should help
ease some of the increased parent process I/O caused by the children not
being able to do this in their process anymore.

Attachment #9055215 - Attachment is obsolete: false
Attachment #9055215 - Attachment is obsolete: true
Attachment #9055216 - Attachment is obsolete: false
Attachment #9055216 - Attachment is obsolete: true
Pushed by cmartin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/18c3c5e79f1c
Add sync IPC message for content to request color profile r=aosmond,jld

Does every child do this (e.g. as part of its gfxPlatform initialization), or is it done only on-demand (and if so, how common is that)? I'm wondering because of the risk that the request to the parent could block for a considerable length of time if the parent process is busy.

(In reply to Jonathan Kew (:jfkthame) from comment #16)

Does every child do this (e.g. as part of its gfxPlatform initialization), or is it done only on-demand (and if so, how common is that)? I'm wondering because of the risk that the request to the parent could block for a considerable length of time if the parent process is busy.

You're right that this is done by every child process as part of gfxPlatform initialization, and whenever a pref update forces a reload of the color profile. In normal circumstances, that's once per child process. The main motivation for this message existing is the possibility of a pref change forcing a reload.

I'm concerned, then, that we might run into the same issue as we had with the system font list on Android, and recently fixed in bug 1620111. Basically, we were using a sync IPC message to get the list of the fonts from the parent process, but this could cause child startup to block for hundreds of milliseconds if the parent was busy at that time. So we just removed that sync message and instead of "pulling" the data by sending a message back to the parent during child startup -- which the parent might not respond to for some time -- we instead "push" the data as part of the XPCOMProcessAttributes message when launching the child.

Having just eliminated that blocking message from child-process startup, it seems unfortunate to introduce a new one which may suffer from the same issue and reintroduce similar child-startup delay. Could we instead attach the color profile data to the process-attributes message, and avoid the extra sync-ipc round-trip?

Attachment #9132088 - Attachment description: Bug 1540776 - Add sync IPC message for content to request color profile → Bug 1540776 - Have parent send color profile to child during launch

Updated review to address the issue brought up by :jfkthame, and also fix this XPCShell timeout failure

Flags: needinfo?(cmartin)
Pushed by cmartin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8b091426bc10
Have parent send color profile to child during launch r=aosmond,jld,jfkthame

Investigating - Will likely need a slight refactor.

Flags: needinfo?(cmartin)
Pushed by cmartin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9087564e9fea
Have parent send color profile to child during launch r=aosmond,jld,jfkthame,florian
Status: REOPENED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → FIXED
Target Milestone: mozilla75 → mozilla77

Since the status are different for nightly and release, what's the status for beta?
For more information, please visit auto_nag documentation.

See Also: → 1467758
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: