It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
66 lines
2.1 KiB
C++
66 lines
2.1 KiB
C++
/* 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/. */
|
|
|
|
#include "RemoteWorkerDebuggerManagerParent.h"
|
|
|
|
#include "RemoteWorkerDebuggerParent.h"
|
|
#include "mozilla/dom/WorkerDebuggerManager.h"
|
|
|
|
namespace mozilla::dom {
|
|
|
|
/* static */
|
|
RefPtr<RemoteWorkerDebuggerManagerParent>
|
|
RemoteWorkerDebuggerManagerParent::CreateForProcess(
|
|
mozilla::ipc::Endpoint<PRemoteWorkerDebuggerManagerChild>* aChildEp) {
|
|
MOZ_ASSERT_DEBUG_OR_FUZZING(XRE_IsParentProcess() && NS_IsMainThread());
|
|
|
|
mozilla::ipc::Endpoint<PRemoteWorkerDebuggerManagerParent> parentEp;
|
|
nsresult rv =
|
|
PRemoteWorkerDebuggerManager::CreateEndpoints(&parentEp, aChildEp);
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
return nullptr;
|
|
}
|
|
|
|
RefPtr<RemoteWorkerDebuggerManagerParent> actor =
|
|
MakeRefPtr<RemoteWorkerDebuggerManagerParent>();
|
|
parentEp.Bind(actor);
|
|
|
|
return actor;
|
|
}
|
|
|
|
RemoteWorkerDebuggerManagerParent::RemoteWorkerDebuggerManagerParent() {
|
|
MOZ_ASSERT_DEBUG_OR_FUZZING(XRE_IsParentProcess() && NS_IsMainThread());
|
|
}
|
|
|
|
RemoteWorkerDebuggerManagerParent::~RemoteWorkerDebuggerManagerParent() {
|
|
MOZ_ASSERT_DEBUG_OR_FUZZING(XRE_IsParentProcess() && NS_IsMainThread());
|
|
}
|
|
|
|
mozilla::ipc::IPCResult RemoteWorkerDebuggerManagerParent::RecvRegister(
|
|
const RemoteWorkerDebuggerInfo& aDebuggerInfo,
|
|
mozilla::ipc::Endpoint<PRemoteWorkerDebuggerParent>&& aParentEp) {
|
|
MOZ_ASSERT_DEBUG_OR_FUZZING(XRE_IsParentProcess() && NS_IsMainThread());
|
|
|
|
if (!aParentEp.IsValid()) {
|
|
return IPC_FAIL(
|
|
this, "Invalid Parent Endpoint for RemoteWorkerDebuggerParent...");
|
|
}
|
|
|
|
RefPtr<WorkerDebuggerManager> manager = WorkerDebuggerManager::GetOrCreate();
|
|
MOZ_ASSERT_DEBUG_OR_FUZZING(manager);
|
|
|
|
RefPtr<RemoteWorkerDebuggerParent> debugger =
|
|
MakeRefPtr<RemoteWorkerDebuggerParent>(aDebuggerInfo,
|
|
std::move(aParentEp));
|
|
|
|
manager->RegisterDebugger(debugger);
|
|
|
|
MOZ_ASSERT(debugger->CanSend());
|
|
(void)debugger->SendRegisterDone();
|
|
|
|
return IPC_OK();
|
|
}
|
|
|
|
} // end of namespace mozilla::dom
|