Bug 1339289 - Give names to a lot of common runnables (r=ehsan)

MozReview-Commit-ID: 5IdvK6kgoAW
This commit is contained in:
Bill McCloskey 2017-02-10 22:11:48 -08:00
Родитель ce7bbe01fe
Коммит 194043ae97
32 изменённых файлов: 84 добавлений и 40 удалений

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

@ -48,7 +48,8 @@ class NotifyChannelActiveRunnable final : public Runnable
public:
NotifyChannelActiveRunnable(uint64_t aWindowID, AudioChannel aAudioChannel,
bool aActive)
: mWindowID(aWindowID)
: Runnable("NotifyChannelActiveRunnable")
, mWindowID(aWindowID)
, mAudioChannel(aAudioChannel)
, mActive(aActive)
{}

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

@ -1237,6 +1237,7 @@ class ContentUnbinder : public Runnable
{
public:
ContentUnbinder()
: Runnable("ContentUnbinder")
{
mLast = this;
}

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

@ -184,7 +184,7 @@ nsAsyncInstantiateEvent::Run()
class CheckPluginStopEvent : public Runnable {
public:
explicit CheckPluginStopEvent(nsObjectLoadingContent* aContent)
: mContent(aContent) {}
: Runnable("CheckPluginStopEvent"), mContent(aContent) {}
~CheckPluginStopEvent() override = default;

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

@ -218,8 +218,10 @@ private:
eChangeEventType_CompositionEventHandled
};
explicit AChangeEvent(IMEContentObserver* aIMEContentObserver)
: mIMEContentObserver(aIMEContentObserver)
explicit AChangeEvent(const char* aName,
IMEContentObserver* aIMEContentObserver)
: Runnable(aName)
, mIMEContentObserver(aIMEContentObserver)
{
MOZ_ASSERT(mIMEContentObserver);
}
@ -241,7 +243,7 @@ private:
{
public:
explicit IMENotificationSender(IMEContentObserver* aIMEContentObserver)
: AChangeEvent(aIMEContentObserver)
: AChangeEvent("IMENotificationSender", aIMEContentObserver)
, mIsRunning(false)
{
}

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

@ -297,7 +297,8 @@ class TabChild::DelayedDeleteRunnable final
public:
explicit DelayedDeleteRunnable(TabChild* aTabChild)
: mTabChild(aTabChild)
: Runnable("TabChild::DelayedDeleteRunnable")
, mTabChild(aTabChild)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aTabChild);

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

@ -864,7 +864,8 @@ ChannelMediaResource::CacheClientNotifyDataReceived()
return;
mDataReceivedEvent =
NewNonOwningRunnableMethod(this, &ChannelMediaResource::DoNotifyDataReceived);
NewNonOwningRunnableMethod("ChannelMediaResource::DoNotifyDataReceived",
this, &ChannelMediaResource::DoNotifyDataReceived);
NS_DispatchToMainThread(mDataReceivedEvent.get());
}

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

@ -1626,7 +1626,8 @@ class MediaStreamGraphStableStateRunnable : public Runnable {
public:
explicit MediaStreamGraphStableStateRunnable(MediaStreamGraphImpl* aGraph,
bool aSourceIsMSG)
: mGraph(aGraph)
: Runnable("MediaStreamGraphStableStateRunnable")
, mGraph(aGraph)
, mSourceIsMSG(aSourceIsMSG)
{
}

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

@ -180,7 +180,10 @@ class StorageNotifierRunnable : public Runnable
public:
StorageNotifierRunnable(nsISupports* aSubject, const char16_t* aType,
bool aPrivateBrowsing)
: mSubject(aSubject), mType(aType), mPrivateBrowsing(aPrivateBrowsing)
: Runnable("StorageNotifierRunnable")
, mSubject(aSubject)
, mType(aType)
, mPrivateBrowsing(aPrivateBrowsing)
{ }
NS_DECL_NSIRUNNABLE

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

@ -351,7 +351,8 @@ void
nsBindingManager::PostProcessAttachedQueueEvent()
{
mProcessAttachedQueueEvent =
NewRunnableMethod(this, &nsBindingManager::DoProcessAttachedQueue);
NewRunnableMethod("nsBindingManager::DoProcessAttachedQueue",
this, &nsBindingManager::DoProcessAttachedQueue);
nsresult rv = NS_DispatchToCurrentThread(mProcessAttachedQueueEvent);
if (NS_SUCCEEDED(rv) && mDocument) {
mDocument->BlockOnload();

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

@ -142,7 +142,9 @@ ClientLayerManager::Destroy()
RefPtr<TransactionIdAllocator> allocator = mTransactionIdAllocator;
uint64_t id = mLatestTransactionId;
RefPtr<Runnable> task = NS_NewRunnableFunction([allocator, id] () -> void {
RefPtr<Runnable> task = NS_NewRunnableFunction(
"TransactionIdAllocator::NotifyTransactionCompleted",
[allocator, id] () -> void {
allocator->NotifyTransactionCompleted(id);
});
NS_DispatchToMainThread(task.forget());

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

@ -65,7 +65,8 @@ public:
{
// Threads have to be shut down from another thread, so we'll ask the
// main thread to do it for us.
NS_DispatchToMainThread(NewRunnableMethod(aThisThread, &nsIThread::Shutdown));
NS_DispatchToMainThread(NewRunnableMethod("DecodePoolImpl::ShutdownThread",
aThisThread, &nsIThread::Shutdown));
}
/**

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

@ -50,7 +50,9 @@ IDecodingTask::NotifyProgress(NotNull<RasterImage*> aImage,
// We're forced to notify asynchronously.
NotNull<RefPtr<RasterImage>> image = aImage;
NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void {
NS_DispatchToMainThread(NS_NewRunnableFunction(
"IDecodingTask::NotifyProgress",
[=]() -> void {
image->NotifyProgress(progress, invalidRect, frameCount,
decoderFlags, surfaceFlags);
}));
@ -83,7 +85,9 @@ IDecodingTask::NotifyDecodeComplete(NotNull<RasterImage*> aImage,
// We're forced to notify asynchronously.
NotNull<RefPtr<RasterImage>> image = aImage;
NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void {
NS_DispatchToMainThread(NS_NewRunnableFunction(
"IDecodingTask::NotifyDecodeComplete",
[=]() -> void {
image->NotifyDecodeComplete(finalStatus, metadata, telemetry, progress,
invalidRect, frameCount, decoderFlags,
surfaceFlags);

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

@ -123,7 +123,8 @@ class AsyncNotifyRunnable : public Runnable
public:
AsyncNotifyRunnable(ProgressTracker* aTracker,
IProgressObserver* aObserver)
: mTracker(aTracker)
: Runnable("ProgressTracker::AsyncNotifyRunnable")
, mTracker(aTracker)
{
MOZ_ASSERT(NS_IsMainThread(), "Should be created on the main thread");
MOZ_ASSERT(aTracker, "aTracker should not be null");

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

@ -424,7 +424,8 @@ RasterImage::OnSurfaceDiscarded()
{
MOZ_ASSERT(mProgressTracker);
NS_DispatchToMainThread(NewRunnableMethod(mProgressTracker, &ProgressTracker::OnDiscard));
NS_DispatchToMainThread(NewRunnableMethod("ProgressTracker::OnDiscard",
mProgressTracker, &ProgressTracker::OnDiscard));
}
//******************************************************************************

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

@ -999,7 +999,9 @@ VectorImage::CreateSurfaceAndShow(const SVGDrawingParameters& aParams, BackendTy
GetMaxSizedIntRect());
} else {
NotNull<RefPtr<VectorImage>> image = WrapNotNull(this);
NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void {
NS_DispatchToMainThread(NS_NewRunnableFunction(
"ProgressTracker::SyncNotifyProgress",
[=]() -> void {
RefPtr<ProgressTracker> tracker = image->GetProgressTracker();
if (tracker) {
tracker->SyncNotifyProgress(FLAG_FRAME_COMPLETE,

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

@ -349,7 +349,8 @@ imgRequestProxy::CancelAndForgetObserver(nsresult aStatus)
mIsInLoadGroup = oldIsInLoadGroup;
if (mIsInLoadGroup) {
NS_DispatchToCurrentThread(NewRunnableMethod(this, &imgRequestProxy::DoRemoveFromLoadGroup));
NS_DispatchToCurrentThread(NewRunnableMethod("imgRequestProxy::DoRemoveFromLoadGroup",
this, &imgRequestProxy::DoRemoveFromLoadGroup));
}
NullOutListener();

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

@ -142,7 +142,7 @@ protected:
{
public:
imgCancelRunnable(imgRequestProxy* owner, nsresult status)
: mOwner(owner), mStatus(status)
: Runnable("imgCancelRunnable"), mOwner(owner), mStatus(status)
{ }
NS_IMETHOD Run() override {

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

@ -179,7 +179,11 @@ public:
}
}
AsyncFreeSnowWhite() : mContinuation(false), mActive(false), mPurge(false) {}
AsyncFreeSnowWhite()
: Runnable("AsyncFreeSnowWhite")
, mContinuation(false)
, mActive(false)
, mPurge(false) {}
public:
bool mContinuation;
@ -3609,7 +3613,7 @@ XPCJSContext::BeforeProcessTask(bool aMightBlock)
// "while (condition) thread.processNextEvent(true)", in case the
// condition is triggered here by a Promise "then" callback.
NS_DispatchToMainThread(new Runnable());
NS_DispatchToMainThread(new Runnable("Empty_microtask_runnable"));
}
}

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

@ -2035,7 +2035,8 @@ PresShell::ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight, nscoord a
}
} else {
RefPtr<nsRunnableMethod<PresShell> > resizeEvent =
NewRunnableMethod(this, &PresShell::FireResizeEvent);
NewRunnableMethod("PresShell::FireResizeEvent",
this, &PresShell::FireResizeEvent);
if (NS_SUCCEEDED(NS_DispatchToCurrentThread(resizeEvent))) {
mResizeEvent = resizeEvent;
SetNeedStyleFlush();
@ -6246,7 +6247,8 @@ PresShell::ScheduleApproximateFrameVisibilityUpdateNow()
}
RefPtr<nsRunnableMethod<PresShell> > ev =
NewRunnableMethod(this, &PresShell::UpdateApproximateFrameVisibility);
NewRunnableMethod("PresShell::UpdateApproximateFrameVisibility",
this, &PresShell::UpdateApproximateFrameVisibility);
if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) {
mUpdateApproximateFrameVisibilityEvent = ev;
}

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

@ -455,7 +455,7 @@ class nsDocumentShownDispatcher : public Runnable
{
public:
explicit nsDocumentShownDispatcher(nsCOMPtr<nsIDocument> aDocument)
: mDocument(aDocument) {}
: Runnable("nsDocumentShownDispatcher"), mDocument(aDocument) {}
NS_IMETHOD Run() override;

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

@ -119,7 +119,8 @@ class CharSetChangingRunnable : public Runnable
public:
CharSetChangingRunnable(nsPresContext* aPresContext,
const nsCString& aCharSet)
: mPresContext(aPresContext),
: Runnable("CharSetChangingRunnable"),
mPresContext(aPresContext),
mCharSet(aCharSet)
{
}
@ -2089,7 +2090,8 @@ nsPresContext::PostMediaFeatureValuesChangedEvent()
// need to track whether it's been added).
if (!mPendingMediaFeatureValuesChanged && mShell) {
nsCOMPtr<nsIRunnable> ev =
NewRunnableMethod(this, &nsPresContext::HandleMediaFeatureValuesChangedEvent);
NewRunnableMethod("nsPresContext::HandleMediaFeatureValuesChangedEvent",
this, &nsPresContext::HandleMediaFeatureValuesChangedEvent);
if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) {
mPendingMediaFeatureValuesChanged = true;
mShell->SetNeedStyleFlush();
@ -2281,7 +2283,8 @@ nsPresContext::RebuildCounterStyles()
}
if (!mPostedFlushCounterStyles) {
nsCOMPtr<nsIRunnable> ev =
NewRunnableMethod(this, &nsPresContext::HandleRebuildCounterStyles);
NewRunnableMethod("nsPresContext::HandleRebuildCounterStyles",
this, &nsPresContext::HandleRebuildCounterStyles);
if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) {
mPostedFlushCounterStyles = true;
}

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

@ -1585,7 +1585,9 @@ protected:
class RunWillPaintObservers : public mozilla::Runnable {
public:
explicit RunWillPaintObservers(nsRootPresContext* aPresContext) : mPresContext(aPresContext) {}
explicit RunWillPaintObservers(nsRootPresContext* aPresContext)
: Runnable("nsPresContextType::RunWillPaintObservers")
, mPresContext(aPresContext) {}
void Revoke() { mPresContext = nullptr; }
NS_IMETHOD Run() override
{

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

@ -28,7 +28,9 @@ using namespace mozilla;
namespace {
class ShortTermURISpecCache : public Runnable {
public:
ShortTermURISpecCache() : mPending(false) {}
ShortTermURISpecCache()
: Runnable("ShortTermURISpecCache")
, mPending(false) {}
nsString const& GetSpec(nsIURI* aURI) {
if (mURI != aURI) {

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

@ -1468,7 +1468,8 @@ FontFaceSet::OnFontFaceStatusChanged(FontFace* aFontFace)
if (!mDelayedLoadCheck) {
mDelayedLoadCheck = true;
nsCOMPtr<nsIRunnable> checkTask =
NewRunnableMethod(this, &FontFaceSet::CheckLoadingFinishedAfterDelay);
NewRunnableMethod("FontFaceSet::CheckLoadingFinishedAfterDelay",
this, &FontFaceSet::CheckLoadingFinishedAfterDelay);
NS_DispatchToMainThread(checkTask);
}
}

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

@ -29,8 +29,9 @@ class nsAsyncVerifyRedirectCallbackEvent : public Runnable {
public:
nsAsyncVerifyRedirectCallbackEvent(nsIAsyncVerifyRedirectCallback *cb,
nsresult result)
: mCallback(cb), mResult(result) {
}
: Runnable("nsAsyncVerifyRedirectCallbackEvent")
, mCallback(cb)
, mResult(result) {}
NS_IMETHOD Run() override
{

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

@ -37,7 +37,8 @@ class FinalizationEvent final: public Runnable
public:
FinalizationEvent(const char* aTopic,
const char16_t* aValue)
: mTopic(aTopic)
: Runnable("FinalizationEvent")
, mTopic(aTopic)
, mValue(aValue)
{ }

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

@ -315,7 +315,8 @@ private:
class PaintTask : public Runnable {
public:
NS_DECL_NSIRUNNABLE
explicit PaintTask(PuppetWidget* widget) : mWidget(widget) {}
explicit PaintTask(PuppetWidget* widget)
: Runnable("PuppetWidget::PaintTask"), mWidget(widget) {}
void Revoke() { mWidget = nullptr; }
private:
PuppetWidget* mWidget;

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

@ -1479,7 +1479,8 @@ CycleCollectedJSContext::RunInMetastableState(already_AddRefed<nsIRunnable>&& aR
IncrementalFinalizeRunnable::IncrementalFinalizeRunnable(CycleCollectedJSContext* aCx,
DeferredFinalizerTable& aFinalizers)
: mContext(aCx)
: Runnable("IncrementalFinalizeRunnable")
, mContext(aCx)
, mFinalizeFunctionToRun(0)
, mReleasing(false)
{

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

@ -20,7 +20,7 @@ class DebuggerOnGCRunnable : public CancelableRunnable
JS::dbg::GarbageCollectionEvent::Ptr mGCData;
explicit DebuggerOnGCRunnable(JS::dbg::GarbageCollectionEvent::Ptr&& aGCData)
: mGCData(Move(aGCData))
: CancelableRunnable("DebuggerOnGCRunnable"), mGCData(Move(aGCData))
{ }
public:

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

@ -482,7 +482,8 @@ public:
CategoryNotificationRunnable(nsISupports* aSubject,
const char* aTopic,
const char* aData)
: mSubject(aSubject)
: Runnable("CategoryNotificationRunnable")
, mSubject(aSubject)
, mTopic(aTopic)
, mData(aData)
{

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

@ -205,7 +205,8 @@ class ThrottledEventQueue::Inner final : public nsIObserver
// of the method in order to wait for the event to finish running.
if (shouldShutdown) {
MOZ_ASSERT(IsEmpty());
NS_DispatchToMainThread(NewRunnableMethod(this, &Inner::ShutdownComplete));
NS_DispatchToMainThread(NewRunnableMethod("ThrottledEventQueue::Inner::ShutdownComplete",
this, &Inner::ShutdownComplete));
}
}
@ -283,7 +284,8 @@ public:
}
// The queue is empty, so we can complete immediately.
NS_DispatchToMainThread(NewRunnableMethod(this, &Inner::ShutdownComplete));
NS_DispatchToMainThread(NewRunnableMethod("ThrottledEventQueue::Inner::ShutdownComplete",
this, &Inner::ShutdownComplete));
}
bool

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

@ -146,7 +146,7 @@ nsThreadPool::ShutdownThread(nsIThread* aThread)
// shutdown requires this thread have an event loop (and it may not, see bug
// 10204784). The simplest way to cover all cases is to asynchronously
// shutdown aThread from the main thread.
NS_DispatchToMainThread(NewRunnableMethod(aThread,
NS_DispatchToMainThread(NewRunnableMethod("nsIThread::AsyncShutdown", aThread,
&nsIThread::AsyncShutdown));
}