mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1195838 - Maintain all the TimelineMarker subclasses in a single place, r=tromey
This commit is contained in:
parent
9c93c0380d
commit
41542b4509
@ -96,6 +96,7 @@
|
||||
#include "nsSHistory.h"
|
||||
#include "nsDocShellEditorData.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "timeline/JavascriptTimelineMarker.h"
|
||||
|
||||
// Helper Classes
|
||||
#include "nsError.h"
|
||||
@ -13763,50 +13764,6 @@ nsDocShell::GetOpener()
|
||||
return opener;
|
||||
}
|
||||
|
||||
class JavascriptTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
explicit JavascriptTimelineMarker(const char* aName,
|
||||
const char* aReason,
|
||||
const char16_t* aFunctionName,
|
||||
const char16_t* aFileName,
|
||||
uint32_t aLineNumber)
|
||||
: TimelineMarker(aName, NS_ConvertUTF8toUTF16(aReason),
|
||||
TRACING_INTERVAL_START, NO_STACK)
|
||||
, mFunctionName(aFunctionName)
|
||||
, mFileName(aFileName)
|
||||
, mLineNumber(aLineNumber)
|
||||
{
|
||||
}
|
||||
|
||||
void AddDetails(JSContext* aCx, mozilla::dom::ProfileTimelineMarker& aMarker)
|
||||
override
|
||||
{
|
||||
aMarker.mCauseName.Construct(GetCause());
|
||||
|
||||
if (!mFunctionName.IsEmpty() || !mFileName.IsEmpty()) {
|
||||
RootedDictionary<ProfileTimelineStackFrame> stackFrame(aCx);
|
||||
stackFrame.mLine.Construct(mLineNumber);
|
||||
stackFrame.mSource.Construct(mFileName);
|
||||
stackFrame.mFunctionDisplayName.Construct(mFunctionName);
|
||||
|
||||
JS::Rooted<JS::Value> newStack(aCx);
|
||||
if (ToJSValue(aCx, stackFrame, &newStack)) {
|
||||
if (newStack.isObject()) {
|
||||
aMarker.mStack = &newStack.toObject();
|
||||
}
|
||||
} else {
|
||||
JS_ClearPendingException(aCx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
nsString mFunctionName;
|
||||
nsString mFileName;
|
||||
uint32_t mLineNumber;
|
||||
};
|
||||
|
||||
void
|
||||
nsDocShell::NotifyJSRunToCompletionStart(const char* aReason,
|
||||
const char16_t* aFunctionName,
|
||||
@ -13817,10 +13774,8 @@ nsDocShell::NotifyJSRunToCompletionStart(const char* aReason,
|
||||
|
||||
// If first start, mark interval start.
|
||||
if (timelineOn && mJSRunToCompletionDepth == 0) {
|
||||
mozilla::UniquePtr<TimelineMarker> marker =
|
||||
MakeUnique<JavascriptTimelineMarker>("Javascript", aReason,
|
||||
aFunctionName, aFilename,
|
||||
aLineNumber);
|
||||
UniquePtr<TimelineMarker> marker = MakeUnique<JavascriptTimelineMarker>(
|
||||
aReason, aFunctionName, aFilename, aLineNumber, TRACING_INTERVAL_START);
|
||||
TimelineConsumers::AddMarkerForDocShell(this, Move(marker));
|
||||
}
|
||||
mJSRunToCompletionDepth++;
|
||||
|
@ -33,9 +33,9 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "timeline/TimelineMarker.h"
|
||||
#include "timeline/TimelineConsumers.h"
|
||||
#include "timeline/ObservedDocShell.h"
|
||||
#include "timeline/TimelineConsumers.h"
|
||||
#include "timeline/TimelineMarker.h"
|
||||
|
||||
// Threshold value in ms for META refresh based redirects
|
||||
#define REFRESH_REDIRECT_TIMER 15000
|
||||
|
@ -19,7 +19,7 @@ namespace mozilla {
|
||||
// Similar to `AutoTimelineMarker`, but adds its traced marker to all docshells,
|
||||
// not a single particular one. This is useful for operations that aren't
|
||||
// associated with any one particular doc shell, or when it isn't clear which
|
||||
// doc shell triggered the operation.
|
||||
// docshell triggered the operation.
|
||||
//
|
||||
// Example usage:
|
||||
//
|
||||
|
50
docshell/base/timeline/ConsoleTimelineMarker.h
Normal file
50
docshell/base/timeline/ConsoleTimelineMarker.h
Normal file
@ -0,0 +1,50 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_ConsoleTimelineMarker_h_
|
||||
#define mozilla_ConsoleTimelineMarker_h_
|
||||
|
||||
#include "TimelineMarker.h"
|
||||
#include "mozilla/dom/ProfileTimelineMarkerBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class ConsoleTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
explicit ConsoleTimelineMarker(const nsAString& aCause,
|
||||
TracingMetadata aMetaData)
|
||||
: TimelineMarker("ConsoleTime", aCause, aMetaData)
|
||||
{
|
||||
// Stack is captured by default on the "start" marker. Explicitly also
|
||||
// capture stack on the "end" marker.
|
||||
if (aMetaData == TRACING_INTERVAL_END) {
|
||||
CaptureStack();
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool Equals(const TimelineMarker& aOther) override
|
||||
{
|
||||
if (!TimelineMarker::Equals(aOther)) {
|
||||
return false;
|
||||
}
|
||||
// Console markers must have matching causes as well.
|
||||
return GetCause() == aOther.GetCause();
|
||||
}
|
||||
|
||||
virtual void AddDetails(JSContext* aCx, dom::ProfileTimelineMarker& aMarker) override
|
||||
{
|
||||
if (GetMetaData() == TRACING_INTERVAL_START) {
|
||||
aMarker.mCauseName.Construct(GetCause());
|
||||
} else {
|
||||
aMarker.mEndStack = GetStack();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_ConsoleTimelineMarker_h_
|
39
docshell/base/timeline/EventTimelineMarker.h
Normal file
39
docshell/base/timeline/EventTimelineMarker.h
Normal file
@ -0,0 +1,39 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_EventTimelineMarker_h_
|
||||
#define mozilla_EventTimelineMarker_h_
|
||||
|
||||
#include "TimelineMarker.h"
|
||||
#include "mozilla/dom/ProfileTimelineMarkerBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class EventTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
explicit EventTimelineMarker(const nsAString& aCause,
|
||||
uint16_t aPhase,
|
||||
TracingMetadata aMetaData)
|
||||
: TimelineMarker("DOMEvent", aCause, aMetaData)
|
||||
, mPhase(aPhase)
|
||||
{}
|
||||
|
||||
virtual void AddDetails(JSContext* aCx, dom::ProfileTimelineMarker& aMarker) override
|
||||
{
|
||||
if (GetMetaData() == TRACING_INTERVAL_START) {
|
||||
aMarker.mType.Construct(GetCause());
|
||||
aMarker.mEventPhase.Construct(mPhase);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
uint16_t mPhase;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_EventTimelineMarker_h_
|
60
docshell/base/timeline/JavascriptTimelineMarker.h
Normal file
60
docshell/base/timeline/JavascriptTimelineMarker.h
Normal file
@ -0,0 +1,60 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_JavascriptTimelineMarker_h_
|
||||
#define mozilla_JavascriptTimelineMarker_h_
|
||||
|
||||
#include "TimelineMarker.h"
|
||||
#include "mozilla/dom/ProfileTimelineMarkerBinding.h"
|
||||
#include "mozilla/dom/RootedDictionary.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class JavascriptTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
explicit JavascriptTimelineMarker(const char* aReason,
|
||||
const char16_t* aFunctionName,
|
||||
const char16_t* aFileName,
|
||||
uint32_t aLineNumber,
|
||||
TracingMetadata aMetaData)
|
||||
: TimelineMarker("Javascript", NS_ConvertUTF8toUTF16(aReason), aMetaData, NO_STACK)
|
||||
, mFunctionName(aFunctionName)
|
||||
, mFileName(aFileName)
|
||||
, mLineNumber(aLineNumber)
|
||||
{}
|
||||
|
||||
virtual void AddDetails(JSContext* aCx, dom::ProfileTimelineMarker& aMarker) override
|
||||
{
|
||||
aMarker.mCauseName.Construct(GetCause());
|
||||
|
||||
if (!mFunctionName.IsEmpty() || !mFileName.IsEmpty()) {
|
||||
dom::RootedDictionary<dom::ProfileTimelineStackFrame> stackFrame(aCx);
|
||||
stackFrame.mLine.Construct(mLineNumber);
|
||||
stackFrame.mSource.Construct(mFileName);
|
||||
stackFrame.mFunctionDisplayName.Construct(mFunctionName);
|
||||
|
||||
JS::Rooted<JS::Value> newStack(aCx);
|
||||
if (ToJSValue(aCx, stackFrame, &newStack)) {
|
||||
if (newStack.isObject()) {
|
||||
aMarker.mStack = &newStack.toObject();
|
||||
}
|
||||
} else {
|
||||
JS_ClearPendingException(aCx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
nsString mFunctionName;
|
||||
nsString mFileName;
|
||||
uint32_t mLineNumber;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_JavascriptTimelineMarker_h_
|
45
docshell/base/timeline/LayerTimelineMarker.h
Normal file
45
docshell/base/timeline/LayerTimelineMarker.h
Normal file
@ -0,0 +1,45 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_LayerTimelineMarker_h_
|
||||
#define mozilla_LayerTimelineMarker_h_
|
||||
|
||||
#include "TimelineMarker.h"
|
||||
#include "mozilla/dom/ProfileTimelineMarkerBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class LayerTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
explicit LayerTimelineMarker(const nsIntRegion& aRegion)
|
||||
: TimelineMarker("Layer", TRACING_EVENT)
|
||||
, mRegion(aRegion)
|
||||
{}
|
||||
|
||||
~LayerTimelineMarker()
|
||||
{}
|
||||
|
||||
void AddLayerRectangles(dom::Sequence<dom::ProfileTimelineLayerRect>& aRectangles)
|
||||
{
|
||||
nsIntRegionRectIterator it(mRegion);
|
||||
while (const nsIntRect* iterRect = it.Next()) {
|
||||
dom::ProfileTimelineLayerRect rect;
|
||||
rect.mX = iterRect->X();
|
||||
rect.mY = iterRect->Y();
|
||||
rect.mWidth = iterRect->Width();
|
||||
rect.mHeight = iterRect->Height();
|
||||
aRectangles.AppendElement(rect, fallible);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
nsIntRegion mRegion;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_LayerTimelineMarker_h_
|
@ -7,6 +7,7 @@
|
||||
#include "ObservedDocShell.h"
|
||||
|
||||
#include "TimelineMarker.h"
|
||||
#include "LayerTimelineMarker.h"
|
||||
#include "mozilla/Move.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -80,8 +81,9 @@ ObservedDocShell::PopMarkers(JSContext* aCx,
|
||||
|
||||
// Look for "Layer" markers to stream out "Paint" markers.
|
||||
if (startIsPaintType && endIsLayerType) {
|
||||
LayerTimelineMarker* layerPayload = static_cast<LayerTimelineMarker*>(endPayload.get());
|
||||
layerPayload->AddLayerRectangles(layerRectangles);
|
||||
hasSeenLayerType = true;
|
||||
endPayload->AddLayerRectangles(layerRectangles);
|
||||
}
|
||||
if (!startPayload->Equals(*endPayload)) {
|
||||
continue;
|
||||
|
@ -11,9 +11,10 @@
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
class nsDocShell;
|
||||
class TimelineMarker;
|
||||
|
||||
namespace mozilla {
|
||||
class TimelineMarker;
|
||||
|
||||
namespace dom {
|
||||
struct ProfileTimelineMarker;
|
||||
}
|
||||
|
40
docshell/base/timeline/RestyleTimelineMarker.h
Normal file
40
docshell/base/timeline/RestyleTimelineMarker.h
Normal file
@ -0,0 +1,40 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_RestyleTimelineMarker_h_
|
||||
#define mozilla_RestyleTimelineMarker_h_
|
||||
|
||||
#include "TimelineMarker.h"
|
||||
#include "mozilla/dom/ProfileTimelineMarkerBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class RestyleTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
explicit RestyleTimelineMarker(nsRestyleHint aRestyleHint,
|
||||
TracingMetadata aMetaData)
|
||||
: TimelineMarker("Styles", aMetaData)
|
||||
{
|
||||
if (aRestyleHint) {
|
||||
mRestyleHint.AssignWithConversion(RestyleManager::RestyleHintToString(aRestyleHint));
|
||||
}
|
||||
}
|
||||
|
||||
virtual void AddDetails(JSContext* aCx, dom::ProfileTimelineMarker& aMarker) override
|
||||
{
|
||||
if (GetMetaData() == TRACING_INTERVAL_START) {
|
||||
aMarker.mRestyleHint.Construct(mRestyleHint);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
nsAutoString mRestyleHint;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_RestyleTimelineMarker_h_
|
@ -14,10 +14,10 @@
|
||||
|
||||
class nsDocShell;
|
||||
class nsIDocShell;
|
||||
class TimelineMarker;
|
||||
|
||||
namespace mozilla {
|
||||
class ObservedDocShell;
|
||||
class TimelineMarker;
|
||||
|
||||
class TimelineConsumers
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "TimelineMarker.h"
|
||||
|
||||
using mozilla::TimeStamp;
|
||||
namespace mozilla {
|
||||
|
||||
TimelineMarker::TimelineMarker(const char* aName,
|
||||
TracingMetadata aMetaData,
|
||||
@ -95,3 +95,5 @@ TimelineMarker::CaptureStackIfNecessary(TracingMetadata aMetaData,
|
||||
CaptureStack();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -4,8 +4,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef TimelineMarker_h_
|
||||
#define TimelineMarker_h_
|
||||
#ifndef mozilla_TimelineMarker_h_
|
||||
#define mozilla_TimelineMarker_h_
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -13,6 +13,11 @@
|
||||
|
||||
class nsDocShell;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
struct ProfileTimelineMarker;
|
||||
}
|
||||
|
||||
// Objects of this type can be added to the timeline if there is an interested
|
||||
// consumer. The class can also be subclassed to let a given marker creator
|
||||
// provide custom details.
|
||||
@ -26,7 +31,7 @@ public:
|
||||
TimelineStackRequest aStackRequest = STACK);
|
||||
|
||||
TimelineMarker(const char* aName,
|
||||
const mozilla::TimeStamp& aTime,
|
||||
const TimeStamp& aTime,
|
||||
TracingMetadata aMetaData,
|
||||
TimelineStackRequest aStackRequest = STACK);
|
||||
|
||||
@ -37,7 +42,7 @@ public:
|
||||
|
||||
TimelineMarker(const char* aName,
|
||||
const nsAString& aCause,
|
||||
const mozilla::TimeStamp& aTime,
|
||||
const TimeStamp& aTime,
|
||||
TracingMetadata aMetaData,
|
||||
TimelineStackRequest aStackRequest = STACK);
|
||||
|
||||
@ -54,18 +59,13 @@ public:
|
||||
// have already been set. This method is called on both the starting and
|
||||
// ending markers of a pair. Ordinarily the ending marker doesn't need to do
|
||||
// anything here.
|
||||
virtual void AddDetails(JSContext* aCx, mozilla::dom::ProfileTimelineMarker& aMarker)
|
||||
virtual void AddDetails(JSContext* aCx, dom::ProfileTimelineMarker& aMarker)
|
||||
{}
|
||||
|
||||
virtual void AddLayerRectangles(mozilla::dom::Sequence<mozilla::dom::ProfileTimelineLayerRect>&)
|
||||
{
|
||||
MOZ_ASSERT_UNREACHABLE("can only be called on layer markers");
|
||||
}
|
||||
|
||||
const char* GetName() const { return mName; }
|
||||
TracingMetadata GetMetaData() const { return mMetaData; }
|
||||
DOMHighResTimeStamp GetTime() const { return mTime; }
|
||||
const nsString& GetCause() const { return mCause; }
|
||||
DOMHighResTimeStamp GetTime() const { return mTime; }
|
||||
TracingMetadata GetMetaData() const { return mMetaData; }
|
||||
|
||||
JSObject* GetStack()
|
||||
{
|
||||
@ -102,9 +102,11 @@ private:
|
||||
JS::PersistentRooted<JSObject*> mStackTrace;
|
||||
|
||||
void SetCurrentTime();
|
||||
void SetCustomTime(const mozilla::TimeStamp& aTime);
|
||||
void SetCustomTime(const TimeStamp& aTime);
|
||||
void CaptureStackIfNecessary(TracingMetadata aMetaData,
|
||||
TimelineStackRequest aStackRequest);
|
||||
};
|
||||
|
||||
#endif /* TimelineMarker_h_ */
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* mozilla_TimelineMarker_h_ */
|
||||
|
32
docshell/base/timeline/TimestampTimelineMarker.h
Normal file
32
docshell/base/timeline/TimestampTimelineMarker.h
Normal file
@ -0,0 +1,32 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_TimestampTimelineMarker_h_
|
||||
#define mozilla_TimestampTimelineMarker_h_
|
||||
|
||||
#include "TimelineMarker.h"
|
||||
#include "mozilla/dom/ProfileTimelineMarkerBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class TimestampTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
explicit TimestampTimelineMarker(const nsAString& aCause)
|
||||
: TimelineMarker("TimeStamp", aCause, TRACING_TIMESTAMP)
|
||||
{}
|
||||
|
||||
virtual void AddDetails(JSContext* aCx, dom::ProfileTimelineMarker& aMarker) override
|
||||
{
|
||||
if (!GetCause().IsEmpty()) {
|
||||
aMarker.mCauseName.Construct(GetCause());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_TimestampTimelineMarker_h_
|
@ -7,9 +7,15 @@
|
||||
EXPORTS.mozilla += [
|
||||
'AutoGlobalTimelineMarker.h',
|
||||
'AutoTimelineMarker.h',
|
||||
'ConsoleTimelineMarker.h',
|
||||
'EventTimelineMarker.h',
|
||||
'JavascriptTimelineMarker.h',
|
||||
'LayerTimelineMarker.h',
|
||||
'ObservedDocShell.h',
|
||||
'RestyleTimelineMarker.h',
|
||||
'TimelineConsumers.h',
|
||||
'TimelineMarker.h',
|
||||
'TimestampTimelineMarker.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDocShell.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "mozilla/ConsoleTimelineMarker.h"
|
||||
#include "mozilla/TimestampTimelineMarker.h"
|
||||
|
||||
#include "nsIConsoleAPIStorage.h"
|
||||
#include "nsIDOMWindowUtils.h"
|
||||
@ -985,55 +987,6 @@ ReifyStack(nsIStackFrame* aStack, nsTArray<ConsoleStackEntry>& aRefiedStack)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
class ConsoleTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
explicit ConsoleTimelineMarker(const nsAString& aCause,
|
||||
TracingMetadata aMetaData)
|
||||
: TimelineMarker("ConsoleTime", aCause, aMetaData)
|
||||
{
|
||||
if (aMetaData == TRACING_INTERVAL_END) {
|
||||
CaptureStack();
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool Equals(const TimelineMarker& aOther) override
|
||||
{
|
||||
if (!TimelineMarker::Equals(aOther)) {
|
||||
return false;
|
||||
}
|
||||
// Console markers must have matching causes as well.
|
||||
return GetCause() == aOther.GetCause();
|
||||
}
|
||||
|
||||
virtual void AddDetails(JSContext* aCx,
|
||||
mozilla::dom::ProfileTimelineMarker& aMarker) override
|
||||
{
|
||||
if (GetMetaData() == TRACING_INTERVAL_START) {
|
||||
aMarker.mCauseName.Construct(GetCause());
|
||||
} else {
|
||||
aMarker.mEndStack = GetStack();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class TimestampTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
explicit TimestampTimelineMarker(const nsAString& aCause)
|
||||
: TimelineMarker("TimeStamp", aCause, TRACING_TIMESTAMP)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void AddDetails(JSContext* aCx,
|
||||
mozilla::dom::ProfileTimelineMarker& aMarker) override
|
||||
{
|
||||
if (!GetCause().IsEmpty()) {
|
||||
aMarker.mCauseName.Construct(GetCause());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Queue a call to a console method. See the CALL_DELAY constant.
|
||||
void
|
||||
Console::Method(JSContext* aCx, MethodName aMethodName,
|
||||
@ -1140,8 +1093,7 @@ Console::Method(JSContext* aCx, MethodName aMethodName,
|
||||
key.init(aCx, jsString);
|
||||
}
|
||||
|
||||
mozilla::UniquePtr<TimelineMarker> marker =
|
||||
MakeUnique<TimestampTimelineMarker>(key);
|
||||
UniquePtr<TimelineMarker> marker = MakeUnique<TimestampTimelineMarker>(key);
|
||||
TimelineConsumers::AddMarkerForDocShell(docShell, Move(marker));
|
||||
}
|
||||
// For `console.time(foo)` and `console.timeEnd(foo)`
|
||||
@ -1151,9 +1103,9 @@ Console::Method(JSContext* aCx, MethodName aMethodName,
|
||||
if (jsString) {
|
||||
nsAutoJSString key;
|
||||
if (key.init(aCx, jsString)) {
|
||||
mozilla::UniquePtr<TimelineMarker> marker =
|
||||
MakeUnique<ConsoleTimelineMarker>(key,
|
||||
aMethodName == MethodTime ? TRACING_INTERVAL_START : TRACING_INTERVAL_END);
|
||||
UniquePtr<TimelineMarker> marker = MakeUnique<ConsoleTimelineMarker>(
|
||||
key, aMethodName == MethodTime ? TRACING_INTERVAL_START
|
||||
: TRACING_INTERVAL_END);
|
||||
TimelineConsumers::AddMarkerForDocShell(docShell, Move(marker));
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/TimelineConsumers.h"
|
||||
#include "mozilla/EventTimelineMarker.h"
|
||||
|
||||
#include "EventListenerService.h"
|
||||
#include "nsCOMArray.h"
|
||||
@ -1056,29 +1057,6 @@ EventListenerManager::GetDocShellForTarget()
|
||||
return docShell;
|
||||
}
|
||||
|
||||
class EventTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
explicit EventTimelineMarker(TracingMetadata aMetaData,
|
||||
uint16_t aPhase, const nsAString& aCause)
|
||||
: TimelineMarker("DOMEvent", aCause, aMetaData)
|
||||
, mPhase(aPhase)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void AddDetails(JSContext* aCx,
|
||||
mozilla::dom::ProfileTimelineMarker& aMarker) override
|
||||
{
|
||||
if (GetMetaData() == TRACING_INTERVAL_START) {
|
||||
aMarker.mType.Construct(GetCause());
|
||||
aMarker.mEventPhase.Construct(mPhase);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
uint16_t mPhase;
|
||||
};
|
||||
|
||||
/**
|
||||
* Causes a check for event listeners and processing by them if they exist.
|
||||
* @param an event listener
|
||||
@ -1149,9 +1127,8 @@ EventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
|
||||
(*aDOMEvent)->GetType(typeStr);
|
||||
uint16_t phase;
|
||||
(*aDOMEvent)->GetEventPhase(&phase);
|
||||
mozilla::UniquePtr<TimelineMarker> marker =
|
||||
MakeUnique<EventTimelineMarker>(TRACING_INTERVAL_START,
|
||||
phase, typeStr);
|
||||
UniquePtr<TimelineMarker> marker = MakeUnique<EventTimelineMarker>(
|
||||
typeStr, phase, TRACING_INTERVAL_START);
|
||||
TimelineConsumers::AddMarkerForDocShell(ds, Move(marker));
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsSVGIntegrationUtils.h"
|
||||
#include "mozilla/LayerTimelineMarker.h"
|
||||
|
||||
#include "mozilla/Move.h"
|
||||
#include "mozilla/ReverseIterator.h"
|
||||
@ -5497,36 +5498,6 @@ static void DrawForcedBackgroundColor(DrawTarget& aDrawTarget,
|
||||
}
|
||||
}
|
||||
|
||||
class LayerTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
explicit LayerTimelineMarker(const nsIntRegion& aRegion)
|
||||
: TimelineMarker("Layer", TRACING_EVENT)
|
||||
, mRegion(aRegion)
|
||||
{
|
||||
}
|
||||
|
||||
~LayerTimelineMarker()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void AddLayerRectangles(mozilla::dom::Sequence<mozilla::dom::ProfileTimelineLayerRect>& aRectangles) override
|
||||
{
|
||||
nsIntRegionRectIterator it(mRegion);
|
||||
while (const nsIntRect* iterRect = it.Next()) {
|
||||
mozilla::dom::ProfileTimelineLayerRect rect;
|
||||
rect.mX = iterRect->X();
|
||||
rect.mY = iterRect->Y();
|
||||
rect.mWidth = iterRect->Width();
|
||||
rect.mHeight = iterRect->Height();
|
||||
aRectangles.AppendElement(rect, fallible);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
nsIntRegion mRegion;
|
||||
};
|
||||
|
||||
/*
|
||||
* A note on residual transforms:
|
||||
*
|
||||
@ -5687,8 +5658,7 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
|
||||
bool isRecording;
|
||||
docShell->GetRecordProfileTimelineMarkers(&isRecording);
|
||||
if (isRecording) {
|
||||
mozilla::UniquePtr<TimelineMarker> marker =
|
||||
MakeUnique<LayerTimelineMarker>(aRegionToDraw);
|
||||
UniquePtr<TimelineMarker> marker = MakeUnique<LayerTimelineMarker>(aRegionToDraw);
|
||||
TimelineConsumers::AddMarkerForDocShell(docShell, Move(marker));
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "RestyleManager.h"
|
||||
#include "RestyleTrackerInlines.h"
|
||||
#include "nsTransitionManager.h"
|
||||
#include "mozilla/RestyleTimelineMarker.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -97,30 +98,6 @@ struct RestyleCollector {
|
||||
#endif
|
||||
};
|
||||
|
||||
class RestyleTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
explicit RestyleTimelineMarker(TracingMetadata aMetaData,
|
||||
nsRestyleHint aRestyleHint)
|
||||
: TimelineMarker("Styles", aMetaData)
|
||||
{
|
||||
if (aRestyleHint) {
|
||||
mRestyleHint.AssignWithConversion(RestyleManager::RestyleHintToString(aRestyleHint));
|
||||
}
|
||||
}
|
||||
|
||||
virtual void AddDetails(JSContext* aCx,
|
||||
mozilla::dom::ProfileTimelineMarker& aMarker) override
|
||||
{
|
||||
if (GetMetaData() == TRACING_INTERVAL_START) {
|
||||
aMarker.mRestyleHint.Construct(mRestyleHint);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
nsAutoString mRestyleHint;
|
||||
};
|
||||
|
||||
static PLDHashOperator
|
||||
CollectRestyles(nsISupports* aElement,
|
||||
nsAutoPtr<RestyleTracker::RestyleData>& aData,
|
||||
@ -357,9 +334,8 @@ RestyleTracker::DoProcessRestyles()
|
||||
}
|
||||
|
||||
if (isTimelineRecording) {
|
||||
mozilla::UniquePtr<TimelineMarker> marker =
|
||||
MakeUnique<RestyleTimelineMarker>(TRACING_INTERVAL_START,
|
||||
data->mRestyleHint);
|
||||
UniquePtr<TimelineMarker> marker = MakeUnique<RestyleTimelineMarker>(
|
||||
data->mRestyleHint, TRACING_INTERVAL_START);
|
||||
TimelineConsumers::AddMarkerForDocShell(docShell, Move(marker));
|
||||
}
|
||||
|
||||
@ -374,9 +350,8 @@ RestyleTracker::DoProcessRestyles()
|
||||
AddRestyleRootsIfAwaitingRestyle(data->mDescendants);
|
||||
|
||||
if (isTimelineRecording) {
|
||||
mozilla::UniquePtr<TimelineMarker> marker =
|
||||
MakeUnique<RestyleTimelineMarker>(TRACING_INTERVAL_END,
|
||||
data->mRestyleHint);
|
||||
UniquePtr<TimelineMarker> marker = MakeUnique<RestyleTimelineMarker>(
|
||||
data->mRestyleHint, TRACING_INTERVAL_END);
|
||||
TimelineConsumers::AddMarkerForDocShell(docShell, Move(marker));
|
||||
}
|
||||
}
|
||||
@ -420,9 +395,8 @@ RestyleTracker::DoProcessRestyles()
|
||||
}
|
||||
#endif
|
||||
if (isTimelineRecording) {
|
||||
mozilla::UniquePtr<TimelineMarker> marker =
|
||||
MakeUnique<RestyleTimelineMarker>(TRACING_INTERVAL_START,
|
||||
currentRestyle->mRestyleHint);
|
||||
UniquePtr<TimelineMarker> marker = MakeUnique<RestyleTimelineMarker>(
|
||||
currentRestyle->mRestyleHint, TRACING_INTERVAL_START);
|
||||
TimelineConsumers::AddMarkerForDocShell(docShell, Move(marker));
|
||||
}
|
||||
|
||||
@ -432,9 +406,8 @@ RestyleTracker::DoProcessRestyles()
|
||||
currentRestyle->mRestyleHintData);
|
||||
|
||||
if (isTimelineRecording) {
|
||||
mozilla::UniquePtr<TimelineMarker> marker =
|
||||
MakeUnique<RestyleTimelineMarker>(TRACING_INTERVAL_END,
|
||||
currentRestyle->mRestyleHint);
|
||||
UniquePtr<TimelineMarker> marker = MakeUnique<RestyleTimelineMarker>(
|
||||
currentRestyle->mRestyleHint, TRACING_INTERVAL_END);
|
||||
TimelineConsumers::AddMarkerForDocShell(docShell, Move(marker));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user