Bug 1193414 - Telemetry for SharedWorker spawning. r=bkelly

This commit is contained in:
Andrea Marchesini 2015-08-12 06:00:00 -04:00
Родитель 2f345eb8e0
Коммит a2c5d2836e
2 изменённых файлов: 12 добавлений и 7 удалений

Просмотреть файл

@ -1457,9 +1457,8 @@ RuntimeService::RegisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
Telemetry::Accumulate(Telemetry::SERVICE_WORKER_SPAWN_ATTEMPTS, 1);
}
bool isSharedOrServiceWorker = aWorkerPrivate->IsSharedWorker() ||
aWorkerPrivate->IsServiceWorker();
if (isSharedOrServiceWorker) {
const bool isSharedWorker = aWorkerPrivate->IsSharedWorker();
if (isSharedWorker || isServiceWorker) {
AssertIsOnMainThread();
nsCOMPtr<nsIURI> scriptURI = aWorkerPrivate->GetResolvedScriptURI();
@ -1476,7 +1475,7 @@ RuntimeService::RegisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
}
bool exemptFromPerDomainMax = false;
if (aWorkerPrivate->IsServiceWorker()) {
if (isServiceWorker) {
AssertIsOnMainThread();
exemptFromPerDomainMax = Preferences::GetBool("dom.serviceWorkers.exemptFromPerDomainMax",
false);
@ -1504,7 +1503,7 @@ RuntimeService::RegisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
if (queued) {
domainInfo->mQueuedWorkers.AppendElement(aWorkerPrivate);
if (isServiceWorker) {
if (isServiceWorker || isSharedWorker) {
AssertIsOnMainThread();
// ServiceWorker spawn gets queued due to hitting max workers per domain
// limit so let's log a warning.
@ -1515,7 +1514,8 @@ RuntimeService::RegisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
aWorkerPrivate->GetDocument(),
nsContentUtils::eDOM_PROPERTIES,
"HittingMaxWorkersPerDomain");
Telemetry::Accumulate(Telemetry::SERVICE_WORKER_SPAWN_GETS_QUEUED, 1);
Telemetry::Accumulate(isSharedWorker ? Telemetry::SHARED_WORKER_SPAWN_GETS_QUEUED
: Telemetry::SERVICE_WORKER_SPAWN_GETS_QUEUED, 1);
}
}
else if (parent) {
@ -1528,7 +1528,7 @@ RuntimeService::RegisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
domainInfo->mActiveWorkers.AppendElement(aWorkerPrivate);
}
if (isSharedOrServiceWorker) {
if (isSharedWorker || isServiceWorker) {
const nsCString& sharedWorkerName = aWorkerPrivate->SharedWorkerName();
const nsCString& cacheName =
aWorkerPrivate->IsServiceWorker() ?

Просмотреть файл

@ -8520,6 +8520,11 @@
"kind": "count",
"description": "Tracking whether a ServiceWorker spawn gets queued due to hitting max workers per domain limit. File bugs in Core::DOM in case of a Telemetry regression."
},
"SHARED_WORKER_SPAWN_GETS_QUEUED": {
"expires_in_version": "50",
"kind": "count",
"description": "Tracking whether a SharedWorker spawn gets queued due to hitting max workers per domain limit. File bugs in Core::DOM in case of a Telemetry regression."
},
"SERVICE_WORKER_REGISTRATIONS": {
"expires_in_version": "50",
"kind": "count",