summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-29 12:32:19 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-29 12:32:19 +0200
commit089a0bd9a4dace03e5800878055b86854eee5002 (patch)
tree397cdb4e36128e6d80e71db3cb18588b1147aab8 /dom
parent85a83305dd0caeb484687cf511f81024a683338b (diff)
downloadUXP-089a0bd9a4dace03e5800878055b86854eee5002.tar
UXP-089a0bd9a4dace03e5800878055b86854eee5002.tar.gz
UXP-089a0bd9a4dace03e5800878055b86854eee5002.tar.lz
UXP-089a0bd9a4dace03e5800878055b86854eee5002.tar.xz
UXP-089a0bd9a4dace03e5800878055b86854eee5002.zip
Bug 1322292 - Some fixes for the Performance API in workers - part 2 - Get rid of NowBaseTimeStamp()
https://hg.mozilla.org/mozilla-central/rev/301231f4165a
Diffstat (limited to 'dom')
-rwxr-xr-xdom/console/Console.cpp2
-rw-r--r--dom/console/Console.h10
-rwxr-xr-xdom/events/Event.cpp7
-rw-r--r--dom/performance/PerformanceMainThread.cpp2
-rw-r--r--dom/performance/PerformanceWorker.cpp4
-rw-r--r--dom/workers/WorkerPrivate.cpp14
-rw-r--r--dom/workers/WorkerPrivate.h12
7 files changed, 11 insertions, 40 deletions
diff --git a/dom/console/Console.cpp b/dom/console/Console.cpp
index 79e3eadc5..1ecf1f7fd 100755
--- a/dom/console/Console.cpp
+++ b/dom/console/Console.cpp
@@ -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());
}
diff --git a/dom/console/Console.h b/dom/console/Console.h
index b334d79f9..2f375c8eb 100644
--- a/dom/console/Console.h
+++ b/dom/console/Console.h
@@ -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
diff --git a/dom/events/Event.cpp b/dom/events/Event.cpp
index 7e19cd74d..4e39675da 100755
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -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();
}
diff --git a/dom/performance/PerformanceMainThread.cpp b/dom/performance/PerformanceMainThread.cpp
index 5eac15afd..5c259cfb8 100644
--- a/dom/performance/PerformanceMainThread.cpp
+++ b/dom/performance/PerformanceMainThread.cpp
@@ -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,
diff --git a/dom/performance/PerformanceWorker.cpp b/dom/performance/PerformanceWorker.cpp
index 17820d434..f10c58446 100644
--- a/dom/performance/PerformanceWorker.cpp
+++ b/dom/performance/PerformanceWorker.cpp
@@ -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
diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
index bd8a33032..8848e881a 100644
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -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()) {
diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h
index 465c0f9a3..e15beb955 100644
--- a/dom/workers/WorkerPrivate.h
+++ b/dom/workers/WorkerPrivate.h
@@ -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
{