mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1164338 - Move styles markers to be generated in DoProcessRestyles rather than when the Flush_Style queue is flushed. r=smaug,heycam
This commit is contained in:
parent
81516937a7
commit
dcc02005ba
@ -25,4 +25,6 @@ dictionary ProfileTimelineMarker {
|
||||
unsigned short eventPhase;
|
||||
/* For Paint markers. */
|
||||
sequence<ProfileTimelineLayerRect> rectangles;
|
||||
/* For Style markers. */
|
||||
DOMString restyleHint;
|
||||
};
|
||||
|
@ -4186,7 +4186,6 @@ RestyleManager::StructsToLog()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
/* static */ nsCString
|
||||
RestyleManager::RestyleHintToString(nsRestyleHint aHint)
|
||||
{
|
||||
@ -4219,6 +4218,7 @@ RestyleManager::RestyleHintToString(nsRestyleHint aHint)
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* static */ nsCString
|
||||
RestyleManager::ChangeHintToString(nsChangeHint aHint)
|
||||
{
|
||||
|
@ -348,8 +348,9 @@ public:
|
||||
mOverflowChangedTracker.Flush();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static nsCString RestyleHintToString(nsRestyleHint aHint);
|
||||
|
||||
#ifdef DEBUG
|
||||
static nsCString ChangeHintToString(nsChangeHint aHint);
|
||||
#endif
|
||||
|
||||
|
@ -96,6 +96,30 @@ struct RestyleCollector {
|
||||
#endif
|
||||
};
|
||||
|
||||
class RestyleTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
RestyleTimelineMarker(nsDocShell* aDocShell,
|
||||
TracingMetadata aMetaData,
|
||||
nsRestyleHint aRestyleHint)
|
||||
: TimelineMarker(aDocShell, "Styles", aMetaData)
|
||||
{
|
||||
if (aRestyleHint) {
|
||||
mRestyleHint.AssignWithConversion(RestyleManager::RestyleHintToString(aRestyleHint));
|
||||
}
|
||||
}
|
||||
|
||||
virtual void AddDetails(mozilla::dom::ProfileTimelineMarker& aMarker) override
|
||||
{
|
||||
if (GetMetaData() == TRACING_INTERVAL_START) {
|
||||
aMarker.mRestyleHint.Construct(mRestyleHint);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
nsAutoString mRestyleHint;
|
||||
};
|
||||
|
||||
static PLDHashOperator
|
||||
CollectRestyles(nsISupports* aElement,
|
||||
nsAutoPtr<RestyleTracker::RestyleData>& aData,
|
||||
@ -202,6 +226,13 @@ RestyleTracker::DoProcessRestyles()
|
||||
PROFILER_LABEL("RestyleTracker", "ProcessRestyles",
|
||||
js::ProfileEntry::Category::CSS);
|
||||
|
||||
bool isTimelineRecording = false;
|
||||
nsDocShell* docShell =
|
||||
static_cast<nsDocShell*>(mRestyleManager->PresContext()->GetDocShell());
|
||||
if (docShell) {
|
||||
docShell->GetRecordProfileTimelineMarkers(&isTimelineRecording);
|
||||
}
|
||||
|
||||
// Create a ReframingStyleContexts struct on the stack and put it in our
|
||||
// mReframingStyleContexts for almost all of the remaining scope of
|
||||
// this function.
|
||||
@ -311,6 +342,14 @@ RestyleTracker::DoProcessRestyles()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isTimelineRecording) {
|
||||
mozilla::UniquePtr<TimelineMarker> marker =
|
||||
MakeUnique<RestyleTimelineMarker>(docShell,
|
||||
TRACING_INTERVAL_START,
|
||||
data->mRestyleHint);
|
||||
docShell->AddProfileTimelineMarker(Move(marker));
|
||||
}
|
||||
|
||||
#if defined(MOZ_ENABLE_PROFILER_SPS) && !defined(MOZILLA_XPCOMRT_API)
|
||||
Maybe<GeckoProfilerTracingRAII> profilerRAII;
|
||||
if (profiler_feature_active("restyle")) {
|
||||
@ -319,6 +358,14 @@ RestyleTracker::DoProcessRestyles()
|
||||
#endif
|
||||
ProcessOneRestyle(element, data->mRestyleHint, data->mChangeHint);
|
||||
AddRestyleRootsIfAwaitingRestyle(data->mDescendants);
|
||||
|
||||
if (isTimelineRecording) {
|
||||
mozilla::UniquePtr<TimelineMarker> marker =
|
||||
MakeUnique<RestyleTimelineMarker>(docShell,
|
||||
TRACING_INTERVAL_END,
|
||||
data->mRestyleHint);
|
||||
docShell->AddProfileTimelineMarker(Move(marker));
|
||||
}
|
||||
}
|
||||
|
||||
if (mHaveLaterSiblingRestyles) {
|
||||
@ -359,9 +406,25 @@ RestyleTracker::DoProcessRestyles()
|
||||
profilerRAII.emplace("Paint", "Styles", Move(currentRestyle->mBacktrace));
|
||||
}
|
||||
#endif
|
||||
if (isTimelineRecording) {
|
||||
mozilla::UniquePtr<TimelineMarker> marker =
|
||||
MakeUnique<RestyleTimelineMarker>(docShell,
|
||||
TRACING_INTERVAL_START,
|
||||
currentRestyle->mRestyleHint);
|
||||
docShell->AddProfileTimelineMarker(Move(marker));
|
||||
}
|
||||
|
||||
ProcessOneRestyle(currentRestyle->mElement,
|
||||
currentRestyle->mRestyleHint,
|
||||
currentRestyle->mChangeHint);
|
||||
|
||||
if (isTimelineRecording) {
|
||||
mozilla::UniquePtr<TimelineMarker> marker =
|
||||
MakeUnique<RestyleTimelineMarker>(docShell,
|
||||
TRACING_INTERVAL_END,
|
||||
currentRestyle->mRestyleHint);
|
||||
docShell->AddProfileTimelineMarker(Move(marker));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1656,11 +1656,6 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
|
||||
if (!mStyleFlushObservers.Contains(shell))
|
||||
continue;
|
||||
|
||||
nsRefPtr<nsDocShell> docShell = GetDocShell(shell->GetPresContext());
|
||||
if (docShell) {
|
||||
docShell->AddProfileTimelineMarker("Styles", TRACING_INTERVAL_START);
|
||||
}
|
||||
|
||||
if (!tracingStyleFlush) {
|
||||
tracingStyleFlush = true;
|
||||
profiler_tracing("Paint", "Styles", mStyleCause, TRACING_INTERVAL_START);
|
||||
@ -1679,10 +1674,6 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
|
||||
presContext->NotifyFontFaceSetOnRefresh();
|
||||
}
|
||||
NS_RELEASE(shell);
|
||||
|
||||
if (docShell) {
|
||||
docShell->AddProfileTimelineMarker("Styles", TRACING_INTERVAL_END);
|
||||
}
|
||||
}
|
||||
|
||||
if (tracingStyleFlush) {
|
||||
|
Loading…
Reference in New Issue
Block a user