Bug 1472338: part 2) Change `clipboard.readText()` to read from the clipboard asynchr...
[gecko.git] / dom / performance / PerformanceWorker.cpp
blob4940a530ae4d792be18c0c90c3f6b476f6b0c637
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "PerformanceWorker.h"
8 #include "mozilla/dom/WorkerScope.h"
9 #include "mozilla/StaticPrefs_dom.h"
11 namespace mozilla::dom {
13 PerformanceWorker::PerformanceWorker(WorkerPrivate* aWorkerPrivate)
14 : Performance(aWorkerPrivate->GlobalScope(),
15 aWorkerPrivate->UsesSystemPrincipal()),
16 mWorkerPrivate(aWorkerPrivate) {
17 mWorkerPrivate->AssertIsOnWorkerThread();
20 PerformanceWorker::~PerformanceWorker() {
21 mWorkerPrivate->AssertIsOnWorkerThread();
24 void PerformanceWorker::InsertUserEntry(PerformanceEntry* aEntry) {
25 if (StaticPrefs::dom_performance_enable_user_timing_logging()) {
26 nsAutoCString uri;
27 nsCOMPtr<nsIURI> scriptURI = mWorkerPrivate->GetResolvedScriptURI();
28 if (!scriptURI || NS_FAILED(scriptURI->GetHost(uri))) {
29 // If we have no URI, just put in "none".
30 uri.AssignLiteral("none");
32 Performance::LogEntry(aEntry, uri);
34 Performance::InsertUserEntry(aEntry);
37 TimeStamp PerformanceWorker::CreationTimeStamp() const {
38 return mWorkerPrivate->CreationTimeStamp();
41 DOMHighResTimeStamp PerformanceWorker::CreationTime() const {
42 return mWorkerPrivate->CreationTime();
45 uint64_t PerformanceWorker::GetRandomTimelineSeed() {
46 return mWorkerPrivate->GetRandomTimelineSeed();
49 bool PerformanceWorker::CrossOriginIsolated() const {
50 return mWorkerPrivate->CrossOriginIsolated();
53 } // namespace mozilla::dom