Quelle SocketProcessBackgroundChild.cpp
Sprache: C
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// static void SocketProcessBackgroundChild::Create(
ipc::Endpoint<PSocketProcessBackgroundChild>&& aEndpoint) { if (NS_WARN_IF(!aEndpoint.IsValid())) {
MOZ_ASSERT_UNREACHABLE( "Can't create SocketProcessBackgroundChild with invalid endpoint"); return;
}
nsCOMPtr<nsISerialEventTarget> transportQueue; if (NS_WARN_IF(NS_FAILED(NS_CreateBackgroundTaskQueue( "SocketBackgroundChildQueue", getter_AddRefs(transportQueue))))) { return;
}
RefPtr<SocketProcessBackgroundChild> actor = new SocketProcessBackgroundChild();
transportQueue->Dispatch(NS_NewRunnableFunction( "BindSocketBackgroundChild",
[endpoint = std::move(aEndpoint), actor]() mutable { // We checked endpoint validity before the dispatch, so this cannot // fail.
MOZ_ALWAYS_TRUE(endpoint.Bind(actor));
}));
// Immediately store the actor and queue into the global. // Any messages dispatched to the queue will arrive after it has been bound.
LOG(("SocketProcessBackgroundChild::Create"));
StaticMutexAutoLock lock(sMutex);
MOZ_ASSERT(!sInstance && !sTaskQueue, "Cannot initialize SocketProcessBackgroundChild twice!");
sInstance = actor;
sTaskQueue = transportQueue;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.