Bug 1267530 part 1 - Add some profiler marker for fullscreen transition. r=smaug,BenWa

MozReview-Commit-ID: CeFdBO9uz8C

--HG--
extra : source : ca6459b594f0dcfd46066bbab29ce068d4de6200
This commit is contained in:
Xidorn Quan 2016-05-03 17:58:57 +10:00
Родитель f43145b4f3
Коммит 5003029401
2 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -3157,6 +3157,7 @@ LinkedList<OldWindowSize> OldWindowSize::sList;
NS_IMETHODIMP NS_IMETHODIMP
nsDOMWindowUtils::HandleFullscreenRequests(bool* aRetVal) nsDOMWindowUtils::HandleFullscreenRequests(bool* aRetVal)
{ {
PROFILER_MARKER("Enter fullscreen");
nsCOMPtr<nsIDocument> doc = GetDocument(); nsCOMPtr<nsIDocument> doc = GetDocument();
NS_ENSURE_STATE(doc); NS_ENSURE_STATE(doc);
@ -3179,6 +3180,7 @@ nsDOMWindowUtils::HandleFullscreenRequests(bool* aRetVal)
nsresult nsresult
nsDOMWindowUtils::ExitFullscreen() nsDOMWindowUtils::ExitFullscreen()
{ {
PROFILER_MARKER("Exit fullscreen");
nsCOMPtr<nsIDocument> doc = GetDocument(); nsCOMPtr<nsIDocument> doc = GetDocument();
NS_ENSURE_STATE(doc); NS_ENSURE_STATE(doc);

Просмотреть файл

@ -6181,7 +6181,9 @@ private:
// AfterToggle stage happens after we toggle the fullscreen state. // AfterToggle stage happens after we toggle the fullscreen state.
// In this stage, the task triggers the post-toggle fullscreen // In this stage, the task triggers the post-toggle fullscreen
// transition on the widget. // transition on the widget.
eAfterToggle eAfterToggle,
// End stage is triggered after the final transition finishes.
eEnd
}; };
class Observer final : public nsIObserver class Observer final : public nsIObserver
@ -6227,10 +6229,12 @@ FullscreenTransitionTask::Run()
return NS_OK; return NS_OK;
} }
if (stage == eBeforeToggle) { if (stage == eBeforeToggle) {
PROFILER_MARKER("Fullscreen transition start");
mWidget->PerformFullscreenTransition(nsIWidget::eBeforeFullscreenToggle, mWidget->PerformFullscreenTransition(nsIWidget::eBeforeFullscreenToggle,
mDuration.mFadeIn, mTransitionData, mDuration.mFadeIn, mTransitionData,
this); this);
} else if (stage == eToggleFullscreen) { } else if (stage == eToggleFullscreen) {
PROFILER_MARKER("Fullscreen toggle start");
if (MOZ_UNLIKELY(mWindow->mFullScreen != mFullscreen)) { if (MOZ_UNLIKELY(mWindow->mFullScreen != mFullscreen)) {
// This could happen in theory if several fullscreen requests in // This could happen in theory if several fullscreen requests in
// different direction happen continuously in a short time. We // different direction happen continuously in a short time. We
@ -6270,6 +6274,8 @@ FullscreenTransitionTask::Run()
mWidget->PerformFullscreenTransition(nsIWidget::eAfterFullscreenToggle, mWidget->PerformFullscreenTransition(nsIWidget::eAfterFullscreenToggle,
mDuration.mFadeOut, mTransitionData, mDuration.mFadeOut, mTransitionData,
this); this);
} else if (stage == eEnd) {
PROFILER_MARKER("Fullscreen transition end");
} }
return NS_OK; return NS_OK;
} }
@ -6290,6 +6296,7 @@ FullscreenTransitionTask::Observer::Observe(nsISupports* aSubject,
// The paint notification arrives first. Cancel the timer. // The paint notification arrives first. Cancel the timer.
mTask->mTimer->Cancel(); mTask->mTimer->Cancel();
shouldContinue = true; shouldContinue = true;
PROFILER_MARKER("Fullscreen toggle end");
} }
} else { } else {
#ifdef DEBUG #ifdef DEBUG
@ -6300,6 +6307,7 @@ FullscreenTransitionTask::Observer::Observe(nsISupports* aSubject,
"Should only trigger this with the timer the task created"); "Should only trigger this with the timer the task created");
#endif #endif
shouldContinue = true; shouldContinue = true;
PROFILER_MARKER("Fullscreen toggle timeout");
} }
if (shouldContinue) { if (shouldContinue) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService(); nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();