Bug 1322292 - Some fixes for the Performance API in workers - part 3 - TimeStampToDOMHighRes() in workerPrivate, r=bz
This commit is contained in:
@@ -1335,10 +1335,7 @@ Console::MethodInternal(JSContext* aCx, MethodName aMethodName,
|
||||
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
|
||||
TimeDuration duration =
|
||||
mozilla::TimeStamp::Now() - workerPrivate->CreationTimeStamp();
|
||||
|
||||
monotonicTimer = duration.ToMilliseconds();
|
||||
monotonicTimer = workerPrivate->TimeStampToDOMHighRes(TimeStamp::Now());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1094,15 +1094,11 @@ Event::TimeStamp() const
|
||||
return perf->GetDOMTiming()->TimeStampToDOMHighRes(mEvent->mTimeStamp);
|
||||
}
|
||||
|
||||
// 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->CreationTimeStamp();
|
||||
return duration.ToMilliseconds();
|
||||
return workerPrivate->TimeStampToDOMHighRes(mEvent->mTimeStamp);
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -572,6 +572,13 @@ public:
|
||||
return mCreationTimeHighRes;
|
||||
}
|
||||
|
||||
DOMHighResTimeStamp TimeStampToDOMHighRes(const TimeStamp& aTimeStamp) const
|
||||
{
|
||||
MOZ_ASSERT(!aTimeStamp.IsNull());
|
||||
TimeDuration duration = aTimeStamp - mCreationTimeStamp;
|
||||
return duration.ToMilliseconds();
|
||||
}
|
||||
|
||||
nsIPrincipal*
|
||||
GetPrincipal() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user