зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1723181 - Add an 'Image Animation' profiler marker, and rename the tick reason 'HasImageRequests' into 'HasImageAnimations' for clarity, r=mstange.
Differential Revision: https://phabricator.services.mozilla.com/D121397
This commit is contained in:
Родитель
4251a05437
Коммит
d589982ead
|
@ -1106,6 +1106,10 @@ RefreshDriverTimer* nsRefreshDriver::ChooseTimer() {
|
|||
return sRegularRateTimer;
|
||||
}
|
||||
|
||||
static nsDocShell* GetDocShell(nsPresContext* aPresContext) {
|
||||
return static_cast<nsDocShell*>(aPresContext->GetDocShell());
|
||||
}
|
||||
|
||||
nsRefreshDriver::nsRefreshDriver(nsPresContext* aPresContext)
|
||||
: mActiveTimer(nullptr),
|
||||
mOwnTimer(nullptr),
|
||||
|
@ -1333,20 +1337,45 @@ bool nsRefreshDriver::AddImageRequest(imgIRequest* aRequest) {
|
|||
|
||||
EnsureTimerStarted();
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aRequest->GetURI(getter_AddRefs(uri));
|
||||
nsAutoCString uristr;
|
||||
uri->GetAsciiSpec(uristr);
|
||||
|
||||
PROFILER_MARKER_TEXT("Image Animation", GRAPHICS,
|
||||
MarkerOptions(MarkerTiming::IntervalStart(),
|
||||
MarkerInnerWindowIdFromDocShell(
|
||||
GetDocShell(mPresContext))),
|
||||
uristr);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void nsRefreshDriver::RemoveImageRequest(imgIRequest* aRequest) {
|
||||
// Try to remove from both places, just in case, because we can't tell
|
||||
// whether RemoveEntry() succeeds.
|
||||
mRequests.Remove(aRequest);
|
||||
// Try to remove from both places, just in case.
|
||||
bool removed = mRequests.EnsureRemoved(aRequest);
|
||||
uint32_t delay = GetFirstFrameDelay(aRequest);
|
||||
if (delay != 0) {
|
||||
ImageStartData* start = mStartTable.Get(delay);
|
||||
if (start) {
|
||||
start->mEntries.Remove(aRequest);
|
||||
removed = removed | start->mEntries.EnsureRemoved(aRequest);
|
||||
}
|
||||
}
|
||||
|
||||
if (removed && profiler_can_accept_markers()) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aRequest->GetURI(getter_AddRefs(uri));
|
||||
nsAutoCString uristr;
|
||||
uri->GetAsciiSpec(uristr);
|
||||
|
||||
PROFILER_MARKER_TEXT("Image Animation", GRAPHICS,
|
||||
MarkerOptions(MarkerTiming::IntervalEnd(),
|
||||
MarkerInnerWindowIdFromDocShell(
|
||||
GetDocShell(mPresContext))),
|
||||
uristr);
|
||||
}
|
||||
}
|
||||
|
||||
void nsRefreshDriver::NotifyDOMContentLoaded() {
|
||||
|
@ -1699,7 +1728,7 @@ void nsRefreshDriver::AppendTickReasonsToString(TickReasons aReasons,
|
|||
aStr.AppendLiteral(")");
|
||||
}
|
||||
if (aReasons & TickReasons::eHasImageRequests) {
|
||||
aStr.AppendLiteral(" HasImageRequests");
|
||||
aStr.AppendLiteral(" HasImageAnimations");
|
||||
}
|
||||
if (aReasons & TickReasons::eNeedsToUpdateIntersectionObservations) {
|
||||
aStr.AppendLiteral(" NeedsToUpdateIntersectionObservations");
|
||||
|
@ -1813,10 +1842,6 @@ struct DocumentFrameCallbacks {
|
|||
nsTArray<Document::FrameRequest> mCallbacks;
|
||||
};
|
||||
|
||||
static nsDocShell* GetDocShell(nsPresContext* aPresContext) {
|
||||
return static_cast<nsDocShell*>(aPresContext->GetDocShell());
|
||||
}
|
||||
|
||||
static bool HasPendingAnimations(PresShell* aPresShell) {
|
||||
Document* doc = aPresShell->GetDocument();
|
||||
if (!doc) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче