зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 31f667310dfe (bug 1862937) for causing multiple failures in WeakPtr.h. CLOSED TREE
This commit is contained in:
Родитель
e7fdebad1a
Коммит
c49907e14f
|
@ -16219,8 +16219,6 @@ void Document::ReportLCP() {
|
|||
|
||||
mozilla::glean::perf::largest_contentful_paint_from_response_start
|
||||
.AccumulateRawDuration(lcpTime - responseStart);
|
||||
|
||||
GetNavigationTiming()->MaybeAddLCPProfilerMarker();
|
||||
}
|
||||
|
||||
void Document::SendPageUseCounters() {
|
||||
|
|
|
@ -526,33 +526,6 @@ void nsDOMNavigationTiming::NotifyDocShellStateChanged(
|
|||
(aDocShellState == DocShellState::eActive);
|
||||
}
|
||||
|
||||
void nsDOMNavigationTiming::MaybeAddLCPProfilerMarker() {
|
||||
// This method might get called from outside of the main thread, so can't
|
||||
// check `profiler_thread_is_being_profiled_for_markers()` here.
|
||||
if (!profiler_is_active_and_unpaused()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TimeStamp navStartTime = GetNavigationStartTimeStamp();
|
||||
TimeStamp lcpTime = GetLargestContentfulRenderTimeStamp();
|
||||
|
||||
if (!navStartTime || !lcpTime) {
|
||||
return;
|
||||
}
|
||||
|
||||
TimeDuration elapsed = lcpTime - navStartTime;
|
||||
nsPrintfCString marker("Largest contentful paint after %dms",
|
||||
int(elapsed.ToMilliseconds()));
|
||||
PROFILER_MARKER_TEXT(
|
||||
"LargestContentfulPaint", DOM,
|
||||
// Putting this marker to the main thread even if it's called from another
|
||||
// one.
|
||||
MarkerOptions(MarkerThreadId::MainThread(),
|
||||
MarkerTiming::Interval(navStartTime, lcpTime),
|
||||
MarkerInnerWindowIdFromDocShell(mDocShell)),
|
||||
marker);
|
||||
}
|
||||
|
||||
mozilla::TimeStamp nsDOMNavigationTiming::GetUnloadEventStartTimeStamp() const {
|
||||
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
||||
// todo: if you intend to update CheckSameOriginURI to log the error to the
|
||||
|
|
|
@ -184,8 +184,6 @@ class nsDOMNavigationTiming final : public mozilla::RelativeTimeline {
|
|||
void NotifyDOMContentFlushedForRootContentDocument();
|
||||
void NotifyDocShellStateChanged(DocShellState aDocShellState);
|
||||
|
||||
void MaybeAddLCPProfilerMarker();
|
||||
|
||||
DOMTimeMilliSec TimeStampToDOM(mozilla::TimeStamp aStamp) const;
|
||||
|
||||
inline DOMHighResTimeStamp TimeStampToDOMHighRes(
|
||||
|
|
|
@ -109,34 +109,9 @@ PerformanceMainThread::PerformanceMainThread(nsPIDOMWindowInner* aWindow,
|
|||
mEventCounts = new class EventCounts(GetParentObject());
|
||||
}
|
||||
CreateNavigationTimingEntry();
|
||||
|
||||
if (StaticPrefs::dom_enable_largest_contentful_paint()) {
|
||||
// There might be multiple LCP entries and we only care about the latest one
|
||||
// which is also the biggest value. That's why we need to record these
|
||||
// markers in two different places:
|
||||
// - During the Document unload, so we can record the closed pages.
|
||||
// - During the profile capture, so we can record the open pages.
|
||||
// We are capturing the second one here.
|
||||
// Our static analysis doesn't allow capturing ref-counted pointers in
|
||||
// lambdas, so we need to hide it in a uintptr_t. This is safe because this
|
||||
// lambda will be destroyed in ~PerformanceMainThread().
|
||||
uintptr_t self = reinterpret_cast<uintptr_t>(this);
|
||||
profiler_add_state_change_callback(
|
||||
// Using the "Pausing" state as "GeneratingProfile" profile happens too
|
||||
// late; we can not record markers if the profiler is already paused.
|
||||
ProfilingState::Pausing,
|
||||
[self](ProfilingState aProfilingState) {
|
||||
const PerformanceMainThread* selfPtr =
|
||||
reinterpret_cast<const PerformanceMainThread*>(self);
|
||||
|
||||
selfPtr->GetDOMTiming()->MaybeAddLCPProfilerMarker();
|
||||
},
|
||||
self);
|
||||
}
|
||||
}
|
||||
|
||||
PerformanceMainThread::~PerformanceMainThread() {
|
||||
profiler_remove_state_change_callback(reinterpret_cast<uintptr_t>(this));
|
||||
mozilla::DropJSObjects(this);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче