зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1811566 - Cut DomainLookupStart/End over to fine-grained RFP. r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D167563
This commit is contained in:
Родитель
620bbb27ea
Коммит
38d425da3c
|
@ -98,20 +98,9 @@ Performance::Performance(nsIGlobalObject* aGlobal)
|
|||
mResourceTimingBufferSize(kDefaultResourceTimingBufferSize),
|
||||
mPendingNotificationObserversTask(false),
|
||||
mPendingResourceTimingBufferFullEvent(false),
|
||||
mRTPCallerType(
|
||||
RTPCallerType::Normal /* to be updated in CreateForFoo */) {
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
}
|
||||
|
||||
Performance::Performance(nsPIDOMWindowInner* aWindow)
|
||||
: DOMEventTargetHelper(aWindow),
|
||||
mResourceTimingBufferSize(kDefaultResourceTimingBufferSize),
|
||||
mPendingNotificationObserversTask(false),
|
||||
mPendingResourceTimingBufferFullEvent(false),
|
||||
mRTPCallerType(
|
||||
RTPCallerType::Normal /* to be updated in CreateForFoo */) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
}
|
||||
mRTPCallerType(aGlobal->GetRTPCallerType()),
|
||||
mCrossOriginIsolated(aGlobal->CrossOriginIsolated()),
|
||||
mShouldResistFingerprinting(aGlobal->ShouldResistFingerprinting()) {}
|
||||
|
||||
Performance::~Performance() = default;
|
||||
|
||||
|
|
|
@ -122,6 +122,11 @@ class Performance : public DOMEventTargetHelper {
|
|||
|
||||
RTPCallerType GetRTPCallerType() const { return mRTPCallerType; }
|
||||
|
||||
bool CrossOriginIsolated() const { return mCrossOriginIsolated; }
|
||||
bool ShouldResistFingerprinting() const {
|
||||
return mShouldResistFingerprinting;
|
||||
}
|
||||
|
||||
DOMHighResTimeStamp TimeStampToDOMHighResForRendering(TimeStamp) const;
|
||||
|
||||
virtual uint64_t GetRandomTimelineSeed() = 0;
|
||||
|
@ -147,8 +152,6 @@ class Performance : public DOMEventTargetHelper {
|
|||
|
||||
virtual void UpdateNavigationTimingEntry() = 0;
|
||||
|
||||
virtual bool CrossOriginIsolated() const = 0;
|
||||
|
||||
virtual void DispatchPendingEventTimingEntries() = 0;
|
||||
|
||||
void QueueNotificationObserversTask();
|
||||
|
@ -205,7 +208,9 @@ class Performance : public DOMEventTargetHelper {
|
|||
|
||||
RefPtr<PerformanceService> mPerformanceService;
|
||||
|
||||
enum RTPCallerType mRTPCallerType;
|
||||
const RTPCallerType mRTPCallerType;
|
||||
const bool mCrossOriginIsolated;
|
||||
const bool mShouldResistFingerprinting;
|
||||
|
||||
private:
|
||||
MOZ_ALWAYS_INLINE bool CanAddResourceTimingEntry();
|
||||
|
|
|
@ -91,12 +91,10 @@ NS_INTERFACE_MAP_END_INHERITING(Performance)
|
|||
PerformanceMainThread::PerformanceMainThread(nsPIDOMWindowInner* aWindow,
|
||||
nsDOMNavigationTiming* aDOMTiming,
|
||||
nsITimedChannel* aChannel)
|
||||
: Performance(aWindow),
|
||||
: Performance(aWindow->AsGlobal()),
|
||||
mDOMTiming(aDOMTiming),
|
||||
mChannel(aChannel),
|
||||
mCrossOriginIsolated(aWindow->AsGlobal()->CrossOriginIsolated()) {
|
||||
mChannel(aChannel) {
|
||||
MOZ_ASSERT(aWindow, "Parent window object should be provided");
|
||||
mRTPCallerType = aWindow->AsGlobal()->GetRTPCallerType();
|
||||
if (StaticPrefs::dom_enable_event_timing()) {
|
||||
mEventCounts = new class EventCounts(GetParentObject());
|
||||
}
|
||||
|
@ -451,10 +449,6 @@ void PerformanceMainThread::QueueNavigationTimingEntry() {
|
|||
QueueEntry(mDocEntry);
|
||||
}
|
||||
|
||||
bool PerformanceMainThread::CrossOriginIsolated() const {
|
||||
return mCrossOriginIsolated;
|
||||
}
|
||||
|
||||
EventCounts* PerformanceMainThread::EventCounts() {
|
||||
MOZ_ASSERT(StaticPrefs::dom_enable_event_timing());
|
||||
return mEventCounts;
|
||||
|
|
|
@ -88,8 +88,6 @@ class PerformanceMainThread final : public Performance,
|
|||
void UpdateNavigationTimingEntry() override;
|
||||
void QueueNavigationTimingEntry() override;
|
||||
|
||||
bool CrossOriginIsolated() const override;
|
||||
|
||||
size_t SizeOfEventEntries(mozilla::MallocSizeOf aMallocSizeOf) const override;
|
||||
|
||||
static constexpr uint32_t kDefaultEventTimingBufferSize = 150;
|
||||
|
@ -120,8 +118,6 @@ class PerformanceMainThread final : public Performance,
|
|||
RefPtr<PerformancePaintTiming> mFCPTiming;
|
||||
JS::Heap<JSObject*> mMozMemory;
|
||||
|
||||
const bool mCrossOriginIsolated;
|
||||
|
||||
nsTArray<RefPtr<PerformanceEventTiming>> mEventTimingEntries;
|
||||
|
||||
AutoCleanLinkedList<RefPtr<PerformanceEventTiming>>
|
||||
|
|
|
@ -468,7 +468,7 @@ DOMHighResTimeStamp PerformanceTimingData::DomainLookupStartHighRes(
|
|||
return mZeroTime;
|
||||
}
|
||||
// Bug 1637985 - DomainLookup information may be useful for fingerprinting.
|
||||
if (nsContentUtils::ShouldResistFingerprinting()) {
|
||||
if (aPerformance->ShouldResistFingerprinting()) {
|
||||
return FetchStartHighRes(aPerformance);
|
||||
}
|
||||
return TimeStampToReducedDOMHighResOrFetchStart(aPerformance,
|
||||
|
@ -488,7 +488,7 @@ DOMHighResTimeStamp PerformanceTimingData::DomainLookupEndHighRes(
|
|||
return mZeroTime;
|
||||
}
|
||||
// Bug 1637985 - DomainLookup information may be useful for fingerprinting.
|
||||
if (nsContentUtils::ShouldResistFingerprinting()) {
|
||||
if (aPerformance->ShouldResistFingerprinting()) {
|
||||
return FetchStartHighRes(aPerformance);
|
||||
}
|
||||
// Bug 1155008 - nsHttpTransaction is racy. Return DomainLookupStart when null
|
||||
|
|
|
@ -14,7 +14,6 @@ PerformanceWorker::PerformanceWorker(WorkerPrivate* aWorkerPrivate)
|
|||
: Performance(aWorkerPrivate->GlobalScope()),
|
||||
mWorkerPrivate(aWorkerPrivate) {
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
mRTPCallerType = aWorkerPrivate->GlobalScope()->GetRTPCallerType();
|
||||
}
|
||||
|
||||
PerformanceWorker::~PerformanceWorker() {
|
||||
|
@ -60,14 +59,6 @@ uint64_t PerformanceWorker::GetRandomTimelineSeed() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool PerformanceWorker::CrossOriginIsolated() const {
|
||||
MOZ_DIAGNOSTIC_ASSERT(mWorkerPrivate);
|
||||
if (mWorkerPrivate) {
|
||||
return mWorkerPrivate->CrossOriginIsolated();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void PerformanceWorker::NoteShuttingDown() { mWorkerPrivate = nullptr; }
|
||||
|
||||
} // namespace mozilla::dom
|
||||
|
|
|
@ -80,8 +80,6 @@ class PerformanceWorker final : public Performance {
|
|||
MOZ_CRASH("This should not be called on workers");
|
||||
}
|
||||
|
||||
bool CrossOriginIsolated() const override;
|
||||
|
||||
void NoteShuttingDown();
|
||||
|
||||
protected:
|
||||
|
|
Загрузка…
Ссылка в новой задаче