mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
Bug 1322292 - Some fixes for the Performance API in workers - part 2 - Get rid of NowBaseTimeStamp()
https://hg.mozilla.org/mozilla-central/rev/301231f4165a
This commit is contained in:
parent
94ea4f222c
commit
c1d7159d0f
7 changed files with 11 additions and 40 deletions
|
|
@ -1337,7 +1337,7 @@ Console::MethodInternal(JSContext* aCx, MethodName aMethodName,
|
|||
MOZ_ASSERT(workerPrivate);
|
||||
|
||||
TimeDuration duration =
|
||||
mozilla::TimeStamp::Now() - workerPrivate->NowBaseTimeStamp();
|
||||
mozilla::TimeStamp::Now() - workerPrivate->CreationTimeStamp();
|
||||
|
||||
monotonicTimer = TimerClamping::ReduceMsTimeValue(duration.ToMilliseconds());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,9 +258,8 @@ private:
|
|||
// the max number of timers is reached.
|
||||
// * aCx - the JSContext rooting aName.
|
||||
// * aName - this is (should be) the name of the timer as JS::Value.
|
||||
// * aTimestamp - the monotonicTimer for this context (taken from
|
||||
// window->performance.now() or from Now() -
|
||||
// workerPrivate->NowBaseTimeStamp() in workers.
|
||||
// * aTimestamp - the monotonicTimer for this context taken from
|
||||
// performance.now().
|
||||
// * aTimerLabel - This label will be populated with the aName converted to a
|
||||
// string.
|
||||
// * aTimerValue - the StartTimer value stored into (or taken from)
|
||||
|
|
@ -290,9 +289,8 @@ private:
|
|||
// the aName timer doesn't exist in the mTimerRegistry.
|
||||
// * aCx - the JSContext rooting aName.
|
||||
// * aName - this is (should be) the name of the timer as JS::Value.
|
||||
// * aTimestamp - the monotonicTimer for this context (taken from
|
||||
// window->performance.now() or from Now() -
|
||||
// workerPrivate->NowBaseTimeStamp() in workers.
|
||||
// * aTimestamp - the monotonicTimer for this context taken from
|
||||
// performance.now().
|
||||
// * aTimerLabel - This label will be populated with the aName converted to a
|
||||
// string.
|
||||
// * aTimerDuration - the difference between aTimestamp and when the timer
|
||||
|
|
|
|||
|
|
@ -1146,15 +1146,14 @@ Event::TimeStampImpl() const
|
|||
return perf->GetDOMTiming()->TimeStampToDOMHighRes(mEvent->mTimeStamp);
|
||||
}
|
||||
|
||||
// For dedicated workers, we should make times relative to the navigation
|
||||
// start of the document that created the worker, which is the same as the
|
||||
// timebase for performance.now().
|
||||
// For dedicated workers, we should make times relative to the creation time
|
||||
// of the worker, which is the same as the timebase for performance.now().
|
||||
workers::WorkerPrivate* workerPrivate =
|
||||
workers::GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
|
||||
TimeDuration duration =
|
||||
mEvent->mTimeStamp - workerPrivate->NowBaseTimeStamp();
|
||||
mEvent->mTimeStamp - workerPrivate->CreationTimeStamp();
|
||||
return duration.ToMilliseconds();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ PerformanceTiming*
|
|||
PerformanceMainThread::Timing()
|
||||
{
|
||||
if (!mTiming) {
|
||||
// For navigation timing, the third argument (an nsIHtttpChannel) is null
|
||||
// For navigation timing, the third argument (an nsIHttpChannel) is null
|
||||
// since the cross-domain redirect were already checked. The last argument
|
||||
// (zero time) for performance.timing is the navigation start value.
|
||||
mTiming = new PerformanceTiming(this, mChannel, nullptr,
|
||||
|
|
|
|||
|
|
@ -41,13 +41,13 @@ PerformanceWorker::InsertUserEntry(PerformanceEntry* aEntry)
|
|||
TimeStamp
|
||||
PerformanceWorker::CreationTimeStamp() const
|
||||
{
|
||||
return mWorkerPrivate->NowBaseTimeStamp();
|
||||
return mWorkerPrivate->CreationTimeStamp();
|
||||
}
|
||||
|
||||
DOMHighResTimeStamp
|
||||
PerformanceWorker::CreationTime() const
|
||||
{
|
||||
return mWorkerPrivate->NowBaseTime();
|
||||
return mWorkerPrivate->CreationTime();
|
||||
}
|
||||
|
||||
} // dom namespace
|
||||
|
|
|
|||
|
|
@ -2419,8 +2419,6 @@ WorkerPrivateParent<Derived>::WorkerPrivateParent(
|
|||
MOZ_ASSERT_IF(mIsChromeWorker, mIsSecureContext);
|
||||
|
||||
MOZ_ASSERT(IsDedicatedWorker());
|
||||
mNowBaseTimeStamp = aParent->NowBaseTimeStamp();
|
||||
mNowBaseTimeHighRes = aParent->NowBaseTime();
|
||||
|
||||
if (aParent->mParentFrozen) {
|
||||
Freeze(nullptr);
|
||||
|
|
@ -2451,18 +2449,6 @@ WorkerPrivateParent<Derived>::WorkerPrivateParent(
|
|||
.creationOptions().setSecureContext(true);
|
||||
}
|
||||
|
||||
if (IsDedicatedWorker() && mLoadInfo.mWindow &&
|
||||
mLoadInfo.mWindow->GetPerformance()) {
|
||||
mNowBaseTimeStamp = mLoadInfo.mWindow->GetPerformance()->GetDOMTiming()->
|
||||
GetNavigationStartTimeStamp();
|
||||
mNowBaseTimeHighRes =
|
||||
mLoadInfo.mWindow->GetPerformance()->GetDOMTiming()->
|
||||
GetNavigationStartHighRes();
|
||||
} else {
|
||||
mNowBaseTimeStamp = CreationTimeStamp();
|
||||
mNowBaseTimeHighRes = CreationTime();
|
||||
}
|
||||
|
||||
// Our parent can get suspended after it initiates the async creation
|
||||
// of a new worker thread. In this case suspend the new worker as well.
|
||||
if (mLoadInfo.mWindow && mLoadInfo.mWindow->IsSuspended()) {
|
||||
|
|
|
|||
|
|
@ -216,8 +216,6 @@ private:
|
|||
WorkerType mWorkerType;
|
||||
TimeStamp mCreationTimeStamp;
|
||||
DOMHighResTimeStamp mCreationTimeHighRes;
|
||||
TimeStamp mNowBaseTimeStamp;
|
||||
DOMHighResTimeStamp mNowBaseTimeHighRes;
|
||||
|
||||
protected:
|
||||
// The worker is owned by its thread, which is represented here. This is set
|
||||
|
|
@ -579,16 +577,6 @@ public:
|
|||
return mCreationTimeHighRes;
|
||||
}
|
||||
|
||||
TimeStamp NowBaseTimeStamp() const
|
||||
{
|
||||
return mNowBaseTimeStamp;
|
||||
}
|
||||
|
||||
DOMHighResTimeStamp NowBaseTime() const
|
||||
{
|
||||
return mNowBaseTimeHighRes;
|
||||
}
|
||||
|
||||
nsIPrincipal*
|
||||
GetPrincipal() const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue