2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-08-30 03:50:06 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2016-06-09 20:04:42 +03:00
|
|
|
#include "PerformanceWorker.h"
|
2014-08-30 03:50:06 +04:00
|
|
|
#include "WorkerPrivate.h"
|
|
|
|
|
2016-06-09 20:04:42 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
using namespace workers;
|
2014-08-30 03:50:06 +04:00
|
|
|
|
2016-06-09 20:04:42 +03:00
|
|
|
PerformanceWorker::PerformanceWorker(WorkerPrivate* aWorkerPrivate)
|
2014-08-30 03:50:06 +04:00
|
|
|
: mWorkerPrivate(aWorkerPrivate)
|
|
|
|
{
|
|
|
|
mWorkerPrivate->AssertIsOnWorkerThread();
|
|
|
|
}
|
|
|
|
|
2016-06-09 20:04:42 +03:00
|
|
|
PerformanceWorker::~PerformanceWorker()
|
2014-08-30 03:50:06 +04:00
|
|
|
{
|
|
|
|
mWorkerPrivate->AssertIsOnWorkerThread();
|
|
|
|
}
|
|
|
|
|
2015-07-28 19:33:37 +03:00
|
|
|
void
|
2016-06-09 20:04:42 +03:00
|
|
|
PerformanceWorker::InsertUserEntry(PerformanceEntry* aEntry)
|
2015-07-28 19:33:37 +03:00
|
|
|
{
|
|
|
|
if (mWorkerPrivate->PerformanceLoggingEnabled()) {
|
2015-08-21 00:34:22 +03:00
|
|
|
nsAutoCString uri;
|
|
|
|
nsCOMPtr<nsIURI> scriptURI = mWorkerPrivate->GetResolvedScriptURI();
|
|
|
|
if (!scriptURI || NS_FAILED(scriptURI->GetHost(uri))) {
|
|
|
|
// If we have no URI, just put in "none".
|
|
|
|
uri.AssignLiteral("none");
|
|
|
|
}
|
2016-06-09 20:04:42 +03:00
|
|
|
Performance::LogEntry(aEntry, uri);
|
2015-07-28 19:33:37 +03:00
|
|
|
}
|
2016-06-09 20:04:42 +03:00
|
|
|
Performance::InsertUserEntry(aEntry);
|
2015-07-28 19:33:37 +03:00
|
|
|
}
|
|
|
|
|
2015-11-19 17:04:47 +03:00
|
|
|
TimeStamp
|
2016-06-09 20:04:42 +03:00
|
|
|
PerformanceWorker::CreationTimeStamp() const
|
2015-05-25 19:53:07 +03:00
|
|
|
{
|
2016-12-16 11:07:39 +03:00
|
|
|
return mWorkerPrivate->CreationTimeStamp();
|
2015-11-19 17:04:47 +03:00
|
|
|
}
|
2015-05-25 19:53:07 +03:00
|
|
|
|
2015-11-19 17:04:47 +03:00
|
|
|
DOMHighResTimeStamp
|
2016-06-09 20:04:42 +03:00
|
|
|
PerformanceWorker::CreationTime() const
|
2015-11-19 17:04:47 +03:00
|
|
|
{
|
2016-12-16 11:07:39 +03:00
|
|
|
return mWorkerPrivate->CreationTime();
|
2015-05-25 19:53:07 +03:00
|
|
|
}
|
|
|
|
|
2016-06-09 20:04:42 +03:00
|
|
|
} // dom namespace
|
|
|
|
} // mozilla namespace
|