Bumping gaia.json for 4 gaia revision(s) a=gaia-bump
[gecko.git] / dom / workers / Performance.cpp
blob366e3abaf78eb4767930b9ae85be49340aae6d59
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "Performance.h"
6 #include "mozilla/dom/PerformanceBinding.h"
8 #include "WorkerPrivate.h"
10 BEGIN_WORKERS_NAMESPACE
12 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(Performance, AddRef)
13 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(Performance, Release)
15 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(Performance)
17 Performance::Performance(WorkerPrivate* aWorkerPrivate)
18 : mWorkerPrivate(aWorkerPrivate)
20 mWorkerPrivate->AssertIsOnWorkerThread();
23 Performance::~Performance()
25 mWorkerPrivate->AssertIsOnWorkerThread();
28 JSObject*
29 Performance::WrapObject(JSContext* aCx)
31 return PerformanceBinding_workers::Wrap(aCx, this);
34 double
35 Performance::Now() const
37 TimeDuration duration =
38 TimeStamp::Now() - mWorkerPrivate->NowBaseTimeStamp();
39 return duration.ToMilliseconds();
42 END_WORKERS_NAMESPACE