Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/performance/PerformanceWorker.cpp
Line
Count
Source (jump to first uncovered line)
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/. */
6
7
#include "PerformanceWorker.h"
8
#include "mozilla/dom/WorkerPrivate.h"
9
#include "mozilla/StaticPrefs.h"
10
11
namespace mozilla {
12
namespace dom {
13
14
PerformanceWorker::PerformanceWorker(WorkerPrivate* aWorkerPrivate)
15
  : Performance(aWorkerPrivate->UsesSystemPrincipal())
16
  , mWorkerPrivate(aWorkerPrivate)
17
0
{
18
0
  mWorkerPrivate->AssertIsOnWorkerThread();
19
0
}
20
21
PerformanceWorker::~PerformanceWorker()
22
0
{
23
0
  mWorkerPrivate->AssertIsOnWorkerThread();
24
0
}
25
26
void
27
PerformanceWorker::InsertUserEntry(PerformanceEntry* aEntry)
28
0
{
29
0
  if (StaticPrefs::dom_performance_enable_user_timing_logging()) {
30
0
    nsAutoCString uri;
31
0
    nsCOMPtr<nsIURI> scriptURI = mWorkerPrivate->GetResolvedScriptURI();
32
0
    if (!scriptURI || NS_FAILED(scriptURI->GetHost(uri))) {
33
0
      // If we have no URI, just put in "none".
34
0
      uri.AssignLiteral("none");
35
0
    }
36
0
    Performance::LogEntry(aEntry, uri);
37
0
  }
38
0
  Performance::InsertUserEntry(aEntry);
39
0
}
40
41
TimeStamp
42
PerformanceWorker::CreationTimeStamp() const
43
0
{
44
0
  return mWorkerPrivate->CreationTimeStamp();
45
0
}
46
47
DOMHighResTimeStamp
48
PerformanceWorker::CreationTime() const
49
0
{
50
0
  return mWorkerPrivate->CreationTime();
51
0
}
52
53
uint64_t
54
PerformanceWorker::GetRandomTimelineSeed()
55
0
{
56
0
  return mWorkerPrivate->GetRandomTimelineSeed();
57
0
}
58
59
} // dom namespace
60
} // mozilla namespace