fune/tools/fuzzing/ipc/ProtocolFuzzer.cpp
Nika Layzell 0e37500335 Bug 1719577 - Part 2: Create mMonitor eagerly in MessageChannel's constructor, r=handyman
Now that PortLink is the only MessageLink implementation, it is no longer
necessary to support sharing a single `RefCountedMonitor` between multiple
MessageChannels, meaning that we can construct the monitor directly in the
`MessageChannel` constructor. The monitor still needs to be refcounted due to
being used by the PortLink as part of the listener implementation.

Differential Revision: https://phabricator.services.mozilla.com/D119350
2021-07-23 19:14:56 +00:00

36 lines
1.1 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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 "mozilla/layers/CompositorBridgeParent.h"
#include "ProtocolFuzzer.h"
namespace mozilla {
namespace ipc {
nsTArray<nsCString> LoadIPCMessageBlacklist(const char* aPath) {
nsTArray<nsCString> blacklist;
if (aPath) {
nsresult result = Faulty::ReadFile(aPath, blacklist);
MOZ_RELEASE_ASSERT(result == NS_OK);
}
return blacklist;
}
mozilla::dom::ContentParent* ProtocolFuzzerHelper::CreateContentParent(
const nsACString& aRemoteType) {
auto* cp = new mozilla::dom::ContentParent(aRemoteType);
// TODO: this duplicates MessageChannel::Open
cp->GetIPCChannel()->mWorkerThread = GetCurrentSerialEventTarget();
return cp;
}
void ProtocolFuzzerHelper::CompositorBridgeParentSetup() {
mozilla::layers::CompositorBridgeParent::Setup();
}
} // namespace ipc
} // namespace mozilla