import changes from `dev' branch of rmottola/Arctic-Fox:

- remaining part of Bug 1146339 - Do anchor scrolling right before dispatching popstate (1123b0133)
- Bug 1170488 - Document URI should be updated before sending out onLocationChange. r=smaug (6f553c2ee)
- Bug 1144820 - Use nsTArray<UniquePtr<>> to hold timeline markers. r=smaug, r=fitzgen (e4b878ec3)
- Bug 1143004 - markers from console.timeStamp() should be rendered in the performance tool's timeline. r=vp (7d8d4cb0c)
- Bug 1170671 - ProfileTimelineMarkers that use TRACING_TIMESTAMP should capture stack information. r=smaug (dc7982a30)
- Bug 1141614 - Part 1: Maintain a list of docshells whose timeline markers are being observed; r=smaug (2dc04461c)
- Bug 1159779 - mozilla::AutoTimelineMarker shouldn't be copy-able; r=smaug (24aadecd4)
- Bug 1141614 - Part 2: Add mozilla::AutoGlobalTimelineMarker; r=smaug (c069191a5)
- Bug 1141614 - Part 3: Trace cycle collection with AutoGlobalTimelineMarker; r=smaug (2cdccd0fc)
- Bug 1160521 - The markers list sidebar should be wider by default, r=jsantell (c479c72c3)
- Bug 1150696 - Move all timeline tests that are still relevent into the performance tools tests. r=vp (276572541)
- Bug 1165504 - Refactor out marker details view into utilities, make marker definitions more declaritive. r=vp (42218191c)
- Bug 1166139 - properly display the generic class name for markers in the marker filter popup. r=vp (711b0032a)
- Bug 1157916 - Add tooltip for displaying start/end times on marker details' duration field. r=vp (c586757d5)
This commit is contained in:
2021-05-06 09:10:28 +08:00
parent 821f0fa106
commit 32a8a44732
41 changed files with 763 additions and 843 deletions
+30 -26
View File
@@ -951,7 +951,7 @@ nsDocShell::nsDocShell()
nsDocShell::~nsDocShell()
{
MOZ_ASSERT(!mProfileTimelineRecording);
MOZ_ASSERT(!IsObserved());
// Avoid notifying observers while we're in the dtor.
mIsBeingDestroyed = true;
@@ -2936,6 +2936,8 @@ nsDocShell::HistoryTransactionRemoved(int32_t aIndex)
unsigned long nsDocShell::gProfileTimelineRecordingsCount = 0;
mozilla::LinkedList<nsDocShell::ObservedDocShell>* nsDocShell::gObservedDocShells = nullptr;
NS_IMETHODIMP
nsDocShell::SetRecordProfileTimelineMarkers(bool aValue)
{
@@ -2944,11 +2946,16 @@ nsDocShell::SetRecordProfileTimelineMarkers(bool aValue)
if (aValue) {
++gProfileTimelineRecordingsCount;
UseEntryScriptProfiling();
mProfileTimelineRecording = true;
MOZ_ASSERT(!mObserved);
mObserved.reset(new ObservedDocShell(this));
GetOrCreateObservedDocShells().insertFront(mObserved.get());
} else {
--gProfileTimelineRecordingsCount;
UnuseEntryScriptProfiling();
mProfileTimelineRecording = false;
mObserved.reset(nullptr);
ClearProfileTimelineMarkers();
}
}
@@ -2959,7 +2966,7 @@ nsDocShell::SetRecordProfileTimelineMarkers(bool aValue)
NS_IMETHODIMP
nsDocShell::GetRecordProfileTimelineMarkers(bool* aValue)
{
*aValue = mProfileTimelineRecording;
*aValue = IsObserved();
return NS_OK;
}
@@ -2983,10 +2990,10 @@ nsDocShell::PopProfileTimelineMarkers(
// If we see an unpaired START, we keep it around for the next call
// to PopProfileTimelineMarkers. We store the kept START objects in
// this array.
nsTArray<TimelineMarker*> keptMarkers;
nsTArray<UniquePtr<TimelineMarker>> keptMarkers;
for (uint32_t i = 0; i < mProfileTimelineMarkers.Length(); ++i) {
TimelineMarker* startPayload = mProfileTimelineMarkers[i];
UniquePtr<TimelineMarker>& startPayload = mProfileTimelineMarkers[i];
const char* startMarkerName = startPayload->GetName();
bool hasSeenPaintedLayer = false;
@@ -3006,6 +3013,7 @@ nsDocShell::PopProfileTimelineMarkers(
marker->mName = NS_ConvertUTF8toUTF16(startPayload->GetName());
marker->mStart = startPayload->GetTime();
marker->mEnd = startPayload->GetTime();
marker->mStack = startPayload->GetStack();
startPayload->AddDetails(aCx, *marker);
continue;
}
@@ -3022,7 +3030,7 @@ nsDocShell::PopProfileTimelineMarkers(
// enough for the amount of markers to always be small enough that the
// nested for loop isn't going to be a performance problem.
for (uint32_t j = i + 1; j < mProfileTimelineMarkers.Length(); ++j) {
TimelineMarker* endPayload = mProfileTimelineMarkers[j];
UniquePtr<TimelineMarker>& endPayload = mProfileTimelineMarkers[j];
const char* endMarkerName = endPayload->GetName();
// Look for Layer markers to stream out paint markers.
@@ -3031,7 +3039,7 @@ nsDocShell::PopProfileTimelineMarkers(
endPayload->AddLayerRectangles(layerRectangles);
}
if (!startPayload->Equals(endPayload)) {
if (!startPayload->Equals(*endPayload)) {
continue;
}
@@ -3068,14 +3076,13 @@ nsDocShell::PopProfileTimelineMarkers(
// If we did not see the corresponding END, keep the START.
if (!hasSeenEnd) {
keptMarkers.AppendElement(mProfileTimelineMarkers[i]);
keptMarkers.AppendElement(Move(mProfileTimelineMarkers[i]));
mProfileTimelineMarkers.RemoveElementAt(i);
--i;
}
}
}
ClearProfileTimelineMarkers();
mProfileTimelineMarkers.SwapElements(keptMarkers);
if (!ToJSValue(aCx, profileTimelineMarkers, aProfileTimelineMarkers)) {
@@ -3099,7 +3106,7 @@ void
nsDocShell::AddProfileTimelineMarker(const char* aName,
TracingMetadata aMetaData)
{
if (mProfileTimelineRecording) {
if (IsObserved()) {
TimelineMarker* marker = new TimelineMarker(this, aName, aMetaData);
mProfileTimelineMarkers.AppendElement(marker);
}
@@ -3108,8 +3115,8 @@ nsDocShell::AddProfileTimelineMarker(const char* aName,
void
nsDocShell::AddProfileTimelineMarker(UniquePtr<TimelineMarker>&& aMarker)
{
if (mProfileTimelineRecording) {
mProfileTimelineMarkers.AppendElement(aMarker.release());
if (IsObserved()) {
mProfileTimelineMarkers.AppendElement(Move(aMarker));
}
}
@@ -3145,9 +3152,6 @@ nsDocShell::GetWindowDraggingAllowed(bool* aValue)
void
nsDocShell::ClearProfileTimelineMarkers()
{
for (uint32_t i = 0; i < mProfileTimelineMarkers.Length(); ++i) {
delete mProfileTimelineMarkers[i];
}
mProfileTimelineMarkers.Clear();
}
@@ -10193,6 +10197,11 @@ nsDocShell::InternalLoad2(nsIURI* aURI,
*/
SetHistoryEntry(&mLSHE, aSHEntry);
// Set the doc's URI according to the new history entry's URI.
nsCOMPtr<nsIDocument> doc = GetDocument();
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
doc->SetDocumentURI(aURI);
/* This is a anchor traversal with in the same page.
* call OnNewURI() so that, this traversal will be
* recorded in session and global history.
@@ -10283,13 +10292,12 @@ nsDocShell::InternalLoad2(nsIURI* aURI,
}
}
// Set the doc's URI according to the new history entry's URI.
nsCOMPtr<nsIDocument> doc = GetDocument();
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
doc->SetDocumentURI(aURI);
SetDocCurrentStateObj(mOSHE);
// Inform the favicon service that the favicon for oldURI also
// applies to aURI.
CopyFavicon(currentURI, aURI, mInPrivateBrowsing);
nsRefPtr<nsGlobalWindow> win = mScriptGlobal ?
mScriptGlobal->GetCurrentInnerWindowInternal() : nullptr;
@@ -10331,10 +10339,6 @@ nsDocShell::InternalLoad2(nsIURI* aURI,
}
}
// Inform the favicon service that the favicon for oldURI also
// applies to aURI.
CopyFavicon(currentURI, aURI, mInPrivateBrowsing);
return NS_OK;
}
}
@@ -11865,8 +11869,8 @@ nsDocShell::AddState(JS::Handle<JS::Value> aData, const nsAString& aTitle,
// document and it requires LOCATION_CHANGE_SAME_DOCUMENT flag. Otherwise,
// FireOnLocationChange(...) breaks security UI.
if (!equalURIs) {
SetCurrentURI(newURI, nullptr, true, LOCATION_CHANGE_SAME_DOCUMENT);
document->SetDocumentURI(newURI);
SetCurrentURI(newURI, nullptr, true, LOCATION_CHANGE_SAME_DOCUMENT);
AddURIVisit(newURI, oldURI, oldURI, 0);