diff --git a/dom/base/Timeout.cpp b/dom/base/Timeout.cpp index 396b4a189ac1..33d4e3041082 100644 --- a/dom/base/Timeout.cpp +++ b/dom/base/Timeout.cpp @@ -49,13 +49,6 @@ void Timeout::SetWhenOrTimeRemaining(const TimeStamp& aBaseTime, MOZ_DIAGNOSTIC_ASSERT(mWindow); mSubmitTime = aBaseTime; - mSubmitTime = aBaseTime; -#ifdef MOZ_GECKO_PROFILER - if (profiler_is_active()) { - mCause = profiler_get_backtrace(); - } -#endif - // If we are frozen simply set mTimeRemaining to be the "time remaining" in // the timeout (i.e., the interval itself). This will be used to create a // new mWhen time when the window is thawed. The end effect is that time does diff --git a/dom/base/Timeout.h b/dom/base/Timeout.h index 29326e40dbf7..55a75544b8c5 100644 --- a/dom/base/Timeout.h +++ b/dom/base/Timeout.h @@ -13,7 +13,6 @@ #include "nsCOMPtr.h" #include "nsCycleCollectionParticipant.h" #include "nsITimeoutHandler.h" -#include "GeckoProfiler.h" class nsIEventTarget; class nsIPrincipal; @@ -51,10 +50,6 @@ class Timeout final : public LinkedListElement> { // Can only be called when frozen. const TimeDuration& TimeRemaining() const; -#ifdef MOZ_GECKO_PROFILER - UniqueProfilerBacktrace TakeProfilerBacktrace() { return std::move(mCause); } -#endif - private: // mWhen and mTimeRemaining can't be in a union, sadly, because they // have constructors. @@ -87,10 +82,6 @@ class Timeout final : public LinkedListElement> { // Interval TimeDuration mInterval; -#ifdef MOZ_GECKO_PROFILER - UniqueProfilerBacktrace mCause; -#endif - // Returned as value of setTimeout() uint32_t mTimeoutId; diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp index c2d1e043c03b..4397cf8bc5d7 100644 --- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -5513,42 +5513,6 @@ int32_t nsGlobalWindowInner::SetTimeoutOrInterval(JSContext* aCx, return result; } -static const char* GetTimeoutReasonString(Timeout* aTimeout) { - switch (aTimeout->mReason) { - case Timeout::Reason::eTimeoutOrInterval: - if (aTimeout->mIsInterval) { - return "setInterval handler"; - } - return "setTimeout handler"; - case Timeout::Reason::eIdleCallbackTimeout: - return "setIdleCallback handler (timed out)"; - default: - MOZ_CRASH("Unexpected enum value"); - return ""; - } -} - -static void GetHandlerDescription(Timeout* aTimeout, nsACString& aOutString) { - nsCOMPtr handler( - do_QueryInterface(aTimeout->mScriptHandler)); - - if (!handler) { - aOutString.Append(""); - return; - } - - if (RefPtr callback = handler->GetCallback()) { - callback->GetDescription(aOutString); - return; - } - - const char* filename = nullptr; - uint32_t lineNo = 0, columnNo = 0; - handler->GetLocation(&filename, &lineNo, &columnNo); - aOutString.AppendPrintf(" (%s:%d:%d)", filename, lineNo, - columnNo); -} - bool nsGlobalWindowInner::RunTimeoutHandler(Timeout* aTimeout, nsIScriptContext* aScx) { // Hold on to the timeout in case mExpr or mFunObj releases its @@ -5574,25 +5538,12 @@ bool nsGlobalWindowInner::RunTimeoutHandler(Timeout* aTimeout, TimeoutManager::SetNestingLevel(timeout->mNestingLevel); } - const char* reason = GetTimeoutReasonString(timeout); - -#ifdef MOZ_GECKO_PROFILER - nsCOMPtr docShell = GetDocShell(); - nsCString str; - if (profiler_is_active()) { - TimeDuration originalInterval = timeout->When() - timeout->SubmitTime(); - str.Append(reason); - str.Append(" with interval "); - str.AppendInt(int(originalInterval.ToMilliseconds())); - str.Append("ms: "); - nsCString handlerDescription; - GetHandlerDescription(timeout, handlerDescription); - str.Append(handlerDescription); + const char* reason; + if (timeout->mIsInterval) { + reason = "setInterval handler"; + } else { + reason = "setTimeout handler"; } - AUTO_PROFILER_TEXT_MARKER_DOCSHELL_CAUSE("setTimeout callback", str, JS, - docShell, - timeout->TakeProfilerBacktrace()); -#endif bool abortIntervalHandler = false; nsCOMPtr handler( diff --git a/dom/bindings/CallbackObject.cpp b/dom/bindings/CallbackObject.cpp index 37f9d6442575..f05b2ee6f236 100644 --- a/dom/bindings/CallbackObject.cpp +++ b/dom/bindings/CallbackObject.cpp @@ -126,63 +126,6 @@ JSObject* CallbackObject::Callback(JSContext* aCx) { return callback; } -void CallbackObject::GetDescription(nsACString& aOutString) { - JSObject* wrappedCallback = CallbackOrNull(); - if (!wrappedCallback) { - aOutString.Append(""); - return; - } - - JSObject* unwrappedCallback = js::CheckedUnwrapStatic(wrappedCallback); - if (!unwrappedCallback) { - aOutString.Append(""); - return; - } - - AutoJSAPI jsapi; - jsapi.Init(); - JSContext* cx = jsapi.cx(); - - JS::RootedObject rootedCallback(cx, unwrappedCallback); - JSAutoRealm ar(cx, rootedCallback); - - JS::Rooted rootedFunction(cx, - JS_GetObjectFunction(rootedCallback)); - if (!rootedFunction) { - aOutString.Append(""); - return; - } - - JS::Rooted displayId(cx, JS_GetFunctionDisplayId(rootedFunction)); - if (displayId) { - nsAutoJSString funcNameStr; - if (funcNameStr.init(cx, displayId)) { - if (funcNameStr.IsEmpty()) { - aOutString.Append(""); - } else { - AppendUTF16toUTF8(funcNameStr, aOutString); - } - } else { - aOutString.Append(""); - jsapi.ClearException(); - } - } else { - aOutString.Append(""); - } - - JS::Rooted rootedScript(cx, - JS_GetFunctionScript(cx, rootedFunction)); - if (!rootedScript) { - return; - } - - aOutString.Append(" ("); - aOutString.Append(JS_GetScriptFilename(rootedScript)); - aOutString.Append(":"); - aOutString.AppendInt(JS_GetScriptBaseLineNumber(cx, rootedScript)); - aOutString.Append(")"); -} - CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback, ErrorResult& aRv, const char* aExecutionReason, diff --git a/dom/bindings/CallbackObject.h b/dom/bindings/CallbackObject.h index d7ac2ae2b4bb..db532aceb131 100644 --- a/dom/bindings/CallbackObject.h +++ b/dom/bindings/CallbackObject.h @@ -158,13 +158,6 @@ class CallbackObject : public nsISupports { eRethrowExceptions }; - // Append a UTF-8 string to aOutString that describes the callback function, - // for use in logging or profiler markers. - // The string contains the function name and its source location, if - // available, in the following format: - // " (:)" - void GetDescription(nsACString& aOutString); - size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this); }