diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index bce7fe037cd2..510aab718c57 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -2858,7 +2858,7 @@ void ContentChild::ShutdownInternal() { // We're in a nested event loop. Let's delay for an arbitrary period of // time (100ms) in the hopes that the event loop will have finished by // then. - MessageLoop::current()->PostDelayedTask( + GetCurrentSerialEventTarget()->DelayedDispatch( NewRunnableMethod("dom::ContentChild::RecvShutdown", this, &ContentChild::ShutdownInternal), 100); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 01b9e059a25a..12c1805cb472 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1558,7 +1558,7 @@ void ContentParent::MaybeAsyncSendShutDownMessage() { // In the case of normal shutdown, send a shutdown message to child to // allow it to perform shutdown tasks. - MessageLoop::current()->PostTask(NewRunnableMethod( + GetCurrentSerialEventTarget()->Dispatch(NewRunnableMethod( "dom::ContentParent::ShutDownProcess", this, &ContentParent::ShutDownProcess, SEND_SHUTDOWN_MESSAGE)); } @@ -1899,7 +1899,7 @@ void ContentParent::ActorDestroy(ActorDestroyReason why) { this, mSubprocess, mSubprocess ? (uintptr_t)mSubprocess->GetChildProcessHandle() : -1)); // FIXME (bug 1520997): does this really need an additional dispatch? - MessageLoop::current()->PostTask(NS_NewRunnableFunction( + GetCurrentSerialEventTarget()->Dispatch(NS_NewRunnableFunction( "DelayedDeleteSubprocessRunnable", [subprocess = mSubprocess] { MOZ_LOG( ContentParent::GetLog(), LogLevel::Debug, diff --git a/dom/media/ipc/RDDProcessHost.cpp b/dom/media/ipc/RDDProcessHost.cpp index a8bde4304287..20e4984dc209 100644 --- a/dom/media/ipc/RDDProcessHost.cpp +++ b/dom/media/ipc/RDDProcessHost.cpp @@ -243,7 +243,7 @@ void RDDProcessHost::DestroyProcess() { mTaskFactory.RevokeAll(); } - MessageLoop::current()->PostTask( + GetCurrentSerialEventTarget()->Dispatch( NS_NewRunnableFunction("DestroyProcessRunnable", [this] { Destroy(); })); } diff --git a/dom/plugins/ipc/PluginProcessChild.cpp b/dom/plugins/ipc/PluginProcessChild.cpp index b1d780fd28b8..6b1021c84652 100644 --- a/dom/plugins/ipc/PluginProcessChild.cpp +++ b/dom/plugins/ipc/PluginProcessChild.cpp @@ -5,12 +5,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/plugins/PluginProcessChild.h" -#include "mozilla/TaskController.h" #include "ClearOnShutdown.h" #include "base/command_line.h" +#include "base/message_loop.h" // for MessageLoop #include "base/string_util.h" #include "mozilla/AbstractThread.h" +#include "mozilla/TaskController.h" #include "mozilla/ipc/IOThreadChild.h" #include "nsDebugImpl.h" #include "nsThreadManager.h" diff --git a/gfx/ipc/GPUProcessHost.cpp b/gfx/ipc/GPUProcessHost.cpp index 1afca99004f8..47ec5bde8f16 100644 --- a/gfx/ipc/GPUProcessHost.cpp +++ b/gfx/ipc/GPUProcessHost.cpp @@ -223,7 +223,7 @@ void GPUProcessHost::DestroyProcess() { mTaskFactory.RevokeAll(); } - MessageLoop::current()->PostTask( + GetCurrentSerialEventTarget()->Dispatch( NS_NewRunnableFunction("DestroyProcessRunnable", [this] { Destroy(); })); } diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index 531fa038ad9d..309e4a38ed33 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -1134,7 +1134,7 @@ void BasicCompositor::TryToEndRemoteDrawing() { RefPtr runnable = NS_NewRunnableFunction("layers::BasicCompositor::TryToEndRemoteDrawing", [self]() { self->TryToEndRemoteDrawing(); }); - MessageLoop::current()->PostDelayedTask(runnable.forget(), retryMs); + GetCurrentSerialEventTarget()->DelayedDispatch(runnable.forget(), retryMs); } else { EndRemoteDrawing(); } diff --git a/gfx/layers/ipc/CompositorManagerParent.cpp b/gfx/layers/ipc/CompositorManagerParent.cpp index 6ffaebc445f1..21d270691dfd 100644 --- a/gfx/layers/ipc/CompositorManagerParent.cpp +++ b/gfx/layers/ipc/CompositorManagerParent.cpp @@ -159,7 +159,7 @@ void CompositorManagerParent::ActorDestroy(ActorDestroyReason aReason) { } void CompositorManagerParent::ActorDealloc() { - MessageLoop::current()->PostTask( + GetCurrentSerialEventTarget()->Dispatch( NewRunnableMethod("layers::CompositorManagerParent::DeferredDestroy", this, &CompositorManagerParent::DeferredDestroy)); diff --git a/gfx/layers/ipc/ContentCompositorBridgeParent.cpp b/gfx/layers/ipc/ContentCompositorBridgeParent.cpp index 180553a7eb97..416dee10687d 100644 --- a/gfx/layers/ipc/ContentCompositorBridgeParent.cpp +++ b/gfx/layers/ipc/ContentCompositorBridgeParent.cpp @@ -10,9 +10,6 @@ #include "LayerTransactionParent.h" // for LayerTransactionParent #include "apz/src/APZCTreeManager.h" // for APZCTreeManager -#include "base/message_loop.h" // for MessageLoop -#include "base/task.h" // for CancelableTask, etc -#include "base/thread.h" // for Thread #include "gfxUtils.h" #ifdef XP_WIN # include "mozilla/gfx/DeviceManagerDx.h" // for DeviceManagerDx @@ -68,7 +65,7 @@ void ContentCompositorBridgeParent::ActorDestroy(ActorDestroyReason aWhy) { // We must keep this object alive untill the code handling message // reception is finished on this thread. - MessageLoop::current()->PostTask(NewRunnableMethod( + GetCurrentSerialEventTarget()->Dispatch(NewRunnableMethod( "layers::ContentCompositorBridgeParent::DeferredDestroy", this, &ContentCompositorBridgeParent::DeferredDestroy)); } diff --git a/gfx/vr/ipc/VRGPUParent.cpp b/gfx/vr/ipc/VRGPUParent.cpp index 8c39b9cac7d9..27b93d790851 100644 --- a/gfx/vr/ipc/VRGPUParent.cpp +++ b/gfx/vr/ipc/VRGPUParent.cpp @@ -31,7 +31,7 @@ void VRGPUParent::ActorDestroy(ActorDestroyReason aWhy) { #endif mClosed = true; - MessageLoop::current()->PostTask( + GetCurrentSerialEventTarget()->Dispatch( NewRunnableMethod("gfx::VRGPUParent::DeferredDestroy", this, &VRGPUParent::DeferredDestroy)); } @@ -42,8 +42,10 @@ void VRGPUParent::DeferredDestroy() { mSelfRef = nullptr; } RefPtr VRGPUParent::CreateForGPU( Endpoint&& aEndpoint) { RefPtr vcp = new VRGPUParent(aEndpoint.OtherPid()); - MessageLoop::current()->PostTask(NewRunnableMethod&&>( - "gfx::VRGPUParent::Bind", vcp, &VRGPUParent::Bind, std::move(aEndpoint))); + GetCurrentSerialEventTarget()->Dispatch( + NewRunnableMethod&&>("gfx::VRGPUParent::Bind", vcp, + &VRGPUParent::Bind, + std::move(aEndpoint))); return vcp; } diff --git a/netwerk/ipc/SocketProcessBridgeChild.cpp b/netwerk/ipc/SocketProcessBridgeChild.cpp index 93792f55db3b..01a5a7ad3505 100644 --- a/netwerk/ipc/SocketProcessBridgeChild.cpp +++ b/netwerk/ipc/SocketProcessBridgeChild.cpp @@ -155,7 +155,7 @@ void SocketProcessBridgeChild::ActorDestroy(ActorDestroyReason aWhy) { if (os) { os->RemoveObserver(this, "content-child-shutdown"); } - MessageLoop::current()->PostTask( + GetCurrentSerialEventTarget()->Dispatch( NewRunnableMethod("net::SocketProcessBridgeChild::DeferredDestroy", this, &SocketProcessBridgeChild::DeferredDestroy)); mShuttingDown = true; diff --git a/netwerk/ipc/SocketProcessBridgeParent.cpp b/netwerk/ipc/SocketProcessBridgeParent.cpp index 78019eb199c6..9427f1388c9a 100644 --- a/netwerk/ipc/SocketProcessBridgeParent.cpp +++ b/netwerk/ipc/SocketProcessBridgeParent.cpp @@ -49,7 +49,7 @@ void SocketProcessBridgeParent::ActorDestroy(ActorDestroyReason aWhy) { LOG(("SocketProcessBridgeParent::ActorDestroy mId=%d\n", mId)); mClosed = true; - MessageLoop::current()->PostTask( + GetCurrentSerialEventTarget()->Dispatch( NewRunnableMethod("net::SocketProcessBridgeParent::DeferredDestroy", this, &SocketProcessBridgeParent::DeferredDestroy)); } diff --git a/netwerk/ipc/SocketProcessHost.cpp b/netwerk/ipc/SocketProcessHost.cpp index e73d7bcd31bf..4079ed4f89f7 100644 --- a/netwerk/ipc/SocketProcessHost.cpp +++ b/netwerk/ipc/SocketProcessHost.cpp @@ -5,12 +5,12 @@ #include "SocketProcessHost.h" -#include "nsAppRunner.h" -#include "nsIObserverService.h" -#include "nsIOService.h" -#include "SocketProcessParent.h" #include "ProcessUtils.h" +#include "SocketProcessParent.h" #include "mozilla/ipc/FileDescriptor.h" +#include "nsAppRunner.h" +#include "nsIOService.h" +#include "nsIObserverService.h" #if defined(XP_LINUX) && defined(MOZ_SANDBOX) # include "mozilla/SandboxBroker.h" @@ -224,7 +224,7 @@ void SocketProcessHost::DestroyProcess() { mTaskFactory.RevokeAll(); } - MessageLoop::current()->PostTask(NS_NewRunnableFunction( + GetCurrentSerialEventTarget()->Dispatch(NS_NewRunnableFunction( "DestroySocketProcessRunnable", [this] { Destroy(); })); }