From ab961aeb54335fd07c66de2e3b8c3b6af6f89ea2 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 3 Sep 2018 10:11:38 +0200 Subject: Remove all C++ Telemetry Accumulation calls. This creates a number of stubs and leaves some surrounding code that may be irrelevant (eg. recorded time stamps, status variables). Stub resolution/removal should be a follow-up to this. --- dom/workers/WorkerRunnable.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'dom/workers/WorkerRunnable.cpp') diff --git a/dom/workers/WorkerRunnable.cpp b/dom/workers/WorkerRunnable.cpp index 6bbe40f66..9e6d4cfb8 100644 --- a/dom/workers/WorkerRunnable.cpp +++ b/dom/workers/WorkerRunnable.cpp @@ -15,7 +15,6 @@ #include "mozilla/DebugOnly.h" #include "mozilla/ErrorResult.h" #include "mozilla/dom/ScriptSettings.h" -#include "mozilla/Telemetry.h" #include "js/RootingAPI.h" #include "js/Value.h" @@ -572,8 +571,6 @@ WorkerMainThreadRunnable::Dispatch(Status aFailStatus, ErrorResult& aRv) { mWorkerPrivate->AssertIsOnWorkerThread(); - TimeStamp startTime = TimeStamp::NowLoRes(); - AutoSyncLoopHolder syncLoop(mWorkerPrivate, aFailStatus); mSyncLoopTarget = syncLoop.GetEventTarget(); @@ -590,11 +587,6 @@ WorkerMainThreadRunnable::Dispatch(Status aFailStatus, ErrorResult& aRv) if (!syncLoop.Run()) { aRv.ThrowUncatchableException(); } - - Telemetry::Accumulate(Telemetry::SYNC_WORKER_OPERATION, mTelemetryKey, - static_cast((TimeStamp::NowLoRes() - startTime) - .ToMilliseconds())); - Unused << startTime; // Shut the compiler up. } NS_IMETHODIMP -- cgit v1.2.3 From 0384dc34be59a77d74cc9a1f8e754694b95dd13a Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sun, 16 Sep 2018 11:43:06 +0200 Subject: Send worker-runnables destined for the main thread actually to the main thread. A case of "one queue too many" here. Instead of worker runnables being sent to the main thread where they are supposed to run, they are put in a task queue per-worker. This is devastating for performance if many workers are running. --- dom/workers/WorkerRunnable.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'dom/workers/WorkerRunnable.cpp') diff --git a/dom/workers/WorkerRunnable.cpp b/dom/workers/WorkerRunnable.cpp index 9e6d4cfb8..60d69d4e4 100644 --- a/dom/workers/WorkerRunnable.cpp +++ b/dom/workers/WorkerRunnable.cpp @@ -117,7 +117,10 @@ WorkerRunnable::DispatchInternal() return NS_SUCCEEDED(parent->Dispatch(runnable.forget())); } - return NS_SUCCEEDED(mWorkerPrivate->DispatchToMainThread(runnable.forget())); + nsCOMPtr mainThread = do_GetMainThread(); + MOZ_ASSERT(mainThread); + + return NS_SUCCEEDED(mainThread->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL)); } void @@ -553,7 +556,10 @@ WorkerControlRunnable::DispatchInternal() return NS_SUCCEEDED(parent->DispatchControlRunnable(runnable.forget())); } - return NS_SUCCEEDED(mWorkerPrivate->DispatchToMainThread(runnable.forget())); + nsCOMPtr mainThread = do_GetMainThread(); + MOZ_ASSERT(mainThread); + + return NS_SUCCEEDED(mainThread->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL)); } NS_IMPL_ISUPPORTS_INHERITED0(WorkerControlRunnable, WorkerRunnable) @@ -580,7 +586,10 @@ WorkerMainThreadRunnable::Dispatch(Status aFailStatus, ErrorResult& aRv) return; } - DebugOnly rv = mWorkerPrivate->DispatchToMainThread(this); + RefPtr runnable(this); + + DebugOnly rv = + NS_DispatchToMainThread(runnable.forget(), NS_DISPATCH_NORMAL); MOZ_ASSERT(NS_SUCCEEDED(rv), "Should only fail after xpcom-shutdown-threads and we're gone by then"); @@ -670,7 +679,7 @@ WorkerProxyToMainThreadRunnable::Dispatch() return false; } - if (NS_WARN_IF(NS_FAILED(mWorkerPrivate->DispatchToMainThread(this)))) { + if (NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(this)))) { ReleaseWorker(); RunBackOnWorkerThread(); return false; -- cgit v1.2.3