diff options
Diffstat (limited to 'dom')
-rwxr-xr-x | dom/performance/Performance.cpp | 7 | ||||
-rw-r--r-- | dom/performance/Performance.h | 2 | ||||
-rw-r--r-- | dom/performance/PerformanceMainThread.cpp | 6 | ||||
-rw-r--r-- | dom/performance/PerformanceMainThread.h | 3 | ||||
-rw-r--r-- | dom/performance/PerformanceWorker.cpp | 8 | ||||
-rw-r--r-- | dom/performance/PerformanceWorker.h | 3 | ||||
-rw-r--r-- | dom/performance/tests/test_timeOrigin.html | 4 |
7 files changed, 10 insertions, 23 deletions
diff --git a/dom/performance/Performance.cpp b/dom/performance/Performance.cpp index d1547dc06..8f6a61c85 100755 --- a/dom/performance/Performance.cpp +++ b/dom/performance/Performance.cpp @@ -121,6 +121,13 @@ Performance::~Performance() {} DOMHighResTimeStamp +Performance::Now() const +{ + TimeDuration duration = TimeStamp::Now() - CreationTimeStamp(); + return RoundTime(duration.ToMilliseconds()); +} + +DOMHighResTimeStamp Performance::TimeOrigin() { if (!mPerformanceService) { diff --git a/dom/performance/Performance.h b/dom/performance/Performance.h index 8495235a2..32c689c6e 100644 --- a/dom/performance/Performance.h +++ b/dom/performance/Performance.h @@ -68,7 +68,7 @@ public: void ClearResourceTimings(); - virtual DOMHighResTimeStamp Now() const = 0; + DOMHighResTimeStamp Now() const; DOMHighResTimeStamp TimeOrigin(); diff --git a/dom/performance/PerformanceMainThread.cpp b/dom/performance/PerformanceMainThread.cpp index d67c0c906..5eac15afd 100644 --- a/dom/performance/PerformanceMainThread.cpp +++ b/dom/performance/PerformanceMainThread.cpp @@ -105,12 +105,6 @@ PerformanceMainThread::Navigation() return mNavigation; } -DOMHighResTimeStamp -PerformanceMainThread::Now() const -{ - return RoundTime(GetDOMTiming()->TimeStampToDOMHighRes(TimeStamp::Now())); -} - /** * An entry should be added only after the resource is loaded. * This method is not thread safe and can only be called on the main thread. diff --git a/dom/performance/PerformanceMainThread.h b/dom/performance/PerformanceMainThread.h index fcaa6b903..c5f8887a4 100644 --- a/dom/performance/PerformanceMainThread.h +++ b/dom/performance/PerformanceMainThread.h @@ -23,9 +23,6 @@ public: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(PerformanceMainThread, Performance) - // Performance WebIDL methods - DOMHighResTimeStamp Now() const override; - virtual PerformanceTiming* Timing() override; virtual PerformanceNavigation* Navigation() override; diff --git a/dom/performance/PerformanceWorker.cpp b/dom/performance/PerformanceWorker.cpp index db9d6aa6e..17820d434 100644 --- a/dom/performance/PerformanceWorker.cpp +++ b/dom/performance/PerformanceWorker.cpp @@ -23,14 +23,6 @@ PerformanceWorker::~PerformanceWorker() mWorkerPrivate->AssertIsOnWorkerThread(); } -DOMHighResTimeStamp -PerformanceWorker::Now() const -{ - TimeDuration duration = - TimeStamp::Now() - mWorkerPrivate->NowBaseTimeStamp(); - return RoundTime(duration.ToMilliseconds()); -} - void PerformanceWorker::InsertUserEntry(PerformanceEntry* aEntry) { diff --git a/dom/performance/PerformanceWorker.h b/dom/performance/PerformanceWorker.h index 89bfea3ed..346bdd026 100644 --- a/dom/performance/PerformanceWorker.h +++ b/dom/performance/PerformanceWorker.h @@ -21,9 +21,6 @@ class PerformanceWorker final : public Performance public: explicit PerformanceWorker(workers::WorkerPrivate* aWorkerPrivate); - // Performance WebIDL methods - DOMHighResTimeStamp Now() const override; - virtual PerformanceTiming* Timing() override { MOZ_CRASH("This should not be called on workers."); diff --git a/dom/performance/tests/test_timeOrigin.html b/dom/performance/tests/test_timeOrigin.html index 73c5106f4..5a8a461f3 100644 --- a/dom/performance/tests/test_timeOrigin.html +++ b/dom/performance/tests/test_timeOrigin.html @@ -32,7 +32,7 @@ function testWorker() { { type: "text/javascript" }); var w = new Worker(URL.createObjectURL(blob)); w.onmessage = function(e) { - ok (e.data.now + e.data.timeOrigin > now + performance.timeOrigin, "Comparing worker.now and window.now"); + ok (e.now + e.timeOrigin > now + performance.now, "Comparing worker.now and window.now"); next(); } } @@ -44,7 +44,7 @@ function testSharedWorker() { { type: "text/javascript" }); var w = new SharedWorker(URL.createObjectURL(blob)); w.port.onmessage = function(e) { - ok (e.data.now + e.data.timeOrigin > now + performance.timeOrigin, "Comparing worker.now and window.now"); + ok (e.now + e.timeOrigin > now + performance.now, "Comparing worker.now and window.now"); next(); } } |