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
As with a few other gfx* font-related classes, during font metrics
calculations we end up taking strong references to gfxUserFontSet,
and it would be difficult to restructure the code to not do this.
MozReview-Commit-ID: L1GbZnf4825
--HG--
extra : rebase_source : 3bc2deb24e282f4a76f0a270d28771016052f9ec
We need to grab UnscaledFont objects through WeakPtrs during metrics
calculations, but this only happens on Servo style worker threads
while the Servo font metrics mutex is locked (and while the main
thread is paused). So we use WeakPtrTraits to override the
thread safety assertion to allow OMT access through the WeakPtr
if the mutex is locked.
Since we can end up creating UnscaledFont objects from the style
worker threads too, we additionally need to allow the main thread
to access them through WeakPtrs.
It would be nice to avoid the dependency on layout/style/ here, but
I can't see a way to do that without putting the burden of the
annotation that the more permissive thread safety checks are allowed
on the WeakPtr<> declarations themselves.
MozReview-Commit-ID: AbHNZEhE7L8
--HG--
extra : rebase_source : 48fba82778c1015a764a3cd921475966b67bf70a
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
As with a few other gfx* font-related classes, during font metrics
calculations we end up taking strong references to gfxUserFontSet,
and it would be difficult to restructure the code to not do this.
MozReview-Commit-ID: L1GbZnf4825
--HG--
extra : rebase_source : bfd83b02cceec747dc4f4f021eff205e7aaa2b69
We need to grab UnscaledFont objects through WeakPtrs during metrics
calculations, but this only happens on Servo style worker threads
while the Servo font metrics mutex is locked (and while the main
thread is paused). So we use WeakPtrTraits to override the
thread safety assertion to allow OMT access through the WeakPtr
if the mutex is locked.
Since we can end up creating UnscaledFont objects from the style
worker threads too, we additionally need to allow the main thread
to access them through WeakPtrs.
It would be nice to avoid the dependency on layout/style/ here, but
I can't see a way to do that without putting the burden of the
annotation that the more permissive thread safety checks are allowed
on the WeakPtr<> declarations themselves.
MozReview-Commit-ID: AbHNZEhE7L8
--HG--
extra : rebase_source : 95e669d64a0881ef1c9747c2e7de7f361865af11
By passing the startTime as a TimeDuration we are able to represent times in the
distant past (and with the same range as we can represent on the main thread so
that if we do encounter range errors in future, they should not differ between
the main thread and the compositor).
This patch includes a crashtest. I have verified that, without the code changes
included in this patch, this crashtest fails on debug builds on OSX.
MozReview-Commit-ID: EDuKLzfEC0K
--HG--
extra : rebase_source : 1883080fdfac8c33f70698145f21e67cbdfdd4f2
In bug 1223658 we separated out the delay from the start time but we failed to
remove it from this calculation. As a result, when a pending animation begins it
will have the delay applied twice (once here, and once when it is sampled on the
compositor). This will happen until the layer is next updated.
This bug was not exposed by any existing tests since we don't use this code path
when the refresh driver is under test control. Furthermore, the one test that
was supposed to cover this was refactored in such a way that it stopped testing
this code path. That test is restored earlier in this patch series and enabled
in this patch.
MozReview-Commit-ID: B2KR7YaPsMK
--HG--
extra : rebase_source : 6c888252813fbfc01baf5d4bb1728d989ee1586c
PLayerTransaction's constructor was previously synchronous so we could
return a TextureFactoryIdentifier. This is quite reliably available
already in the case of opening a tab, due to RenderFrameParent knowing
which compositor it is attached to, so we can make the constructor
asynchronous.
In the top-level widget case, we add a new synchronous message to find
the TextureFactoryIdentifier.
Because ProfilerMarkerPayload is the main type defined in these files, and
because the next patch is going to introduce ProfilerMarker.{h,cpp}, which
would be confusingly similar to the old names.
--HG--
rename : tools/profiler/core/ProfilerMarkers.cpp => tools/profiler/core/ProfilerMarkerPayload.cpp
rename : tools/profiler/public/ProfilerMarkers.h => tools/profiler/public/ProfilerMarkerPayload.h
extra : rebase_source : df22a2ab3867650348ae78fe959ff0366aff230b
The MultiTouchInput::MULTITOUCH_END generated from transitioning from
multiple touch sources to a single source would often cause the content
to shift under the remaining finger which would look like a fling and
cause the content to rapidly scroll. This patch treats the transition from
multiple touch source to a single source as if the touch event were
starting over by resetting all the variables tracking the touch drag
that is in progress.
MozReview-Commit-ID: 42L1Q622fww
Since tabs are loaded and shutdown asynchronously with respect to the UI
process, it is possible for a tab to be loading as its parent widget and
compositor are shutting down. We protect PAPZCTreeManager's constructor
against this by making a temporary APZCTM object.
--HG--
extra : rebase_source : 64be2e2dafc578effe2e0fc89c0c325e24419e0d