Here we add a new UserFontLoadState value, STATUS_LOAD_PENDING, which
represents the state just after a gfxUserFontEntry's url()-valued source
would being loading, except that we can't start the load due to being
on a Servo style worker thread. In that case, we defer the work of
initiating the load until just after the Servo traversal is finished.
URLs that can normally be loaded synchronously, such as data: URLs
and script-implemented protocols marked as synchronous, must be
handled asynchronously when encountered during Servo traversal, since
various main-thread only work (in FontFaceSet::SyncLoadFontData) must
happen. This is a user visible change from stock Gecko, but should
only happen when font metrics for a data: URL font are requested
due to ch/ex unit resolution when layout hasn't previously requested
the font load. Hopefully nobody relies on synchronous resolution of
ch/ex units with data: URLs.
We unfortunately also can't pick gfxUserFontEntry objects out of the
UserFontCache during Servo traversal, since validating the cache
entry involves doing content policy checking, which is not thread-safe
(due in part to taking strong references to nsIPrincipals).
Platform fonts and ArrayBuffer-backed DOM FontFace objects continue
to be handled synchronously.
The PostTraversalTask does not take a strong reference to the
gfxUserFontEntry object, since it is held on to by the DOM FontFace
object, which itself won't go away before the PostTraversalTask
is run.
MozReview-Commit-ID: J9ODLsusrNV
--HG--
extra : rebase_source : d3e3d1dc187cb252750b57bcecd0b1ed77a15a7c
The PostTraversalTask does not take a strong reference to the FontFaceSet
object, since as a DOM object, we can't call AddRef/Release on it
from the Servo style worker threads. The FontFaceSet is held on to
by the nsIDocument, and only cleared during cycle collection, which
should not occur between the font metrics request and the
PostTraversalTask running.
MozReview-Commit-ID: 5aKIg4DIQ4w
--HG--
extra : rebase_source : a7b63582b3610491fbcb4e2b931d55681e626513
The PostTraversalTask does not take a strong reference to the FontFace
object, since as a DOM object, we can't call AddRef/Release on it
from the Servo style worker threads. The FontFace objects that we
encounter are all held on to by the FontFaceSet, and none of the
work that we do during font loads should drop FontFace objects
from the FontFaceSet. (That only happens under
nsIDocument::FlushUserFontSet, which is only called on the
main thread.)
MozReview-Commit-ID: 5CdtGQYC9aL
--HG--
extra : rebase_source : 8ce5ff0c4ca306ccc240a86e7cacb588cc6c94c7
Here we add a new UserFontLoadState value, STATUS_LOAD_PENDING, which
represents the state just after a gfxUserFontEntry's url()-valued source
would being loading, except that we can't start the load due to being
on a Servo style worker thread. In that case, we defer the work of
initiating the load until just after the Servo traversal is finished.
URLs that can normally be loaded synchronously, such as data: URLs
and script-implemented protocols marked as synchronous, must be
handled asynchronously when encountered during Servo traversal, since
various main-thread only work (in FontFaceSet::SyncLoadFontData) must
happen. This is a user visible change from stock Gecko, but should
only happen when font metrics for a data: URL font are requested
due to ch/ex unit resolution when layout hasn't previously requested
the font load. Hopefully nobody relies on synchronous resolution of
ch/ex units with data: URLs.
We unfortunately also can't pick gfxUserFontEntry objects out of the
UserFontCache during Servo traversal, since validating the cache
entry involves doing content policy checking, which is not thread-safe
(due in part to taking strong references to nsIPrincipals).
Platform fonts and ArrayBuffer-backed DOM FontFace objects continue
to be handled synchronously.
The PostTraversalTask does not take a strong reference to the
gfxUserFontEntry object, since it is held on to by the DOM FontFace
object, which itself won't go away before the PostTraversalTask
is run.
MozReview-Commit-ID: J9ODLsusrNV
--HG--
extra : rebase_source : 1651e2917bd31b87fc1c1be94b0eced1273df86a
The PostTraversalTask does not take a strong reference to the FontFaceSet
object, since as a DOM object, we can't call AddRef/Release on it
from the Servo style worker threads. The FontFaceSet is held on to
by the nsIDocument, and only cleared during cycle collection, which
should not occur between the font metrics request and the
PostTraversalTask running.
MozReview-Commit-ID: 5aKIg4DIQ4w
--HG--
extra : rebase_source : 50ca5f2d8af42cfbeb6808aa755a4670bdf293bd
The PostTraversalTask does not take a strong reference to the FontFace
object, since as a DOM object, we can't call AddRef/Release on it
from the Servo style worker threads. The FontFace objects that we
encounter are all held on to by the FontFaceSet, and none of the
work that we do during font loads should drop FontFace objects
from the FontFaceSet. (That only happens under
nsIDocument::FlushUserFontSet, which is only called on the
main thread.)
MozReview-Commit-ID: 5CdtGQYC9aL
--HG--
extra : rebase_source : 8e4f21a12ae5ca81017293d5b06f1551e307ea5d