Bug 1647133 - P1. Use nsISerialEventTarget where it's actually that. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D80419
This commit is contained in:
Jean-Yves Avenard 2020-06-23 03:21:14 +00:00
parent b894acb874
commit d7b9a044db
13 changed files with 23 additions and 24 deletions

View File

@ -140,7 +140,8 @@ void FileSystemTaskChildBase::Start() {
}
if (NS_IsMainThread()) {
nsIEventTarget* target = mGlobalObject->EventTargetFor(TaskCategory::Other);
nsISerialEventTarget* target =
mGlobalObject->EventTargetFor(TaskCategory::Other);
MOZ_ASSERT(target);
actor->SetEventTargetForActor(this, target);

View File

@ -265,7 +265,7 @@ Result<RefPtr<IDBFactory>, nsresult> IDBFactory::CreateInternal(
auto factory = MakeRefPtr<IDBFactory>(IDBFactoryGuard{});
factory->mPrincipalInfo = std::move(aPrincipalInfo);
factory->mGlobal = aGlobal;
factory->mEventTarget = GetCurrentThreadEventTarget();
factory->mEventTarget = GetCurrentThreadSerialEventTarget();
factory->mInnerWindowID = aInnerWindowID;
return factory;

View File

@ -19,8 +19,8 @@
#include "nsWrapperCache.h"
class nsIGlobalObject;
class nsIEventTarget;
class nsIPrincipal;
class nsISerialEventTarget;
class nsPIDOMWindowInner;
namespace mozilla {
@ -69,8 +69,8 @@ class IDBFactory final : public nsISupports, public nsWrapperCache {
indexedDB::BackgroundFactoryChild* mBackgroundActor;
// It is either set to a DocGroup-specific EventTarget if created by
// CreateForWindow() or set to GetCurrentThreadEventTarget() otherwise.
nsCOMPtr<nsIEventTarget> mEventTarget;
// CreateForWindow() or set to GetCurrentSerialEventTarget() otherwise.
nsCOMPtr<nsISerialEventTarget> mEventTarget;
uint64_t mInnerWindowID;
uint32_t mActiveTransactionCount;
@ -99,7 +99,7 @@ class IDBFactory final : public nsISupports, public nsWrapperCache {
void AssertIsOnOwningThread() const { NS_ASSERT_OWNINGTHREAD(IDBFactory); }
nsIEventTarget* EventTarget() const {
nsISerialEventTarget* EventTarget() const {
AssertIsOnOwningThread();
MOZ_RELEASE_ASSERT(mEventTarget);
return mEventTarget;

View File

@ -59,7 +59,7 @@ nsresult TCPServerSocket::Init() {
}
if (XRE_GetProcessType() == GeckoProcessType_Content) {
nsCOMPtr<nsIEventTarget> target;
nsCOMPtr<nsISerialEventTarget> target;
if (nsCOMPtr<nsIGlobalObject> global = GetOwnerGlobal()) {
target = global->EventTargetFor(TaskCategory::Other);
}

View File

@ -39,11 +39,9 @@ NS_IMETHODIMP_(MozExternalRefCountType) TCPServerSocketChild::Release(void) {
return refcnt;
}
TCPServerSocketChild::TCPServerSocketChild(TCPServerSocket* aServerSocket,
uint16_t aLocalPort,
uint16_t aBacklog,
bool aUseArrayBuffers,
nsIEventTarget* aIPCEventTarget) {
TCPServerSocketChild::TCPServerSocketChild(
TCPServerSocket* aServerSocket, uint16_t aLocalPort, uint16_t aBacklog,
bool aUseArrayBuffers, nsISerialEventTarget* aIPCEventTarget) {
mServerSocket = aServerSocket;
if (aIPCEventTarget) {
gNeckoChild->SetEventTargetForActor(this, aIPCEventTarget);

View File

@ -48,7 +48,7 @@ class TCPServerSocketChild : public mozilla::net::PTCPServerSocketChild,
TCPServerSocketChild(TCPServerSocket* aServerSocket, uint16_t aLocalPort,
uint16_t aBacklog, bool aUseArrayBuffers,
nsIEventTarget* aIPCEventTarget);
nsISerialEventTarget* aIPCEventTarget);
~TCPServerSocketChild();
void Close();

View File

@ -177,7 +177,7 @@ nsresult TCPSocket::CreateStream() {
do_QueryInterface(mSocketInputStream);
NS_ENSURE_TRUE(asyncStream, NS_ERROR_NOT_AVAILABLE);
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadEventTarget();
nsCOMPtr<nsISerialEventTarget> mainTarget = GetMainThreadSerialEventTarget();
rv = asyncStream->AsyncWait(this, nsIAsyncInputStream::WAIT_CLOSURE_ONLY, 0,
mainTarget);
NS_ENSURE_SUCCESS(rv, rv);
@ -206,7 +206,7 @@ nsresult TCPSocket::InitWithUnconnectedTransport(
MOZ_ASSERT(XRE_GetProcessType() != GeckoProcessType_Content);
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadEventTarget();
nsCOMPtr<nsISerialEventTarget> mainTarget = GetMainThreadSerialEventTarget();
mTransport->SetEventSink(this, mainTarget);
nsresult rv = CreateStream();
@ -227,7 +227,7 @@ nsresult TCPSocket::Init() {
if (XRE_GetProcessType() == GeckoProcessType_Content) {
mReadyState = TCPReadyState::Connecting;
nsCOMPtr<nsIEventTarget> target;
nsCOMPtr<nsISerialEventTarget> target;
if (nsCOMPtr<nsIGlobalObject> global = GetOwnerGlobal()) {
target = global->EventTargetFor(TaskCategory::Other);
}
@ -358,7 +358,7 @@ nsresult TCPSocket::EnsureCopying() {
nsCOMPtr<nsISocketTransportService> sts =
do_GetService("@mozilla.org/network/socket-transport-service;1");
nsCOMPtr<nsIEventTarget> target = do_QueryInterface(sts);
nsCOMPtr<nsISerialEventTarget> target = do_QueryInterface(sts);
rv = copier->Init(stream, mSocketOutputStream, target,
true, /* source buffered */
false, /* sink buffered */

View File

@ -83,7 +83,7 @@ NS_IMETHODIMP_(MozExternalRefCountType) TCPSocketChild::Release(void) {
}
TCPSocketChild::TCPSocketChild(const nsAString& aHost, const uint16_t& aPort,
nsIEventTarget* aTarget)
nsISerialEventTarget* aTarget)
: mHost(aHost), mPort(aPort), mIPCEventTarget(aTarget) {}
void TCPSocketChild::SendOpen(nsITCPSocketCallback* aSocket, bool aUseSSL,

View File

@ -47,7 +47,7 @@ class TCPSocketChild : public mozilla::net::PTCPSocketChild,
NS_IMETHOD_(MozExternalRefCountType) Release() override;
TCPSocketChild(const nsAString& aHost, const uint16_t& aPort,
nsIEventTarget* aTarget);
nsISerialEventTarget* aTarget);
~TCPSocketChild();
void SendOpen(nsITCPSocketCallback* aSocket, bool aUseSSL,
@ -70,7 +70,7 @@ class TCPSocketChild : public mozilla::net::PTCPSocketChild,
private:
nsString mHost;
uint16_t mPort;
nsCOMPtr<nsIEventTarget> mIPCEventTarget;
nsCOMPtr<nsISerialEventTarget> mIPCEventTarget;
};
} // namespace dom

View File

@ -479,7 +479,7 @@ nsresult UDPSocket::InitRemote(const nsAString& aLocalAddress,
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIEventTarget> target;
nsCOMPtr<nsISerialEventTarget> target;
if (nsCOMPtr<nsIGlobalObject> global = GetOwnerGlobal()) {
target = global->EventTargetFor(TaskCategory::Other);
}

View File

@ -68,7 +68,7 @@ nsresult UDPSocketChild::Bind(nsIUDPSocketInternal* aSocket,
uint16_t aPort, bool aAddressReuse,
bool aLoopback, uint32_t recvBufferSize,
uint32_t sendBufferSize,
nsIEventTarget* aMainThreadEventTarget) {
nsISerialEventTarget* aMainThreadEventTarget) {
UDPSOCKET_LOG(
("%s: %s:%u", __FUNCTION__, PromiseFlatCString(aHost).get(), aPort));

View File

@ -60,7 +60,7 @@ class UDPSocketChild : public mozilla::net::PUDPSocketChild,
const nsACString& aHost, uint16_t aPort, bool aAddressReuse,
bool aLoopback, uint32_t recvBufferSize,
uint32_t sendBufferSize,
nsIEventTarget* aMainThreadEventTarget);
nsISerialEventTarget* aMainThreadEventTarget);
// Tell the chrome process to connect the UDP socket to a given remote host
// and port

View File

@ -2146,7 +2146,7 @@ nsresult PluginModuleParent::NPP_NewInternal(
owner->GetDOMElement(getter_AddRefs(elt));
if (elt) {
RefPtr<dom::Document> doc = elt->OwnerDoc();
nsCOMPtr<nsIEventTarget> eventTarget =
nsCOMPtr<nsISerialEventTarget> eventTarget =
doc->EventTargetFor(TaskCategory::Other);
SetEventTargetForActor(parentInstance, eventTarget);
}