Backed out 2 changesets (bug 1515214) for hazard build bustage at CallbackObject.cpp. CLOSED TREE

Backed out changeset 7c4973b0d0e8 (bug 1515214)
Backed out changeset 9aabc3ad2470 (bug 1515214)

--HG--
extra : histedit_source : fe9f52b4aa92e6c3aacb62d5eba3807353c20654
This commit is contained in:
Brindusan Cristian 2019-03-08 00:04:31 +02:00
Родитель 978b96980f
Коммит 86556db730
5 изменённых файлов: 5 добавлений и 134 удалений

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

@ -49,13 +49,6 @@ void Timeout::SetWhenOrTimeRemaining(const TimeStamp& aBaseTime,
MOZ_DIAGNOSTIC_ASSERT(mWindow); MOZ_DIAGNOSTIC_ASSERT(mWindow);
mSubmitTime = aBaseTime; 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 // 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 // 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 // new mWhen time when the window is thawed. The end effect is that time does

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

@ -13,7 +13,6 @@
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
#include "nsITimeoutHandler.h" #include "nsITimeoutHandler.h"
#include "GeckoProfiler.h"
class nsIEventTarget; class nsIEventTarget;
class nsIPrincipal; class nsIPrincipal;
@ -51,10 +50,6 @@ class Timeout final : public LinkedListElement<RefPtr<Timeout>> {
// Can only be called when frozen. // Can only be called when frozen.
const TimeDuration& TimeRemaining() const; const TimeDuration& TimeRemaining() const;
#ifdef MOZ_GECKO_PROFILER
UniqueProfilerBacktrace TakeProfilerBacktrace() { return std::move(mCause); }
#endif
private: private:
// mWhen and mTimeRemaining can't be in a union, sadly, because they // mWhen and mTimeRemaining can't be in a union, sadly, because they
// have constructors. // have constructors.
@ -87,10 +82,6 @@ class Timeout final : public LinkedListElement<RefPtr<Timeout>> {
// Interval // Interval
TimeDuration mInterval; TimeDuration mInterval;
#ifdef MOZ_GECKO_PROFILER
UniqueProfilerBacktrace mCause;
#endif
// Returned as value of setTimeout() // Returned as value of setTimeout()
uint32_t mTimeoutId; uint32_t mTimeoutId;

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

@ -5513,42 +5513,6 @@ int32_t nsGlobalWindowInner::SetTimeoutOrInterval(JSContext* aCx,
return result; 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<nsIScriptTimeoutHandler> handler(
do_QueryInterface(aTimeout->mScriptHandler));
if (!handler) {
aOutString.Append("<non-script timeout handler>");
return;
}
if (RefPtr<Function> callback = handler->GetCallback()) {
callback->GetDescription(aOutString);
return;
}
const char* filename = nullptr;
uint32_t lineNo = 0, columnNo = 0;
handler->GetLocation(&filename, &lineNo, &columnNo);
aOutString.AppendPrintf("<string handler> (%s:%d:%d)", filename, lineNo,
columnNo);
}
bool nsGlobalWindowInner::RunTimeoutHandler(Timeout* aTimeout, bool nsGlobalWindowInner::RunTimeoutHandler(Timeout* aTimeout,
nsIScriptContext* aScx) { nsIScriptContext* aScx) {
// Hold on to the timeout in case mExpr or mFunObj releases its // 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); TimeoutManager::SetNestingLevel(timeout->mNestingLevel);
} }
const char* reason = GetTimeoutReasonString(timeout); const char* reason;
if (timeout->mIsInterval) {
#ifdef MOZ_GECKO_PROFILER reason = "setInterval handler";
nsCOMPtr<nsIDocShell> docShell = GetDocShell(); } else {
nsCString str; reason = "setTimeout handler";
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);
} }
AUTO_PROFILER_TEXT_MARKER_DOCSHELL_CAUSE("setTimeout callback", str, JS,
docShell,
timeout->TakeProfilerBacktrace());
#endif
bool abortIntervalHandler = false; bool abortIntervalHandler = false;
nsCOMPtr<nsIScriptTimeoutHandler> handler( nsCOMPtr<nsIScriptTimeoutHandler> handler(

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

@ -126,63 +126,6 @@ JSObject* CallbackObject::Callback(JSContext* aCx) {
return callback; return callback;
} }
void CallbackObject::GetDescription(nsACString& aOutString) {
JSObject* wrappedCallback = CallbackOrNull();
if (!wrappedCallback) {
aOutString.Append("<callback from a nuked compartment>");
return;
}
JSObject* unwrappedCallback = js::CheckedUnwrapStatic(wrappedCallback);
if (!unwrappedCallback) {
aOutString.Append("<not a function>");
return;
}
AutoJSAPI jsapi;
jsapi.Init();
JSContext* cx = jsapi.cx();
JS::RootedObject rootedCallback(cx, unwrappedCallback);
JSAutoRealm ar(cx, rootedCallback);
JS::Rooted<JSFunction*> rootedFunction(cx,
JS_GetObjectFunction(rootedCallback));
if (!rootedFunction) {
aOutString.Append("<not a function>");
return;
}
JS::Rooted<JSString*> displayId(cx, JS_GetFunctionDisplayId(rootedFunction));
if (displayId) {
nsAutoJSString funcNameStr;
if (funcNameStr.init(cx, displayId)) {
if (funcNameStr.IsEmpty()) {
aOutString.Append("<empty name>");
} else {
AppendUTF16toUTF8(funcNameStr, aOutString);
}
} else {
aOutString.Append("<function name string failed to materialize>");
jsapi.ClearException();
}
} else {
aOutString.Append("<anonymous>");
}
JS::Rooted<JSScript*> 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, CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
ErrorResult& aRv, ErrorResult& aRv,
const char* aExecutionReason, const char* aExecutionReason,

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

@ -158,13 +158,6 @@ class CallbackObject : public nsISupports {
eRethrowExceptions 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:
// "<functionName> (<sourceURL>:<lineNumber>)"
void GetDescription(nsACString& aOutString);
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
return aMallocSizeOf(this); return aMallocSizeOf(this);
} }