diff options
author | Martok <martok@martoks-place.de> | 2023-01-21 22:48:18 +0100 |
---|---|---|
committer | Martok <martok@martoks-place.de> | 2023-01-21 22:49:10 +0100 |
commit | d45404536313e28d032e1a806fecad4c580c6d63 (patch) | |
tree | 74d4c1e99ff4cd163e6c67d3d357cb58d073556d /docshell | |
parent | 44adc9e25cf8f5132456e89844b4da1c1da1f695 (diff) | |
download | uxp-d45404536313e28d032e1a806fecad4c580c6d63.tar.gz |
No issue - add API to tell Profile Timeline Recording state to JS engine
Based-on: m-c 1342070/5
Diffstat (limited to 'docshell')
-rw-r--r-- | docshell/base/timeline/TimelineConsumers.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/docshell/base/timeline/TimelineConsumers.cpp b/docshell/base/timeline/TimelineConsumers.cpp index 92d589c5ba..3abe152881 100644 --- a/docshell/base/timeline/TimelineConsumers.cpp +++ b/docshell/base/timeline/TimelineConsumers.cpp @@ -6,6 +6,7 @@ #include "TimelineConsumers.h" #include "mozilla/ClearOnShutdown.h" +#include "jsapi.h" #include "nsAppRunner.h" // for XRE_IsContentProcess, XRE_IsParentProcess #include "nsDocShell.h" @@ -125,6 +126,9 @@ TimelineConsumers::AddConsumer(nsDocShell* aDocShell) UniquePtr<ObservedDocShell>& observed = aDocShell->mObserved; MOZ_ASSERT(!observed); + if (mActiveConsumers == 0) { + JS::SetProfileTimelineRecordingEnabled(true); + } mActiveConsumers++; ObservedDocShell* obsDocShell = new ObservedDocShell(aDocShell); @@ -144,6 +148,9 @@ TimelineConsumers::RemoveConsumer(nsDocShell* aDocShell) MOZ_ASSERT(observed); mActiveConsumers--; + if (mActiveConsumers == 0) { + JS::SetProfileTimelineRecordingEnabled(false); + } // Clear all markers from the `mTimelineMarkers` store. observed.get()->ClearMarkers(); |