Bug 1313420 - Implement Performance.timeOrigin - part 1

https://hg.mozilla.org/mozilla-central/rev/cf0f72f0b0be
This commit is contained in:
janekptacijarabaci 2018-04-29 12:15:36 +02:00 committed by Roy Tam
commit ad947fb20a
6 changed files with 117 additions and 1 deletions

View file

@ -13,6 +13,7 @@
#include "PerformanceMeasure.h"
#include "PerformanceObserver.h"
#include "PerformanceResourceTiming.h"
#include "PerformanceService.h"
#include "PerformanceWorker.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/PerformanceBinding.h"
@ -119,6 +120,17 @@ Performance::Performance(nsPIDOMWindowInner* aWindow)
Performance::~Performance()
{}
DOMHighResTimeStamp
Performance::TimeOrigin()
{
if (!mPerformanceService) {
mPerformanceService = PerformanceService::GetOrCreate();
}
MOZ_ASSERT(mPerformanceService);
return mPerformanceService->TimeOrigin(CreationTimeStamp());
}
JSObject*
Performance::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
@ -243,7 +255,7 @@ Performance::ClearMarks(const Optional<nsAString>& aName)
DOMHighResTimeStamp
Performance::ResolveTimestampFromName(const nsAString& aName,
ErrorResult& aRv)
ErrorResult& aRv)
{
AutoTArray<RefPtr<PerformanceEntry>, 1> arr;
DOMHighResTimeStamp ts;