Line data Source code
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 "WorkerPrivate.h"
9 :
10 : namespace mozilla {
11 : namespace dom {
12 :
13 : using namespace workers;
14 :
15 0 : PerformanceWorker::PerformanceWorker(WorkerPrivate* aWorkerPrivate)
16 0 : : mWorkerPrivate(aWorkerPrivate)
17 : {
18 0 : mWorkerPrivate->AssertIsOnWorkerThread();
19 0 : }
20 :
21 0 : PerformanceWorker::~PerformanceWorker()
22 : {
23 0 : mWorkerPrivate->AssertIsOnWorkerThread();
24 0 : }
25 :
26 : void
27 0 : PerformanceWorker::InsertUserEntry(PerformanceEntry* aEntry)
28 : {
29 0 : if (mWorkerPrivate->PerformanceLoggingEnabled()) {
30 0 : nsAutoCString uri;
31 0 : nsCOMPtr<nsIURI> scriptURI = mWorkerPrivate->GetResolvedScriptURI();
32 0 : if (!scriptURI || NS_FAILED(scriptURI->GetHost(uri))) {
33 : // If we have no URI, just put in "none".
34 0 : uri.AssignLiteral("none");
35 : }
36 0 : Performance::LogEntry(aEntry, uri);
37 : }
38 0 : Performance::InsertUserEntry(aEntry);
39 0 : }
40 :
41 : TimeStamp
42 0 : PerformanceWorker::CreationTimeStamp() const
43 : {
44 0 : return mWorkerPrivate->CreationTimeStamp();
45 : }
46 :
47 : DOMHighResTimeStamp
48 0 : PerformanceWorker::CreationTime() const
49 : {
50 0 : return mWorkerPrivate->CreationTime();
51 : }
52 :
53 : } // dom namespace
54 9 : } // mozilla namespace
|