Bug 1410209, part 4 - Add names to some IPC runnables. r=kanru

This patch requires that each instance of IPC's RunnableFunction is
passed in a name, like the non-IPC RunnableFunction.

MozReview-Commit-ID: Atu1W3Rl66S

--HG--
extra : rebase_source : f932d7597a26a3f0c4246b3a95df638860d3d32d
This commit is contained in:
Andrew McCreight 2017-10-27 13:39:28 -07:00
Родитель 4e452aadbf
Коммит ab7fa64021
15 изменённых файлов: 45 добавлений и 24 удалений

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

@ -1810,7 +1810,8 @@ ContentChild::RecvPBrowserConstructor(PBrowserChild* aActor,
if (!hasRunOnce) {
hasRunOnce = true;
MOZ_ASSERT(!gFirstIdleTask);
RefPtr<CancelableRunnable> firstIdleTask = NewCancelableRunnableFunction(FirstIdle);
RefPtr<CancelableRunnable> firstIdleTask = NewCancelableRunnableFunction("FirstIdleRunnable",
FirstIdle);
gFirstIdleTask = firstIdleTask;
NS_IdleDispatchToCurrentThread(firstIdleTask.forget());
}

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

@ -1763,7 +1763,8 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
mIdleListeners.Clear();
MessageLoop::current()->
PostTask(NewRunnableFunction(DelayedDeleteSubprocess, mSubprocess));
PostTask(NewRunnableFunction("DelayedDeleteSubprocessRunnable",
DelayedDeleteSubprocess, mSubprocess));
mSubprocess = nullptr;
// IPDL rules require actors to live on past ActorDestroy, but it
@ -3120,7 +3121,8 @@ ContentParent::OnGenerateMinidumpComplete(bool aDumpResult)
// EnsureProcessTerminated has responsibilty for closing otherProcessHandle.
XRE_GetIOMessageLoop()->PostTask(
NewRunnableFunction(&ProcessWatcher::EnsureProcessTerminated,
NewRunnableFunction("EnsureProcessTerminatedRunnable",
&ProcessWatcher::EnsureProcessTerminated,
otherProcessHandle, /*force=*/true));
}

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

@ -52,7 +52,8 @@ VideoDecoderManagerChild::InitializeThread()
VideoDecoderManagerChild::InitForContent(Endpoint<PVideoDecoderManagerChild>&& aVideoManager)
{
InitializeThread();
sVideoDecoderChildThread->Dispatch(NewRunnableFunction(&Open, Move(aVideoManager)), NS_DISPATCH_NORMAL);
sVideoDecoderChildThread->Dispatch(NewRunnableFunction("InitForContentRunnable",
&Open, Move(aVideoManager)), NS_DISPATCH_NORMAL);
}
/* static */ void

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

@ -245,7 +245,7 @@ GPUProcessHost::DestroyProcess()
}
MessageLoop::current()->
PostTask(NewRunnableFunction(DelayedDeleteSubprocess, this));
PostTask(NewRunnableFunction("DestroyProcessRunnable", DelayedDeleteSubprocess, this));
}
} // namespace gfx

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

@ -196,7 +196,9 @@ PaintThread::Shutdown()
return;
}
sThread->Dispatch(NewRunnableFunction(DestroyPaintThread, Move(pt)));
sThread->Dispatch(NewRunnableFunction("DestroyPaintThreadRunnable",
DestroyPaintThread,
Move(pt)));
sThread->Shutdown();
sThread = nullptr;
}

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

@ -2384,7 +2384,8 @@ void
APZCTreeManager::SetLongTapEnabled(bool aLongTapEnabled)
{
APZThreadUtils::RunOnControllerThread(
NewRunnableFunction(GestureEventListener::SetLongTapEnabled, aLongTapEnabled));
NewRunnableFunction("SetLongTapEnabledRunnable",
GestureEventListener::SetLongTapEnabled, aLongTapEnabled));
}
RefPtr<HitTestingTreeNode>

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

@ -338,13 +338,15 @@ DeallocateTextureClient(TextureDeallocParams params)
bool done = false;
ReentrantMonitor barrier("DeallocateTextureClient");
ReentrantMonitorAutoEnter autoMon(barrier);
ipdlMsgLoop->PostTask(NewRunnableFunction(DeallocateTextureClientSyncProxy,
ipdlMsgLoop->PostTask(NewRunnableFunction("DeallocateTextureClientSyncProxyRunnable",
DeallocateTextureClientSyncProxy,
params, &barrier, &done));
while (!done) {
barrier.Wait();
}
} else {
ipdlMsgLoop->PostTask(NewRunnableFunction(DeallocateTextureClient,
ipdlMsgLoop->PostTask(NewRunnableFunction("DeallocateTextureClientRunnable",
DeallocateTextureClient,
params));
}
// The work has been forwarded to the IPDL thread, we are done.
@ -840,7 +842,8 @@ void CancelTextureClientRecycle(uint64_t aTextureId, LayersIPCChannel* aAllocato
if (MessageLoop::current() == msgLoop) {
aAllocator->CancelWaitForRecycle(aTextureId);
} else {
msgLoop->PostTask(NewRunnableFunction(CancelTextureClientRecycle,
msgLoop->PostTask(NewRunnableFunction("CancelTextureClientRecycleRunnable",
CancelTextureClientRecycle,
aTextureId, aAllocator));
}
}

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

@ -495,7 +495,8 @@ CompositorBridgeChild::RecvCaptureAllPlugins(const uintptr_t& aParentWidget)
// Bounce the call to SendAllPluginsCaptured off the ImageBridgeChild loop,
// to make sure that the image updates on that thread have been processed.
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(
NewRunnableFunction(&ScheduleSendAllPluginsCaptured, this,
NewRunnableFunction("ScheduleSendAllPluginsCapturedRunnable",
&ScheduleSendAllPluginsCaptured, this,
MessageLoop::current()));
return IPC_OK();
#else

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

@ -382,10 +382,12 @@ CompositorBridgeParent::Initialize()
// can destroy this instance is initialized on the compositor thread after
// this task has been processed.
MOZ_ASSERT(CompositorLoop());
CompositorLoop()->PostTask(NewRunnableFunction(&AddCompositor,
CompositorLoop()->PostTask(NewRunnableFunction("AddCompositorRunnable",
&AddCompositor,
this, &mCompositorBridgeID));
CompositorLoop()->PostTask(NewRunnableFunction(SetThreadPriority));
CompositorLoop()->PostTask(NewRunnableFunction("SetThreadPriorityRunnable",
SetThreadPriority));
{ // scope lock
@ -1788,7 +1790,8 @@ CompositorBridgeParent::DeallocateLayerTreeId(uint64_t aId)
gfxCriticalError() << "Attempting to post to a invalid Compositor Loop";
return;
}
CompositorLoop()->PostTask(NewRunnableFunction(&EraseLayerState, aId));
CompositorLoop()->PostTask(NewRunnableFunction("EraseLayerStateRunnable",
&EraseLayerState, aId));
}
static void
@ -1825,7 +1828,8 @@ CompositorBridgeParent::SetControllerForLayerTree(uint64_t aLayersId,
{
// This ref is adopted by UpdateControllerForLayersId().
aController->AddRef();
CompositorLoop()->PostTask(NewRunnableFunction(&UpdateControllerForLayersId,
CompositorLoop()->PostTask(NewRunnableFunction("UpdateControllerForLayersIdRunnable",
&UpdateControllerForLayersId,
aLayersId,
aController));
}
@ -1865,7 +1869,8 @@ CompositorBridgeParent::PostInsertVsyncProfilerMarker(TimeStamp aVsyncTimestamp)
// Called in the vsync thread
if (profiler_is_active() && CompositorThreadHolder::IsActive()) {
CompositorLoop()->PostTask(
NewRunnableFunction(InsertVsyncProfilerMarker, aVsyncTimestamp));
NewRunnableFunction("InsertVsyncProfilerMarkerRunnable", InsertVsyncProfilerMarker,
aVsyncTimestamp));
}
#endif
}

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

@ -156,7 +156,8 @@ VRManagerChild::Destroy()
// The DeferredDestroyVRManager task takes ownership of
// the VRManagerChild and will release it when it runs.
MessageLoop::current()->PostTask(
NewRunnableFunction(DeferredDestroy, selfRef));
NewRunnableFunction("VRManagerChildDestroyRunnable",
DeferredDestroy, selfRef));
}
PVRLayerChild*

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

@ -121,7 +121,8 @@ VRManagerParent::CreateSameProcess()
RefPtr<VRManagerParent> vmp = new VRManagerParent(base::GetCurrentProcId(), false);
vmp->mVRListenerThreadHolder = VRListenerThreadHolder::GetSingleton();
vmp->mSelfRef = vmp;
loop->PostTask(NewRunnableFunction(RegisterVRManagerInVRListenerThread, vmp.get()));
loop->PostTask(NewRunnableFunction("RegisterVRManagerInVRListenerThreadRunnable",
RegisterVRManagerInVRListenerThread, vmp.get()));
return vmp.get();
}

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

@ -234,6 +234,7 @@ RenderThread::UpdateAndRender(wr::WindowId aWindowId)
auto epochs = renderer->FlushRenderedEpochs();
layers::CompositorThreadHolder::Loop()->PostTask(NewRunnableFunction(
"NotifyDidRenderRunnable",
&NotifyDidRender,
renderer->GetCompositorBridge(),
epochs,

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

@ -227,6 +227,7 @@ void
RendererOGL::NotifyWebRenderError(WebRenderError aError)
{
layers::CompositorThreadHolder::Loop()->PostTask(NewRunnableFunction(
"DoNotifyWebRenderErrorRunnable",
&DoNotifyWebRenderError,
mBridge,
aError

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

@ -335,8 +335,8 @@ NewRunnableMethod(T* object, Method method, Args&&... args) {
template <class Function, class Params>
class RunnableFunction : public mozilla::CancelableRunnable {
public:
RunnableFunction(Function function, Params&& params)
: mozilla::CancelableRunnable("RunnableFunction")
RunnableFunction(const char* name, Function function, Params&& params)
: mozilla::CancelableRunnable(name)
, function_(function)
, params_(mozilla::Forward<Params>(params))
{
@ -362,20 +362,20 @@ class RunnableFunction : public mozilla::CancelableRunnable {
template <class Function, typename... Args>
inline already_AddRefed<mozilla::CancelableRunnable>
NewCancelableRunnableFunction(Function function, Args&&... args) {
NewCancelableRunnableFunction(const char* name, Function function, Args&&... args) {
typedef mozilla::Tuple<typename mozilla::Decay<Args>::Type...> ArgsTuple;
RefPtr<mozilla::CancelableRunnable> t =
new RunnableFunction<Function, ArgsTuple>(function,
new RunnableFunction<Function, ArgsTuple>(name, function,
mozilla::MakeTuple(mozilla::Forward<Args>(args)...));
return t.forget();
}
template <class Function, typename... Args>
inline already_AddRefed<mozilla::Runnable>
NewRunnableFunction(Function function, Args&&... args) {
NewRunnableFunction(const char* name, Function function, Args&&... args) {
typedef mozilla::Tuple<typename mozilla::Decay<Args>::Type...> ArgsTuple;
RefPtr<mozilla::Runnable> t =
new RunnableFunction<Function, ArgsTuple>(function,
new RunnableFunction<Function, ArgsTuple>(name, function,
mozilla::MakeTuple(mozilla::Forward<Args>(args)...));
return t.forget();
}

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

@ -434,6 +434,7 @@ public:
return;
}
uiThread->Dispatch(NewRunnableFunction(
"OnDetachRunnable",
static_cast<void(*)(const NPZCRef&)>(callDestroy),
mozilla::Move(npzc)), nsIThread::DISPATCH_NORMAL);
}