From cf9eef1ea4de1cb12717e7d8c1d0aeda7d50abc1 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Wed, 18 Jan 2017 14:01:05 -0800 Subject: [PATCH] Bug 1331804 - Give runnable names to some generic dispatch sites (r=ehsan) MozReview-Commit-ID: 83IL5zcor1W --- dom/workers/WorkerPrivate.cpp | 6 +++++- xpcom/threads/nsTimerImpl.cpp | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 73479aa92dee..b5e5d66e476c 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -4747,7 +4747,11 @@ nsresult WorkerPrivate::DispatchToMainThread(already_AddRefed aRunnable, uint32_t aFlags) { - return mMainThreadEventTarget->Dispatch(Move(aRunnable), aFlags); + nsCOMPtr runnable = aRunnable; + if (nsCOMPtr named = do_QueryInterface(runnable)) { + named->SetName("WorkerRunnable"); + } + return mMainThreadEventTarget->Dispatch(runnable.forget(), aFlags); } void diff --git a/xpcom/threads/nsTimerImpl.cpp b/xpcom/threads/nsTimerImpl.cpp index 4f8688c97baf..df19614afc29 100644 --- a/xpcom/threads/nsTimerImpl.cpp +++ b/xpcom/threads/nsTimerImpl.cpp @@ -663,24 +663,28 @@ nsTimerImpl::GetName(nsACString& aName) aName.Assign(buf); } else { MOZ_ASSERT(mName.is()); - aName.Truncate(); + aName.AssignLiteral("Anonymous callback timer"); } break; case CallbackType::Interface: if (nsCOMPtr named = do_QueryInterface(mCallback.i)) { named->GetName(aName); + } else { + aName.AssignLiteral("Anonymous interface timer"); } break; case CallbackType::Observer: if (nsCOMPtr named = do_QueryInterface(mCallback.o)) { named->GetName(aName); + } else { + aName.AssignLiteral("Anonymous observer timer"); } break; case CallbackType::Unknown: - aName.Truncate(); + aName.AssignLiteral("Anonymous timer"); break; } }