Skip to content

Commit

Permalink
Bug 1331804 - Add more runnable names (r=ehsan)
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 1QBmqfgY6WI
  • Loading branch information
bill-mccloskey committed Jan 24, 2017
1 parent 4391ca4 commit e67fda1
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 23 deletions.
3 changes: 2 additions & 1 deletion dom/workers/RuntimeService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,8 @@ class WorkerThreadPrimaryRunnable final : public Runnable

public:
explicit FinishedRunnable(already_AddRefed<WorkerThread> aThread)
: mThread(aThread)
: Runnable("WorkerThreadPrimaryRunnable::FinishedRunnable")
, mThread(aThread)
{
MOZ_ASSERT(mThread);
}
Expand Down
3 changes: 2 additions & 1 deletion ipc/glue/BackgroundImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,8 @@ class ChildImpl::OpenMainProcessActorRunnable final : public Runnable
OpenMainProcessActorRunnable(already_AddRefed<ChildImpl>&& aChildActor,
already_AddRefed<ParentImpl> aParentActor,
MessageLoop* aParentMessageLoop)
: mActor(aChildActor), mParentActor(aParentActor),
: Runnable("ChildImpl::OpenMainProcessActorRunnable"),
mActor(aChildActor), mParentActor(aParentActor),
mParentMessageLoop(aParentMessageLoop)
{
AssertIsOnMainThread();
Expand Down
8 changes: 8 additions & 0 deletions ipc/glue/MessageChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,14 @@ MessageChannel::RunMessage(MessageTask& aTask)

NS_IMPL_ISUPPORTS_INHERITED(MessageChannel::MessageTask, CancelableRunnable, nsIRunnablePriority)

MessageChannel::MessageTask::MessageTask(MessageChannel* aChannel, Message&& aMessage)
: CancelableRunnable(StringFromIPCMessageType(aMessage.type()))
, mChannel(aChannel)
, mMessage(Move(aMessage))
, mScheduled(false)
{
}

nsresult
MessageChannel::MessageTask::Run()
{
Expand Down
4 changes: 1 addition & 3 deletions ipc/glue/MessageChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,7 @@ class MessageChannel : HasResultCodes
public nsIRunnablePriority
{
public:
explicit MessageTask(MessageChannel* aChannel, Message&& aMessage)
: mChannel(aChannel), mMessage(Move(aMessage)), mScheduled(false)
{}
explicit MessageTask(MessageChannel* aChannel, Message&& aMessage);

NS_DECL_ISUPPORTS_INHERITED

Expand Down
3 changes: 2 additions & 1 deletion netwerk/base/nsTransportUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class nsTransportStatusEvent : public Runnable
nsresult status,
int64_t progress,
int64_t progressMax)
: mProxy(proxy)
: Runnable("nsTransportStatusEvent")
, mProxy(proxy)
, mTransport(transport)
, mStatus(status)
, mProgress(progress)
Expand Down
3 changes: 2 additions & 1 deletion netwerk/cache2/CacheEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ class CacheEntry final : public nsICacheEntry
public:
AvailableCallbackRunnable(CacheEntry* aEntry,
Callback const &aCallback)
: mEntry(aEntry)
: Runnable("CacheEntry::AvailableCallbackRunnable")
, mEntry(aEntry)
, mCallback(aCallback)
{}

Expand Down
3 changes: 2 additions & 1 deletion netwerk/dns/DNSListenerProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class DNSListenerProxy final
nsICancelable* aRequest,
nsIDNSRecord* aRecord,
nsresult aStatus)
: mListener(aListener)
: Runnable("DNSListenerProxy::OnLookupCompleteRunnable")
, mListener(aListener)
, mRequest(aRequest)
, mRecord(aRecord)
, mStatus(aStatus)
Expand Down
3 changes: 2 additions & 1 deletion parser/html/nsHtml5SVGLoadDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
using namespace mozilla;

nsHtml5SVGLoadDispatcher::nsHtml5SVGLoadDispatcher(nsIContent* aElement)
: mElement(aElement)
: Runnable("nsHtml5SVGLoadDispatcher")
, mElement(aElement)
, mDocument(mElement->OwnerDoc())
{
mDocument->BlockOnload();
Expand Down
9 changes: 6 additions & 3 deletions storage/mozStorageAsyncStatementExecution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class CallbackResultNotifier : public Runnable
CallbackResultNotifier(mozIStorageStatementCallback *aCallback,
mozIStorageResultSet *aResults,
AsyncExecuteStatements *aEventStatus) :
mCallback(aCallback)
Runnable("storage::CallbackResultNotifier")
, mCallback(aCallback)
, mResults(aResults)
, mEventStatus(aEventStatus)
{
Expand Down Expand Up @@ -93,7 +94,8 @@ class ErrorNotifier : public Runnable
ErrorNotifier(mozIStorageStatementCallback *aCallback,
mozIStorageError *aErrorObj,
AsyncExecuteStatements *aEventStatus) :
mCallback(aCallback)
Runnable("storage::ErrorNotifier")
, mCallback(aCallback)
, mErrorObj(aErrorObj)
, mEventStatus(aEventStatus)
{
Expand Down Expand Up @@ -133,7 +135,8 @@ class CompletionNotifier : public Runnable
*/
CompletionNotifier(mozIStorageStatementCallback *aCallback,
ExecutionState aReason)
: mCallback(aCallback)
: Runnable("storage::CompletionNotifier")
, mCallback(aCallback)
, mReason(aReason)
{
}
Expand Down
3 changes: 2 additions & 1 deletion storage/mozStorageConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ class AsyncInitializeClone final: public Runnable
Connection* aClone,
const bool aReadOnly,
mozIStorageCompletionCallback* aCallback)
: mConnection(aConnection)
: Runnable("storage::AsyncInitializeClone")
, mConnection(aConnection)
, mClone(aClone)
, mReadOnly(aReadOnly)
, mCallback(aCallback)
Expand Down
3 changes: 2 additions & 1 deletion storage/mozStorageConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ class CallbackComplete final : public Runnable
CallbackComplete(nsresult aStatus,
nsISupports* aValue,
already_AddRefed<mozIStorageCompletionCallback> aCallback)
: mStatus(aStatus)
: Runnable("storage::CallbackComplete")
, mStatus(aStatus)
, mValue(aValue)
, mCallback(aCallback)
{
Expand Down
2 changes: 1 addition & 1 deletion widget/nsBaseAppShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ nsBaseAppShell::DispatchDummyEvent(nsIThread* aTarget)
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");

if (!mDummyEvent)
mDummyEvent = new mozilla::Runnable();
mDummyEvent = new mozilla::Runnable("DummyEvent");

return NS_SUCCEEDED(aTarget->Dispatch(mDummyEvent, NS_DISPATCH_NORMAL));
}
Expand Down
9 changes: 6 additions & 3 deletions xpcom/io/nsStreamUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class nsInputStreamReadyEvent final

nsInputStreamReadyEvent(nsIInputStreamCallback* aCallback,
nsIEventTarget* aTarget)
: mCallback(aCallback)
: CancelableRunnable("nsInputStreamReadyEvent")
, mCallback(aCallback)
, mTarget(aTarget)
{
}
Expand Down Expand Up @@ -128,7 +129,8 @@ class nsOutputStreamReadyEvent final

nsOutputStreamReadyEvent(nsIOutputStreamCallback* aCallback,
nsIEventTarget* aTarget)
: mCallback(aCallback)
: CancelableRunnable("nsOutputStreamReadyEvent")
, mCallback(aCallback)
, mTarget(aTarget)
{
}
Expand Down Expand Up @@ -241,7 +243,8 @@ class nsAStreamCopier
NS_DECL_ISUPPORTS_INHERITED

nsAStreamCopier()
: mLock("nsAStreamCopier.mLock")
: CancelableRunnable("nsAStreamCopier")
, mLock("nsAStreamCopier.mLock")
, mCallback(nullptr)
, mProgressCallback(nullptr)
, mClosure(nullptr)
Expand Down
2 changes: 1 addition & 1 deletion xpcom/threads/nsProxyRelease.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ProxyReleaseEvent : public mozilla::Runnable
{
public:
explicit ProxyReleaseEvent(already_AddRefed<T> aDoomed)
: mDoomed(aDoomed.take()) {}
: Runnable("ProxyReleaseEvent"), mDoomed(aDoomed.take()) {}

NS_IMETHOD Run() override
{
Expand Down
9 changes: 6 additions & 3 deletions xpcom/threads/nsThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ class nsThreadStartupEvent : public Runnable
{
public:
nsThreadStartupEvent()
: mMon("nsThreadStartupEvent.mMon")
: Runnable("nsThreadStartupEvent")
, mMon("nsThreadStartupEvent.mMon")
, mInitialized(false)
{
}
Expand Down Expand Up @@ -334,7 +335,8 @@ class nsThreadShutdownAckEvent : public CancelableRunnable
{
public:
explicit nsThreadShutdownAckEvent(NotNull<nsThreadShutdownContext*> aCtx)
: mShutdownContext(aCtx)
: CancelableRunnable("nsThreadShutdownAckEvent")
, mShutdownContext(aCtx)
{
}
NS_IMETHOD Run() override
Expand All @@ -358,7 +360,8 @@ class nsThreadShutdownEvent : public Runnable
public:
nsThreadShutdownEvent(NotNull<nsThread*> aThr,
NotNull<nsThreadShutdownContext*> aCtx)
: mThread(aThr)
: Runnable("nsThreadShutdownEvent")
, mThread(aThr)
, mShutdownContext(aCtx)
{
}
Expand Down
6 changes: 5 additions & 1 deletion xpcom/threads/nsThreadUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ Runnable::GetName(nsACString& aName)
#ifdef RELEASE_OR_BETA
aName.Truncate();
#else
aName.AssignASCII(mName);
if (mName) {
aName.AssignASCII(mName);
} else {
aName.Truncate();
}
#endif
return NS_OK;
}
Expand Down
7 changes: 7 additions & 0 deletions xpcom/threads/nsThreadUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ class Runnable : public nsIRunnable, public nsINamed

Runnable() {}

#ifdef RELEASE_OR_BETA
explicit Runnable(const char* aName) {}
#else
explicit Runnable(const char* aName) : mName(aName) {}
#endif

protected:
virtual ~Runnable() {}
private:
Expand All @@ -259,6 +265,7 @@ class CancelableRunnable : public Runnable,
virtual nsresult Cancel() override;

CancelableRunnable() {}
explicit CancelableRunnable(const char* aName) : Runnable(aName) {}

protected:
virtual ~CancelableRunnable() {}
Expand Down

0 comments on commit e67fda1

Please sign in to comment.