mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1649684 - Use the current nsISerialEventTarget with the various process hosts. r=nika
In all those cases, the current nsISerialEventTarget is either the main thread or the MessageChannel's nsISerialEventTarget (since bug 1634846) Differential Revision: https://phabricator.services.mozilla.com/D81966
This commit is contained in:
parent
017fc801d8
commit
8fd158d479
@ -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);
|
||||
|
@ -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<ShutDownMethod>(
|
||||
GetCurrentSerialEventTarget()->Dispatch(NewRunnableMethod<ShutDownMethod>(
|
||||
"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,
|
||||
|
@ -243,7 +243,7 @@ void RDDProcessHost::DestroyProcess() {
|
||||
mTaskFactory.RevokeAll();
|
||||
}
|
||||
|
||||
MessageLoop::current()->PostTask(
|
||||
GetCurrentSerialEventTarget()->Dispatch(
|
||||
NS_NewRunnableFunction("DestroyProcessRunnable", [this] { Destroy(); }));
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -223,7 +223,7 @@ void GPUProcessHost::DestroyProcess() {
|
||||
mTaskFactory.RevokeAll();
|
||||
}
|
||||
|
||||
MessageLoop::current()->PostTask(
|
||||
GetCurrentSerialEventTarget()->Dispatch(
|
||||
NS_NewRunnableFunction("DestroyProcessRunnable", [this] { Destroy(); }));
|
||||
}
|
||||
|
||||
|
@ -1134,7 +1134,7 @@ void BasicCompositor::TryToEndRemoteDrawing() {
|
||||
RefPtr<Runnable> runnable =
|
||||
NS_NewRunnableFunction("layers::BasicCompositor::TryToEndRemoteDrawing",
|
||||
[self]() { self->TryToEndRemoteDrawing(); });
|
||||
MessageLoop::current()->PostDelayedTask(runnable.forget(), retryMs);
|
||||
GetCurrentSerialEventTarget()->DelayedDispatch(runnable.forget(), retryMs);
|
||||
} else {
|
||||
EndRemoteDrawing();
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ void CompositorManagerParent::ActorDestroy(ActorDestroyReason aReason) {
|
||||
}
|
||||
|
||||
void CompositorManagerParent::ActorDealloc() {
|
||||
MessageLoop::current()->PostTask(
|
||||
GetCurrentSerialEventTarget()->Dispatch(
|
||||
NewRunnableMethod("layers::CompositorManagerParent::DeferredDestroy",
|
||||
this, &CompositorManagerParent::DeferredDestroy));
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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> VRGPUParent::CreateForGPU(
|
||||
Endpoint<PVRGPUParent>&& aEndpoint) {
|
||||
RefPtr<VRGPUParent> vcp = new VRGPUParent(aEndpoint.OtherPid());
|
||||
MessageLoop::current()->PostTask(NewRunnableMethod<Endpoint<PVRGPUParent>&&>(
|
||||
"gfx::VRGPUParent::Bind", vcp, &VRGPUParent::Bind, std::move(aEndpoint)));
|
||||
GetCurrentSerialEventTarget()->Dispatch(
|
||||
NewRunnableMethod<Endpoint<PVRGPUParent>&&>("gfx::VRGPUParent::Bind", vcp,
|
||||
&VRGPUParent::Bind,
|
||||
std::move(aEndpoint)));
|
||||
|
||||
return vcp;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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(); }));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user