mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Bug 1515214 - Add TimeoutHandler::GetDescription which just calls through to CallbackObject::GetDescription for CallbackTimeoutHandlers. r=smaug
Depends on D19192 Differential Revision: https://phabricator.services.mozilla.com/D37470 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
6efbe54e95
commit
7cd7e179b5
@ -29,6 +29,11 @@ void TimeoutHandler::GetLocation(const char** aFileName, uint32_t* aLineNo,
|
||||
*aColumn = mColumn;
|
||||
}
|
||||
|
||||
void TimeoutHandler::GetDescription(nsACString& aOutString) {
|
||||
aOutString.AppendPrintf("<generic handler> (%s:%d:%d)", mFileName.get(),
|
||||
mLineNo, mColumn);
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_0(TimeoutHandler)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(TimeoutHandler)
|
||||
@ -84,6 +89,19 @@ NS_INTERFACE_MAP_END_INHERITING(TimeoutHandler)
|
||||
NS_IMPL_ADDREF_INHERITED(ScriptTimeoutHandler, TimeoutHandler)
|
||||
NS_IMPL_RELEASE_INHERITED(ScriptTimeoutHandler, TimeoutHandler)
|
||||
|
||||
void ScriptTimeoutHandler::GetDescription(nsACString& aOutString) {
|
||||
if (mExpr.Length() > 15) {
|
||||
aOutString.AppendPrintf(
|
||||
"<string handler (truncated): \"%s...\"> (%s:%d:%d)",
|
||||
NS_ConvertUTF16toUTF8(Substring(mExpr, 0, 13)).get(), mFileName.get(),
|
||||
mLineNo, mColumn);
|
||||
} else {
|
||||
aOutString.AppendPrintf("<string handler: \"%s\"> (%s:%d:%d)",
|
||||
NS_ConvertUTF16toUTF8(mExpr).get(), mFileName.get(),
|
||||
mLineNo, mColumn);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CallbackTimeoutHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -167,5 +185,9 @@ bool CallbackTimeoutHandler::Call(const char* aExecutionReason) {
|
||||
|
||||
void CallbackTimeoutHandler::MarkForCC() { mFunction->MarkForCC(); }
|
||||
|
||||
void CallbackTimeoutHandler::GetDescription(nsACString& aOutString) {
|
||||
mFunction->GetDescription(aOutString);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -34,6 +34,12 @@ class TimeoutHandler : public nsISupports {
|
||||
// nsITimeoutHandler and should not be freed by the caller.
|
||||
virtual void GetLocation(const char** aFileName, uint32_t* aLineNo,
|
||||
uint32_t* aColumn);
|
||||
// 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>:<columnNumber>)"
|
||||
virtual void GetDescription(nsACString& aOutString);
|
||||
virtual void MarkForCC() {}
|
||||
|
||||
protected:
|
||||
@ -65,6 +71,7 @@ class ScriptTimeoutHandler : public TimeoutHandler {
|
||||
MOZ_CAN_RUN_SCRIPT virtual bool Call(const char* /* unused */) override {
|
||||
return false;
|
||||
};
|
||||
virtual void GetDescription(nsACString& aOutString) override;
|
||||
|
||||
protected:
|
||||
virtual ~ScriptTimeoutHandler() {}
|
||||
@ -87,6 +94,7 @@ class CallbackTimeoutHandler final : public TimeoutHandler {
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT virtual bool Call(const char* aExecutionReason) override;
|
||||
virtual void MarkForCC() override;
|
||||
virtual void GetDescription(nsACString& aOutString) override;
|
||||
|
||||
void ReleaseJSObjects();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user