diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index 998bd876806c..f642ad539dc1 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -75,7 +75,6 @@ #include "mozilla/layout/VsyncChild.h" #include "VsyncSource.h" #include "mozilla/VsyncDispatcher.h" -#include "nsThreadUtils.h" #include "mozilla/Unused.h" #include "mozilla/TimelineConsumers.h" #include "nsAnimationManager.h" @@ -2107,6 +2106,9 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime) { if (!mStyleFlushObservers.RemoveElement(rawPresShell)) { continue; } + + LogPresShellObserver::Run run(rawPresShell, this); + RefPtr presShell = rawPresShell; presShell->mObservingStyleFlushes = false; presShell->FlushPendingNotifications( @@ -2133,6 +2135,9 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime) { if (!mLayoutFlushObservers.RemoveElement(rawPresShell)) { continue; } + + LogPresShellObserver::Run run(rawPresShell, this); + RefPtr presShell = rawPresShell; presShell->mObservingLayoutFlushes = false; presShell->mWasLastReflowInterrupted = false; diff --git a/layout/base/nsRefreshDriver.h b/layout/base/nsRefreshDriver.h index 09d3bf32c97e..86d7893bd0b0 100644 --- a/layout/base/nsRefreshDriver.h +++ b/layout/base/nsRefreshDriver.h @@ -23,6 +23,7 @@ #include "nsClassHashtable.h" #include "nsHashKeys.h" #include "nsRefreshObservers.h" +#include "nsThreadUtils.h" #include "mozilla/Attributes.h" #include "mozilla/Maybe.h" #include "mozilla/dom/VisualViewport.h" @@ -54,6 +55,7 @@ class nsRefreshDriver final : public mozilla::layers::TransactionIdAllocator, mozilla::dom::VisualViewport::VisualViewportResizeEvent; using VVPScrollEvent = mozilla::dom::VisualViewport::VisualViewportScrollEvent; + using LogPresShellObserver = mozilla::LogPresShellObserver; public: explicit nsRefreshDriver(nsPresContext* aPresContext); @@ -170,6 +172,7 @@ class nsRefreshDriver final : public mozilla::layers::TransactionIdAllocator, void AddStyleFlushObserver(mozilla::PresShell* aPresShell) { MOZ_DIAGNOSTIC_ASSERT(!mStyleFlushObservers.Contains(aPresShell), "Double-adding style flush observer"); + LogPresShellObserver::LogDispatch(aPresShell, this); mStyleFlushObservers.AppendElement(aPresShell); EnsureTimerStarted(); } @@ -180,6 +183,7 @@ class nsRefreshDriver final : public mozilla::layers::TransactionIdAllocator, void AddLayoutFlushObserver(mozilla::PresShell* aPresShell) { MOZ_DIAGNOSTIC_ASSERT(!IsLayoutFlushObserver(aPresShell), "Double-adding layout flush observer"); + LogPresShellObserver::LogDispatch(aPresShell, this); mLayoutFlushObservers.AppendElement(aPresShell); EnsureTimerStarted(); } diff --git a/xpcom/threads/nsThreadUtils.cpp b/xpcom/threads/nsThreadUtils.cpp index 25eaf21312a3..b17bc6c3a1e4 100644 --- a/xpcom/threads/nsThreadUtils.cpp +++ b/xpcom/threads/nsThreadUtils.cpp @@ -629,6 +629,10 @@ template void LogTaskBase::LogDispatch(T* aEvent) { LOG1(("DISP %p", aEvent)); } +template +void LogTaskBase::LogDispatch(T* aEvent, void* aContext) { + LOG1(("DISP %p (%p)", aEvent, aContext)); +} template <> void LogTaskBase::LogDispatchWithPid(IPC::Message* aEvent, @@ -646,6 +650,11 @@ LogTaskBase::Run::Run(T* aEvent, bool aWillRunAgain) // time. LOG1(("EXEC %p %p", aEvent, this)); } +template +LogTaskBase::Run::Run(T* aEvent, void* aContext, bool aWillRunAgain) + : mWillRunAgain(aWillRunAgain) { + LOG1(("EXEC %p (%p) %p", aEvent, aContext, this)); +} template <> LogTaskBase::Run::Run(nsIRunnable* aEvent, bool aWillRunAgain) @@ -690,6 +699,7 @@ template class LogTaskBase; template class LogTaskBase; template class LogTaskBase; template class LogTaskBase; +template class LogTaskBase; MOZ_THREAD_LOCAL(nsISerialEventTarget*) SerialEventTargetGuard::sCurrentThreadTLS; diff --git a/xpcom/threads/nsThreadUtils.h b/xpcom/threads/nsThreadUtils.h index 361c02bcb69a..e3e9381b9d20 100644 --- a/xpcom/threads/nsThreadUtils.h +++ b/xpcom/threads/nsThreadUtils.h @@ -1923,6 +1923,8 @@ class LogTaskBase { // Adds a simple log about dispatch of this runnable. static void LogDispatch(T* aEvent); + // The `aContext` pointer adds another uniqe identifier, nothing more + static void LogDispatch(T* aEvent, void* aContext); // Logs dispatch of the message and along that also the PID of the target // proccess, purposed for uniquely identifying IPC messages. @@ -1936,6 +1938,7 @@ class LogTaskBase { public: Run() = delete; explicit Run(T* aEvent, bool aWillRunAgain = false); + explicit Run(T* aEvent, void* aContext, bool aWillRunAgain = false); ~Run(); // When this is called, the log in this RAII dtor will only say @@ -1949,6 +1952,7 @@ class LogTaskBase { class MicroTaskRunnable; class Task; // TaskController +class PresShell; // Specialized methods must be explicitly predeclared. template <> @@ -1966,6 +1970,7 @@ typedef LogTaskBase LogMicroTaskRunnable; typedef LogTaskBase LogIPCMessage; typedef LogTaskBase LogTimerEvent; typedef LogTaskBase LogTask; +typedef LogTaskBase LogPresShellObserver; // If you add new types don't forget to add: // `template class LogTaskBase;` to nsThreadUtils.cpp