Backed out 3 changesets (bug 1845946) for causing bug 1848484. CLOSED TREE

Backed out changeset bad73ceb87dd (bug 1845946)
Backed out changeset f984e69872e4 (bug 1845946)
Backed out changeset af600f0290b6 (bug 1845946)
This commit is contained in:
Cristian Tuns 2023-08-13 15:38:36 -04:00
Родитель ed9a205dcd
Коммит da1e39f50e
33 изменённых файлов: 209 добавлений и 531 удалений

Просмотреть файл

@ -9,7 +9,6 @@
#include "base/task.h"
#include "ChildProfilerController.h"
#include "ChromiumCDMAdapter.h"
#include "GeckoProfiler.h"
#ifdef XP_LINUX
# include "dlfcn.h"
#endif
@ -39,7 +38,6 @@
#include "nsThreadManager.h"
#include "nsXULAppAPI.h"
#include "nsIXULRuntime.h"
#include "nsXPCOM.h"
#include "prio.h"
#ifdef XP_WIN
# include <stdlib.h> // for _exit()
@ -76,7 +74,7 @@ GMPChild::~GMPChild() {
#endif
}
bool GMPChild::Init(const nsAString& aPluginPath, const char* aParentBuildID,
bool GMPChild::Init(const nsAString& aPluginPath,
mozilla::ipc::UntypedEndpoint&& aEndpoint) {
GMP_CHILD_LOG_DEBUG("%s pluginPath=%s", __FUNCTION__,
NS_ConvertUTF16toUTF8(aPluginPath).get());
@ -91,35 +89,10 @@ bool GMPChild::Init(const nsAString& aPluginPath, const char* aParentBuildID,
return false;
}
// This must be checked before any IPDL message, which may hit sentinel
// errors due to parent and content processes having different
// versions.
MessageChannel* channel = GetIPCChannel();
if (channel && !channel->SendBuildIDsMatchMessage(aParentBuildID)) {
// We need to quit this process if the buildID doesn't match the parent's.
// This can occur when an update occurred in the background.
ipc::ProcessChild::QuickExit();
}
CrashReporterClient::InitSingleton(this);
if (NS_WARN_IF(NS_FAILED(NS_InitMinimalXPCOM()))) {
return false;
}
mPluginPath = aPluginPath;
nsAutoCString processName("GMPlugin Process");
nsAutoCString pluginName;
if (GetPluginName(pluginName)) {
processName.AppendLiteral(" (");
processName.Append(pluginName);
processName.AppendLiteral(")");
}
profiler_set_process_name(processName);
return true;
}
@ -285,24 +258,6 @@ bool GMPChild::GetUTF8LibPath(nsACString& aOutLibPath) {
return true;
}
bool GMPChild::GetPluginName(nsACString& aPluginName) const {
// Extract the plugin directory name if possible.
nsCOMPtr<nsIFile> libFile;
nsresult rv = NS_NewLocalFile(mPluginPath, true, getter_AddRefs(libFile));
NS_ENSURE_SUCCESS(rv, false);
nsCOMPtr<nsIFile> parent;
rv = libFile->GetParent(getter_AddRefs(parent));
NS_ENSURE_SUCCESS(rv, false);
nsAutoString parentLeafName;
rv = parent->GetLeafName(parentLeafName);
NS_ENSURE_SUCCESS(rv, false);
aPluginName.Assign(NS_ConvertUTF16toUTF8(parentLeafName));
return true;
}
static nsCOMPtr<nsIFile> AppendFile(nsCOMPtr<nsIFile>&& aFile,
const nsString& aStr) {
return (aFile && NS_SUCCEEDED(aFile->Append(aStr))) ? aFile : nullptr;
@ -697,11 +652,6 @@ mozilla::ipc::IPCResult GMPChild::RecvInitProfiler(
return IPC_OK();
}
mozilla::ipc::IPCResult GMPChild::RecvPreferenceUpdate(const Pref& aPref) {
Preferences::SetPreference(aPref);
return IPC_OK();
}
} // namespace gmp
} // namespace mozilla

Просмотреть файл

@ -29,7 +29,7 @@ class GMPChild : public PGMPChild {
GMPChild();
bool Init(const nsAString& aPluginPath, const char* aParentBuildID,
bool Init(const nsAString& aPluginPath,
mozilla::ipc::UntypedEndpoint&& aEndpoint);
MessageLoop* GMPMessageLoop();
@ -48,8 +48,6 @@ class GMPChild : public PGMPChild {
bool GetUTF8LibPath(nsACString& aOutLibPath);
bool GetPluginName(nsACString& aPluginName) const;
mozilla::ipc::IPCResult RecvProvideStorageId(const nsCString& aStorageId);
mozilla::ipc::IPCResult RecvStartPlugin(const nsString& aAdapter);
@ -77,8 +75,6 @@ class GMPChild : public PGMPChild {
mozilla::ipc::IPCResult RecvInitProfiler(
Endpoint<mozilla::PProfilerChild>&& aEndpoint);
mozilla::ipc::IPCResult RecvPreferenceUpdate(const Pref& aPref);
void ActorDestroy(ActorDestroyReason aWhy) override;
void ProcessingError(Result aCode, const char* aReason) override;

Просмотреть файл

@ -17,10 +17,6 @@ namespace mozilla::gmp {
class GMPChild;
/**
* This class allows the GMP process to receive requests to create GMP
* decoder/encoder objects on behalf of the parent/content processes.
*/
class GMPContentChild : public PGMPContentChild, public GMPSharedMem {
public:
// Mark AddRef and Release as `final`, as they overload pure virtual

Просмотреть файл

@ -199,22 +199,4 @@ nsresult GMPContentParent::GetGMPVideoEncoder(GMPVideoEncoderParent** aGMPVE) {
return NS_OK;
}
void GMPContentParentCloseBlocker::Destroy() {
MOZ_ASSERT(mParent);
MOZ_ASSERT(mEventTarget);
if (!mEventTarget->IsOnCurrentThread()) {
mEventTarget->Dispatch(NS_NewRunnableFunction(
__func__, [parent = std::move(mParent), eventTarget = mEventTarget]() {
parent->RemoveCloseBlocker();
}));
mEventTarget = nullptr;
return;
}
mParent->RemoveCloseBlocker();
mParent = nullptr;
mEventTarget = nullptr;
}
} // namespace mozilla::gmp

Просмотреть файл

@ -13,16 +13,11 @@
namespace mozilla::gmp {
class GMPContentParentCloseBlocker;
class GMPParent;
class GMPVideoDecoderParent;
class GMPVideoEncoderParent;
class ChromiumCDMParent;
/**
* This class allows the parent/content processes to create GMP decoder/encoder
* objects in the GMP process.
*/
class GMPContentParent final : public PGMPContentParent, public GMPSharedMem {
friend class PGMPContentParent;
@ -57,9 +52,20 @@ class GMPContentParent final : public PGMPContentParent, public GMPSharedMem {
void SetPluginType(GMPPluginType aPluginType) { mPluginType = aPluginType; }
GMPPluginType GetPluginType() const { return mPluginType; }
private:
friend class GMPContentParentCloseBlocker;
class CloseBlocker {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CloseBlocker)
explicit CloseBlocker(GMPContentParent* aParent) : mParent(aParent) {
mParent->AddCloseBlocker();
}
RefPtr<GMPContentParent> mParent;
private:
~CloseBlocker() { mParent->RemoveCloseBlocker(); }
};
private:
void AddCloseBlocker();
void RemoveCloseBlocker();
@ -83,26 +89,6 @@ class GMPContentParent final : public PGMPContentParent, public GMPSharedMem {
uint32_t mCloseBlockerCount = 0;
};
class GMPContentParentCloseBlocker final {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPContentParentCloseBlocker)
explicit GMPContentParentCloseBlocker(GMPContentParent* aParent)
: mParent(aParent), mEventTarget(aParent->GMPEventTarget()) {
MOZ_ASSERT(mEventTarget);
mParent->AddCloseBlocker();
}
void Destroy();
RefPtr<GMPContentParent> mParent;
private:
nsCOMPtr<nsISerialEventTarget> mEventTarget;
~GMPContentParentCloseBlocker() { Destroy(); }
};
} // namespace mozilla::gmp
#endif // GMPParent_h_

Просмотреть файл

@ -405,17 +405,6 @@ nsresult GMPParent::LoadProcess() {
return NS_OK;
}
void GMPParent::OnPreferenceChange(const mozilla::dom::Pref& aPref) {
MOZ_ASSERT(GMPEventTarget()->IsOnCurrentThread());
GMP_PARENT_LOG_DEBUG("%s", __FUNCTION__);
if (!mProcess) {
return;
}
Unused << SendPreferenceUpdate(aPref);
}
mozilla::ipc::IPCResult GMPParent::RecvPGMPContentChildDestroyed() {
--mGMPContentChildCount;
if (!IsUsed()) {
@ -1106,8 +1095,8 @@ void GMPParent::ResolveGetContentParentPromises() {
nsTArray<UniquePtr<MozPromiseHolder<GetGMPContentParentPromise>>> promises =
std::move(mGetContentParentPromises);
MOZ_ASSERT(mGetContentParentPromises.IsEmpty());
RefPtr<GMPContentParentCloseBlocker> blocker(
new GMPContentParentCloseBlocker(mGMPContentParent));
RefPtr<GMPContentParent::CloseBlocker> blocker(
new GMPContentParent::CloseBlocker(mGMPContentParent));
for (auto& holder : promises) {
holder->Resolve(blocker, __func__);
}
@ -1154,8 +1143,8 @@ void GMPParent::GetGMPContentParent(
GMP_PARENT_LOG_DEBUG("%s %p", __FUNCTION__, this);
if (mGMPContentParent) {
RefPtr<GMPContentParentCloseBlocker> blocker(
new GMPContentParentCloseBlocker(mGMPContentParent));
RefPtr<GMPContentParent::CloseBlocker> blocker(
new GMPContentParent::CloseBlocker(mGMPContentParent));
aPromiseHolder->Resolve(blocker, __func__);
} else {
mGetContentParentPromises.AppendElement(std::move(aPromiseHolder));

Просмотреть файл

@ -87,8 +87,6 @@ class GMPParent final
GMPState State() const;
nsCOMPtr<nsISerialEventTarget> GMPEventTarget();
void OnPreferenceChange(const mozilla::dom::Pref& aPref);
// A GMP can either be a single instance shared across all NodeIds (like
// in the OpenH264 case), or we can require a new plugin instance for every
// NodeIds running the plugin (as in the EME plugin case).

Просмотреть файл

@ -9,7 +9,6 @@
#include "base/string_util.h"
#include "mozilla/ipc/IOThreadChild.h"
#include "mozilla/BackgroundHangMonitor.h"
#include "mozilla/GeckoArgs.h"
using mozilla::ipc::IOThreadChild;
@ -18,24 +17,27 @@ namespace mozilla::gmp {
GMPProcessChild::~GMPProcessChild() = default;
bool GMPProcessChild::Init(int aArgc, char* aArgv[]) {
Maybe<const char*> parentBuildID =
geckoargs::sParentBuildID.Get(aArgc, aArgv);
if (NS_WARN_IF(parentBuildID.isNothing())) {
return false;
}
nsAutoString pluginFilename;
Maybe<const char*> pluginPath = geckoargs::sPluginPath.Get(aArgc, aArgv);
if (NS_WARN_IF(pluginPath.isNothing())) {
return false;
}
#if defined(XP_UNIX)
// NB: need to be very careful in ensuring that the first arg
// (after the binary name) here is indeed the plugin module path.
// Keep in sync with dom/plugins/PluginModuleParent.
std::vector<std::string> values = CommandLine::ForCurrentProcess()->argv();
MOZ_ASSERT(values.size() >= 2, "not enough args");
CopyUTF8toUTF16(nsDependentCString(values[1].c_str()), pluginFilename);
#elif defined(XP_WIN)
std::vector<std::wstring> values =
CommandLine::ForCurrentProcess()->GetLooseValues();
MOZ_ASSERT(values.size() >= 1, "not enough loose args");
pluginFilename = nsDependentString(values[0].c_str());
#else
# error Not implemented
#endif
NS_ConvertUTF8toUTF16 widePluginPath(*pluginPath);
BackgroundHangMonitor::Startup();
if (!ProcessChild::InitPrefs(aArgc, aArgv)) {
return false;
}
return mPlugin->Init(widePluginPath, *parentBuildID, TakeInitialEndpoint());
return mPlugin->Init(pluginFilename, TakeInitialEndpoint());
}
void GMPProcessChild::CleanUp() { BackgroundHangMonitor::Shutdown(); }

Просмотреть файл

@ -11,9 +11,6 @@
# include "WinUtils.h"
#endif
#include "GMPLog.h"
#include "mozilla/GeckoArgs.h"
#include "mozilla/ipc/ProcessChild.h"
#include "mozilla/ipc/ProcessUtils.h"
#include "base/string_util.h"
#include "base/process_util.h"
@ -83,73 +80,7 @@ GMPProcessParent::GMPProcessParent(const std::string& aGMPPath)
GMPProcessParent::~GMPProcessParent() { MOZ_COUNT_DTOR(GMPProcessParent); }
bool GMPProcessParent::Launch(int32_t aTimeoutMs) {
class PrefSerializerRunnable final : public Runnable {
public:
PrefSerializerRunnable()
: Runnable("GMPProcessParent::PrefSerializerRunnable"),
mMonitor("GMPProcessParent::PrefSerializerRunnable::mMonitor") {}
NS_IMETHOD Run() override {
auto prefSerializer = MakeUnique<ipc::SharedPreferenceSerializer>();
bool success =
prefSerializer->SerializeToSharedMemory(GeckoProcessType_GMPlugin,
/* remoteType */ ""_ns);
MonitorAutoLock lock(mMonitor);
MOZ_ASSERT(!mComplete);
if (success) {
mPrefSerializer = std::move(prefSerializer);
}
mComplete = true;
lock.Notify();
return NS_OK;
}
void Wait(int32_t aTimeoutMs,
UniquePtr<ipc::SharedPreferenceSerializer>& aOut) {
MonitorAutoLock lock(mMonitor);
TimeDuration timeout = TimeDuration::FromMilliseconds(aTimeoutMs);
while (!mComplete) {
if (lock.Wait(timeout) == CVStatus::Timeout) {
return;
}
}
aOut = std::move(mPrefSerializer);
}
private:
Monitor mMonitor;
UniquePtr<ipc::SharedPreferenceSerializer> mPrefSerializer
MOZ_GUARDED_BY(mMonitor);
bool mComplete MOZ_GUARDED_BY(mMonitor) = false;
};
// Dispatch our runnable to the main thread to grab the serialized prefs. We
// can only do this on the main thread, and unfortunately we are the only
// process that launches from the non-main thread.
auto prefTask = MakeRefPtr<PrefSerializerRunnable>();
nsresult rv = NS_DispatchToMainThread(prefTask);
if (NS_WARN_IF(NS_FAILED(rv))) {
return false;
}
// We don't want to release our thread context while we wait for the main
// thread to process the prefs. We already block when waiting for the launch
// of the process itself to finish, and the state machine assumes this call is
// blocking. This is also important for the buffering of pref updates, since
// we know any tasks dispatched with updates won't run until we launch (or
// fail to launch) the process.
UniquePtr<ipc::SharedPreferenceSerializer> prefSerializer;
prefTask->Wait(aTimeoutMs, prefSerializer);
if (NS_WARN_IF(!prefSerializer)) {
return false;
}
vector<string> args;
ipc::ProcessChild::AddPlatformBuildID(args);
prefSerializer->AddSharedPrefCmdLineArgs(*this, args);
#ifdef ALLOW_GECKO_CHILD_PROCESS_ARCH
GMP_LOG_DEBUG("GMPProcessParent::Launch() mLaunchArch: %d", mLaunchArch);
@ -169,7 +100,7 @@ bool GMPProcessParent::Launch(int32_t aTimeoutMs) {
#else
nsAutoCString normalizedPath;
#endif
rv = NormalizePath(mGMPPath.c_str(), normalizedPath);
nsresult rv = NormalizePath(mGMPPath.c_str(), normalizedPath);
if (NS_WARN_IF(NS_FAILED(rv))) {
GMP_LOG_DEBUG(
"GMPProcessParent::Launch: "
@ -213,13 +144,12 @@ bool GMPProcessParent::Launch(int32_t aTimeoutMs) {
}
# endif
std::string gmpPath = WideToUTF8(wGMPPath);
geckoargs::sPluginPath.Put(gmpPath.c_str(), args);
args.push_back(WideToUTF8(wGMPPath));
#else
if (NS_SUCCEEDED(rv)) {
geckoargs::sPluginPath.Put(normalizedPath.get(), args);
args.push_back(normalizedPath.get());
} else {
geckoargs::sPluginPath.Put(mGMPPath.c_str(), args);
args.push_back(mGMPPath);
}
#endif
@ -229,10 +159,6 @@ bool GMPProcessParent::Launch(int32_t aTimeoutMs) {
AddFdToRemap(kInvalidFd, kInvalidFd);
AddFdToRemap(kInvalidFd, kInvalidFd);
#endif
// We need to wait until OnChannelConnected to clear the pref serializer, but
// SyncLaunch will block until that is called, so we don't actually need to do
// any overriding, and it only lives on the stack.
return SyncLaunch(args, aTimeoutMs);
}

Просмотреть файл

@ -257,7 +257,7 @@ RefPtr<GetCDMParentPromise> GeckoMediaPluginService::GetCDM(
->Then(
thread, __func__,
[rawHolder, helper, keySystem = nsCString{aKeySystem}](
const RefPtr<GMPContentParentCloseBlocker>& wrapper) {
RefPtr<GMPContentParent::CloseBlocker> wrapper) {
RefPtr<GMPContentParent> parent = wrapper->mParent;
MOZ_ASSERT(
parent,
@ -319,7 +319,7 @@ GeckoMediaPluginService::GetContentParentForTest() {
nsLiteralCString(CHROMIUM_CDM_API), tags)
->Then(
thread, __func__,
[rawHolder](const RefPtr<GMPContentParentCloseBlocker>& wrapper) {
[rawHolder](const RefPtr<GMPContentParent::CloseBlocker>& wrapper) {
RefPtr<GMPContentParent> parent = wrapper->mParent;
MOZ_ASSERT(
parent,
@ -460,7 +460,7 @@ GeckoMediaPluginService::GetGMPVideoDecoder(
->Then(
thread, __func__,
[rawCallback,
helper](const RefPtr<GMPContentParentCloseBlocker>& wrapper) {
helper](RefPtr<GMPContentParent::CloseBlocker> wrapper) {
RefPtr<GMPContentParent> parent = wrapper->mParent;
UniquePtr<GetGMPVideoDecoderCallback> callback(rawCallback);
GMPVideoDecoderParent* actor = nullptr;
@ -500,7 +500,7 @@ GeckoMediaPluginService::GetGMPVideoEncoder(
->Then(
thread, __func__,
[rawCallback,
helper](const RefPtr<GMPContentParentCloseBlocker>& wrapper) {
helper](RefPtr<GMPContentParent::CloseBlocker> wrapper) {
RefPtr<GMPContentParent> parent = wrapper->mParent;
UniquePtr<GetGMPVideoEncoderCallback> callback(rawCallback);
GMPVideoEncoderParent* actor = nullptr;

Просмотреть файл

@ -38,11 +38,12 @@ extern GMPLogLevel GetGMPLibraryLogLevel();
namespace gmp {
using GetGMPContentParentPromise =
MozPromise<RefPtr<GMPContentParentCloseBlocker>, MediaResult,
/* IsExclusive = */ true>;
using GetCDMParentPromise = MozPromise<RefPtr<ChromiumCDMParent>, MediaResult,
/* IsExclusive = */ true>;
typedef MozPromise<RefPtr<GMPContentParent::CloseBlocker>, MediaResult,
/* IsExclusive = */ true>
GetGMPContentParentPromise;
typedef MozPromise<RefPtr<ChromiumCDMParent>, MediaResult,
/* IsExclusive = */ true>
GetCDMParentPromise;
class GeckoMediaPluginService : public mozIGeckoMediaPluginService,
public nsIObserver {

Просмотреть файл

@ -5,6 +5,7 @@
#include "GMPServiceChild.h"
#include "GMPContentParent.h"
#include "GMPLog.h"
#include "GMPParent.h"
#include "base/task.h"
@ -121,112 +122,67 @@ GeckoMediaPluginServiceChild::GetContentParent(
thread, __func__,
[nodeIdVariant = aNodeIdVariant, self, api, tags = aTags.Clone(), helper,
rawHolder](GMPServiceChild* child) {
UniquePtr<MozPromiseHolder<GetGMPContentParentPromise>> holder(
rawHolder);
nsresult rv;
nsTArray<base::ProcessId> alreadyBridgedTo;
child->GetAlreadyBridgedTo(alreadyBridgedTo);
// We want to force the content process to keep all of our
// GMPContentParent IPDL objects alive while we wait to resolve which
// process can satisfy our request. This avoids a race condition where
// the last dependency is released before we can acquire our own.
auto* rawBlockers =
new nsTArray<RefPtr<GMPContentParentCloseBlocker>>();
child->GetAndBlockAlreadyBridgedTo(alreadyBridgedTo, *rawBlockers);
base::ProcessId otherProcess;
nsCString displayName;
uint32_t pluginId = 0;
GMPPluginType pluginType = GMPPluginType::Unknown;
ipc::Endpoint<PGMPContentParent> endpoint;
nsCString errorDescription;
child->SendLaunchGMP(
nodeIdVariant, api, tags, alreadyBridgedTo,
[rawHolder, self, helper, rawBlockers,
child = RefPtr{child}](GMPLaunchResult&& aResult) {
UniquePtr<MozPromiseHolder<GetGMPContentParentPromise>> holder(
rawHolder);
UniquePtr<nsTArray<RefPtr<GMPContentParentCloseBlocker>>>
blockers(rawBlockers);
if (helper && aResult.pluginId()) {
// Note: Even if the launch failed, we need to connect the crash
// helper so that if the launch failed due to the plugin
// crashing, we can report the crash via the crash reporter. The
// crash handling notification will arrive shortly if the launch
// failed due to the plugin crashing.
self->ConnectCrashHelper(aResult.pluginId(), helper);
}
bool ok = child->SendLaunchGMP(
nodeIdVariant, api, tags, alreadyBridgedTo, &pluginId, &pluginType,
&otherProcess, &displayName, &endpoint, &rv, &errorDescription);
if (NS_WARN_IF(NS_FAILED(aResult.result()))) {
MediaResult error(
aResult.result(),
nsPrintfCString(
"GeckoMediaPluginServiceChild::GetContentParent "
"SendLaunchGMPForNodeId failed with description (%s)",
aResult.errorDescription().get()));
if (helper && pluginId) {
// Note: Even if the launch failed, we need to connect the crash
// helper so that if the launch failed due to the plugin crashing, we
// can report the crash via the crash reporter. The crash handling
// notification will arrive shortly if the launch failed due to the
// plugin crashing.
self->ConnectCrashHelper(pluginId, helper);
}
GMP_LOG_DEBUG("%s failed to launch GMP with error: %s",
__CLASS__, aResult.errorDescription().get());
self->mPendingGetContentParents -= 1;
self->RemoveShutdownBlockerIfNeeded();
if (!ok || NS_FAILED(rv)) {
MediaResult error(
rv, nsPrintfCString(
"GeckoMediaPluginServiceChild::GetContentParent "
"SendLaunchGMPForNodeId failed with description (%s)",
errorDescription.get()));
holder->Reject(error, __func__);
return;
}
GMP_LOG_DEBUG("%s failed to launch GMP with error: %s", __CLASS__,
error.Description().get());
self->mPendingGetContentParents -= 1;
self->RemoveShutdownBlockerIfNeeded();
// If we didn't explicitly fail, we should have been told about a
// process running.
MOZ_ASSERT(aResult.pid() != base::kInvalidProcessId);
holder->Reject(error, __func__);
return;
}
// It is possible the GMP process may have terminated before we
// were able to process this result. In that case, we should just
// fail as normal as the initialization of the IPDL objects would
// have just failed anyways and produced the same result.
bool contains = child->HasAlreadyBridgedTo(aResult.pid());
if (NS_WARN_IF(!contains && !aResult.endpoint().IsValid())) {
MediaResult error(
aResult.result(),
"GeckoMediaPluginServiceChild::GetContentParent "
"SendLaunchGMPForNodeId failed with process exit"_ns);
RefPtr<GMPContentParent> parent = child->GetBridgedGMPContentParent(
otherProcess, std::move(endpoint));
if (!alreadyBridgedTo.Contains(otherProcess)) {
parent->SetDisplayName(displayName);
parent->SetPluginId(pluginId);
parent->SetPluginType(pluginType);
}
GMP_LOG_DEBUG("%s failed to launch GMP with process exit",
__CLASS__);
self->mPendingGetContentParents -= 1;
self->RemoveShutdownBlockerIfNeeded();
// The content parent is no longer pending.
self->mPendingGetContentParents -= 1;
MOZ_ASSERT(child->HaveContentParents(),
"We should have at least one content parent!");
// We don't check if we need to remove the shutdown blocker here as
// we should always have at least one live content parent.
holder->Reject(error, __func__);
return;
}
RefPtr<GMPContentParent> parent =
child->GetBridgedGMPContentParent(
aResult.pid(), std::move(aResult.endpoint()));
if (!contains) {
parent->SetDisplayName(aResult.displayName());
parent->SetPluginId(aResult.pluginId());
parent->SetPluginType(aResult.pluginType());
}
// The content parent is no longer pending.
self->mPendingGetContentParents -= 1;
MOZ_ASSERT(child->HaveContentParents(),
"We should have at least one content parent!");
// We don't check if we need to remove the shutdown blocker here
// as we should always have at least one live content parent.
RefPtr<GMPContentParentCloseBlocker> blocker(
new GMPContentParentCloseBlocker(parent));
holder->Resolve(blocker, __func__);
},
[rawHolder, self, helper,
rawBlockers](const ipc::ResponseRejectReason&) {
UniquePtr<MozPromiseHolder<GetGMPContentParentPromise>> holder(
rawHolder);
UniquePtr<nsTArray<RefPtr<GMPContentParentCloseBlocker>>>
blockers(rawBlockers);
MediaResult error(
NS_ERROR_FAILURE,
"GeckoMediaPluginServiceChild::GetContentParent "
"SendLaunchGMPForNodeId failed with IPC error"_ns);
GMP_LOG_DEBUG("%s failed to launch GMP with IPC error",
__CLASS__);
self->mPendingGetContentParents -= 1;
self->RemoveShutdownBlockerIfNeeded();
holder->Reject(error, __func__);
});
RefPtr<GMPContentParent::CloseBlocker> blocker(
new GMPContentParent::CloseBlocker(parent));
holder->Resolve(blocker, __func__);
},
[self, rawHolder](MediaResult result) {
self->mPendingGetContentParents -= 1;
@ -364,16 +320,14 @@ GeckoMediaPluginServiceChild::GetNodeId(
GetServiceChild()->Then(
thread, __func__,
[rawCallback, origin, topLevelOrigin, gmpName](GMPServiceChild* child) {
child->SendGetGMPNodeId(
origin, topLevelOrigin, gmpName,
[rawCallback](nsCString&& aId) {
UniquePtr<GetNodeIdCallback> callback(rawCallback);
callback->Done(NS_OK, aId);
},
[rawCallback](const ipc::ResponseRejectReason&) {
UniquePtr<GetNodeIdCallback> callback(rawCallback);
callback->Done(NS_ERROR_FAILURE, ""_ns);
});
UniquePtr<GetNodeIdCallback> callback(rawCallback);
nsCString outId;
if (!child->SendGetGMPNodeId(origin, topLevelOrigin, gmpName, &outId)) {
callback->Done(NS_ERROR_FAILURE, ""_ns);
return;
}
callback->Done(NS_OK, outId);
},
[rawCallback](nsresult rv) {
UniquePtr<GetNodeIdCallback> callback(rawCallback);
@ -550,19 +504,9 @@ void GMPServiceChild::RemoveGMPContentParent(
}
}
bool GMPServiceChild::HasAlreadyBridgedTo(base::ProcessId aPid) const {
return mContentParents.Contains(aPid);
}
void GMPServiceChild::GetAndBlockAlreadyBridgedTo(
nsTArray<base::ProcessId>& aAlreadyBridgedTo,
nsTArray<RefPtr<GMPContentParentCloseBlocker>>& aBlockers) {
aAlreadyBridgedTo.SetCapacity(mContentParents.Count());
aBlockers.SetCapacity(mContentParents.Count());
for (auto iter = mContentParents.Iter(); !iter.Done(); iter.Next()) {
aAlreadyBridgedTo.AppendElement(iter.Key());
aBlockers.AppendElement(new GMPContentParentCloseBlocker(iter.UserData()));
}
void GMPServiceChild::GetAlreadyBridgedTo(
nsTArray<base::ProcessId>& aAlreadyBridgedTo) {
AppendToArray(aAlreadyBridgedTo, mContentParents.Keys());
}
class OpenPGMPServiceChild : public mozilla::Runnable {

Просмотреть файл

@ -18,7 +18,6 @@
namespace mozilla::gmp {
class GMPContentParent;
class GMPContentParentCloseBlocker;
class GMPServiceChild;
class GeckoMediaPluginServiceChild : public GeckoMediaPluginService,
@ -133,10 +132,6 @@ class GeckoMediaPluginServiceChild : public GeckoMediaPluginService,
// End shutdown blocker management.
};
/**
* This class runs in the content process, and allows the content process to
* request an IPC connection to the desired GMP process.
*/
class GMPServiceChild : public PGMPServiceChild {
public:
// Mark AddRef and Release as `final`, as they overload pure virtual
@ -150,11 +145,7 @@ class GMPServiceChild : public PGMPServiceChild {
void RemoveGMPContentParent(GMPContentParent* aGMPContentParent);
bool HasAlreadyBridgedTo(base::ProcessId aPid) const;
void GetAndBlockAlreadyBridgedTo(
nsTArray<ProcessId>& aAlreadyBridgedTo,
nsTArray<RefPtr<GMPContentParentCloseBlocker>>& aBlockers);
void GetAlreadyBridgedTo(nsTArray<ProcessId>& aAlreadyBridgedTo);
static bool Create(Endpoint<PGMPServiceChild>&& aGMPService);

Просмотреть файл

@ -111,7 +111,6 @@ nsresult GeckoMediaPluginServiceParent::Init() {
obsService->AddObserver(this, "browser:purge-session-history", false));
MOZ_ALWAYS_SUCCEEDS(
obsService->AddObserver(this, NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID, false));
MOZ_ALWAYS_SUCCEEDS(obsService->AddObserver(this, "nsPref:changed", false));
#ifdef DEBUG
MOZ_ALWAYS_SUCCEEDS(obsService->AddObserver(
@ -329,45 +328,11 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject,
"gmp::GeckoMediaPluginServiceParent::ClearRecentHistoryOnGMPThread",
this, &GeckoMediaPluginServiceParent::ClearRecentHistoryOnGMPThread,
t));
} else if (!strcmp("nsPref:changed", aTopic)) {
bool hasProcesses = false;
{
MutexAutoLock lock(mMutex);
for (const auto& plugin : mPlugins) {
if (plugin->State() == GMPState::Loaded) {
hasProcesses = true;
break;
}
}
}
if (hasProcesses) {
// We know prefs are ASCII here.
NS_LossyConvertUTF16toASCII strData(aSomeData);
mozilla::dom::Pref pref(strData, /* isLocked */ false,
/* isSanitized */ false, Nothing(), Nothing());
Preferences::GetPreference(&pref, GeckoProcessType_GMPlugin,
/* remoteType */ ""_ns);
return GMPDispatch(NewRunnableMethod<mozilla::dom::Pref&&>(
"gmp::GeckoMediaPluginServiceParent::OnPreferenceChanged", this,
&GeckoMediaPluginServiceParent::OnPreferenceChanged,
std::move(pref)));
}
}
return NS_OK;
}
void GeckoMediaPluginServiceParent::OnPreferenceChanged(
mozilla::dom::Pref&& aPref) {
AssertOnGMPThread();
MutexAutoLock lock(mMutex);
for (const auto& plugin : mPlugins) {
plugin->OnPreferenceChange(aPref);
}
}
RefPtr<GenericPromise> GeckoMediaPluginServiceParent::EnsureInitialized() {
MonitorAutoLock lock(mInitPromiseMonitor);
if (mLoadPluginsFromDiskComplete) {
@ -1829,94 +1794,82 @@ GMPServiceParent::~GMPServiceParent() {
mozilla::ipc::IPCResult GMPServiceParent::RecvLaunchGMP(
const NodeIdVariant& aNodeIdVariant, const nsACString& aAPI,
nsTArray<nsCString>&& aTags, nsTArray<ProcessId>&& aAlreadyBridgedTo,
LaunchGMPResolver&& aResolve) {
GMPLaunchResult result;
uint32_t* aOutPluginId, GMPPluginType* aOutPluginType,
ProcessId* aOutProcessId, nsCString* aOutDisplayName,
Endpoint<PGMPContentParent>* aOutEndpoint, nsresult* aOutRv,
nsCString* aOutErrorDescription) {
if (mService->IsShuttingDown()) {
result.pluginId() = 0;
result.pluginType() = GMPPluginType::Unknown;
result.pid() = base::kInvalidProcessId;
result.result() = NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
result.errorDescription() = "Service is shutting down."_ns;
aResolve(std::move(result));
*aOutRv = NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
*aOutErrorDescription = "Service is shutting down."_ns;
*aOutPluginId = 0;
*aOutPluginType = GMPPluginType::Unknown;
return IPC_OK();
}
nsCString nodeIdString;
nsresult rv = mService->GetNodeId(aNodeIdVariant, nodeIdString);
if (NS_WARN_IF(NS_FAILED(rv))) {
result.pluginId() = 0;
result.pluginType() = GMPPluginType::Unknown;
result.pid() = base::kInvalidProcessId;
result.result() = rv;
result.errorDescription() = "GetNodeId failed."_ns;
aResolve(std::move(result));
if (!NS_SUCCEEDED(rv)) {
*aOutRv = rv;
*aOutErrorDescription = "GetNodeId failed."_ns;
*aOutPluginId = 0;
*aOutPluginType = GMPPluginType::Unknown;
return IPC_OK();
}
RefPtr<GMPParent> gmp =
mService->SelectPluginForAPI(nodeIdString, aAPI, aTags);
if (gmp) {
result.pluginId() = gmp->GetPluginId();
result.pluginType() = gmp->GetPluginType();
*aOutPluginId = gmp->GetPluginId();
*aOutPluginType = gmp->GetPluginType();
} else {
result.pluginId() = 0;
result.pluginType() = GMPPluginType::Unknown;
result.pid() = base::kInvalidProcessId;
result.result() = NS_ERROR_FAILURE;
result.errorDescription() = "SelectPluginForAPI returns nullptr."_ns;
aResolve(std::move(result));
*aOutRv = NS_ERROR_FAILURE;
*aOutErrorDescription = "SelectPluginForAPI returns nullptr."_ns;
*aOutPluginId = 0;
*aOutPluginType = GMPPluginType::Unknown;
return IPC_OK();
}
if (!gmp->EnsureProcessLoaded(&result.pid())) {
result.pid() = base::kInvalidProcessId;
result.result() = NS_ERROR_FAILURE;
result.errorDescription() = "Process has not loaded."_ns;
aResolve(std::move(result));
if (!gmp->EnsureProcessLoaded(aOutProcessId)) {
*aOutRv = NS_ERROR_FAILURE;
*aOutErrorDescription = "Process has not loaded."_ns;
return IPC_OK();
}
MOZ_ASSERT(result.pid() != base::kInvalidProcessId);
*aOutDisplayName = gmp->GetDisplayName();
result.displayName() = gmp->GetDisplayName();
if (aAlreadyBridgedTo.Contains(result.pid())) {
result.result() = NS_OK;
aResolve(std::move(result));
if (aAlreadyBridgedTo.Contains(*aOutProcessId)) {
*aOutRv = NS_OK;
return IPC_OK();
}
Endpoint<PGMPContentParent> parent;
Endpoint<PGMPContentChild> child;
rv = PGMPContent::CreateEndpoints(OtherPid(), result.pid(), &parent, &child);
rv =
PGMPContent::CreateEndpoints(OtherPid(), *aOutProcessId, &parent, &child);
if (NS_WARN_IF(NS_FAILED(rv))) {
result.result() = rv;
result.errorDescription() = "PGMPContent::CreateEndpoints failed."_ns;
aResolve(std::move(result));
*aOutRv = rv;
*aOutErrorDescription = "PGMPContent::CreateEndpoints failed."_ns;
return IPC_OK();
}
*aOutEndpoint = std::move(parent);
if (!gmp->SendInitGMPContentChild(std::move(child))) {
result.result() = NS_ERROR_FAILURE;
result.errorDescription() = "SendInitGMPContentChild failed."_ns;
*aOutRv = NS_ERROR_FAILURE;
*aOutErrorDescription = "SendInitGMPContentChild failed."_ns;
return IPC_OK();
}
gmp->IncrementGMPContentChildCount();
result.result() = NS_OK;
result.endpoint() = std::move(parent);
aResolve(std::move(result));
*aOutRv = NS_OK;
return IPC_OK();
}
mozilla::ipc::IPCResult GMPServiceParent::RecvGetGMPNodeId(
const nsAString& aOrigin, const nsAString& aTopLevelOrigin,
const nsAString& aGMPName, GetGMPNodeIdResolver&& aResolve) {
nsCString id;
nsresult rv = mService->GetNodeId(aOrigin, aTopLevelOrigin, aGMPName, id);
aResolve(id);
const nsAString& aGMPName, nsCString* aID) {
nsresult rv = mService->GetNodeId(aOrigin, aTopLevelOrigin, aGMPName, *aID);
if (!NS_SUCCEEDED(rv)) {
return IPC_FAIL(
this,

Просмотреть файл

@ -91,7 +91,6 @@ class GeckoMediaPluginServiceParent final
private:
friend class GMPServiceParent;
class Observer;
virtual ~GeckoMediaPluginServiceParent();
@ -127,7 +126,6 @@ class GeckoMediaPluginServiceParent final
const mozilla::OriginAttributesPattern& aPattern);
void ForgetThisBaseDomainOnGMPThread(const nsACString& aBaseDomain);
void ClearRecentHistoryOnGMPThread(PRTime aSince);
void OnPreferenceChanged(mozilla::dom::Pref&& aPref);
already_AddRefed<GMPParent> GetById(uint32_t aPluginId);
@ -241,11 +239,6 @@ bool MatchOrigin(nsIFile* aPath, const nsACString& aSite,
const mozilla::OriginAttributesPattern& aPattern);
bool MatchBaseDomain(nsIFile* aPath, const nsACString& aBaseDomain);
/**
* This class runs in the parent process, and manages the lifecycle of the GMP
* process and brokering the creation of PGMPContent between the parent/content
* processes and the GMP process.
*/
class GMPServiceParent final : public PGMPServiceParent {
public:
explicit GMPServiceParent(GeckoMediaPluginServiceParent* aService);
@ -264,15 +257,17 @@ class GMPServiceParent final : public PGMPServiceParent {
ipc::IPCResult RecvGetGMPNodeId(const nsAString& aOrigin,
const nsAString& aTopLevelOrigin,
const nsAString& aGMPName,
GetGMPNodeIdResolver&& aResolve) override;
nsCString* aID) override;
static bool Create(Endpoint<PGMPServiceParent>&& aGMPService);
ipc::IPCResult RecvLaunchGMP(const NodeIdVariant& aNodeIdVariant,
const nsACString& aAPI,
nsTArray<nsCString>&& aTags,
nsTArray<ProcessId>&& aAlreadyBridgedTo,
LaunchGMPResolver&& aResolve) override;
ipc::IPCResult RecvLaunchGMP(
const NodeIdVariant& aNodeIdVariant, const nsACString& aAPI,
nsTArray<nsCString>&& aTags, nsTArray<ProcessId>&& aAlreadyBridgedTo,
uint32_t* aOutPluginId, GMPPluginType* aOutPluginType,
ProcessId* aOutProcessId, nsCString* aOutDisplayName,
Endpoint<PGMPContentParent>* aOutEndpoint, nsresult* aOutRv,
nsCString* aOutErrorDescription) override;
private:
~GMPServiceParent();

Просмотреть файл

@ -3,7 +3,6 @@
* 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 PrefsTypes;
include protocol PGMPContent;
include protocol PGMPTimer;
include protocol PGMPStorage;
@ -44,7 +43,6 @@ child:
async CloseActive();
async InitGMPContentChild(Endpoint<PGMPContentChild> endpoint);
async InitProfiler(Endpoint<PProfilerChild> endpoint);
async PreferenceUpdate(Pref pref);
// Tells the GMP process to flush any pending telemetry.
// Used in tests and ping assembly. Buffer contains bincoded Rust structs.

Просмотреть файл

@ -6,34 +6,29 @@
include protocol PGMPContent;
include GMPTypes;
using mozilla::ipc::Endpoint from "mozilla/ipc/Endpoint.h";
using base::ProcessId from "base/process.h";
using GMPPluginType from "GMPNativeTypes.h";
namespace mozilla {
namespace gmp {
struct GMPLaunchResult {
uint32_t pluginId;
GMPPluginType pluginType;
ProcessId pid;
nsCString displayName;
Endpoint<PGMPContentParent> endpoint;
nsresult result;
nsCString errorDescription;
};
[NeedsOtherPid, ChildImpl=virtual, ParentImpl=virtual]
async protocol PGMPService
sync protocol PGMPService
{
parent:
async LaunchGMP(NodeIdVariant nodeIdVariant,
nsCString api,
nsCString[] tags,
ProcessId[] alreadyBridgedTo)
returns (GMPLaunchResult aResult);
sync LaunchGMP(NodeIdVariant nodeIdVariant,
nsCString api,
nsCString[] tags,
ProcessId[] alreadyBridgedTo)
returns (uint32_t pluginId,
GMPPluginType pluginType,
ProcessId id,
nsCString displayName,
Endpoint<PGMPContentParent> endpoint,
nsresult aResult,
nsCString aErrorDescription);
async GetGMPNodeId(nsString origin, nsString topLevelOrigin, nsString gmpName)
sync GetGMPNodeId(nsString origin, nsString topLevelOrigin, nsString gmpName)
returns (nsCString id);
child:
async BeginShutdown();

Просмотреть файл

@ -84,6 +84,10 @@ description = for bug 1514869 - layout is blocked on font lookup, needs complete
description = for bug 1487212 - layout requires hyphenation data from a given omnijar resource - only called once per locale by a given content process
[PGMP::StartPlugin]
description = legacy sync IPC - please add detailed description
[PGMPService::LaunchGMP]
description = legacy sync IPC - please add detailed description
[PGMPService::GetGMPNodeId]
description = legacy sync IPC - please add detailed description
[PGMPVideoDecoder::NeedShmem]
description = legacy sync IPC - please add detailed description
[PGMPVideoEncoder::NeedShmem]

Просмотреть файл

@ -21,7 +21,7 @@ Classes = [
'type': 'mozilla::Preferences',
'headers': ['mozilla/Preferences.h'],
'constructor': 'mozilla::Preferences::GetInstanceForService',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{064d9cee-1dd2-11b2-83e3-d25ab0193c26}',

Просмотреть файл

@ -202,7 +202,7 @@ SandboxTest::StartTests(const nsTArray<nsCString>& aProcessesList) {
service->GetContentParentForTest()->Then(
thread, __func__,
[self, processPromise](
const RefPtr<gmp::GMPContentParentCloseBlocker>&
const RefPtr<gmp::GMPContentParent::CloseBlocker>&
wrapper) {
RefPtr<gmp::GMPContentParent> parent = wrapper->mParent;
MOZ_ASSERT(parent,

Просмотреть файл

@ -35,7 +35,7 @@ class SandboxTest : public mozISandboxTest {
private:
virtual ~SandboxTest() = default;
nsTArray<RefPtr<SandboxTestingParent>> mSandboxTestingParents;
RefPtr<gmp::GMPContentParentCloseBlocker> mGMPContentParentWrapper;
RefPtr<gmp::GMPContentParent::CloseBlocker> mGMPContentParentWrapper;
#if defined(XP_WIN)
bool mChromeDirExisted = false;
#endif

Просмотреть файл

@ -16,6 +16,6 @@ Classes = [
'interfaces': ['nsITelemetry'],
'singleton': True,
'type': 'nsITelemetry',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
]

Просмотреть файл

@ -131,8 +131,6 @@ static CommandLineArg<bool> sSafeMode{"-safeMode", "safemode"};
static CommandLineArg<bool> sIsForBrowser{"-isForBrowser", "isforbrowser"};
static CommandLineArg<bool> sNotForBrowser{"-notForBrowser", "notforbrowser"};
static CommandLineArg<const char*> sPluginPath{"-pluginPath", "pluginpath"};
#if defined(XP_WIN)
# if defined(MOZ_SANDBOX)
static CommandLineArg<bool> sWin32kLockedDown{"-win32kLockedDown",

Просмотреть файл

@ -508,7 +508,6 @@ nsresult XRE_InitChildProcess(int aArgc, char* aArgv[],
MessageLoop::Type uiLoopType;
switch (XRE_GetProcessType()) {
case GeckoProcessType_Content:
case GeckoProcessType_GMPlugin:
case GeckoProcessType_GPU:
case GeckoProcessType_IPDLUnitTest:
case GeckoProcessType_VR:
@ -518,6 +517,7 @@ nsresult XRE_InitChildProcess(int aArgc, char* aArgv[],
// Content processes need the XPCOM/chromium frankenventloop
uiLoopType = MessageLoop::TYPE_MOZILLA_CHILD;
break;
case GeckoProcessType_GMPlugin:
case GeckoProcessType_RemoteSandboxBroker:
uiLoopType = MessageLoop::TYPE_DEFAULT;
break;

Просмотреть файл

@ -41,7 +41,7 @@ Classes = [
'cid': '{2d96b3df-c051-11d1-a827-0040959a28c9}',
'contract_ids': ['@mozilla.org/widget/appshell/mac;1'],
'legacy_constructor': 'nsAppShellConstructor',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{15cc80a9-5329-4fcb-9a0b-c6cf1440ae51}',
@ -53,19 +53,19 @@ Classes = [
'cid': '{8b5314bc-db01-11d2-96ce-0060b0fb9956}',
'contract_ids': ['@mozilla.org/widget/transferable;1'],
'type': 'nsTransferable',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{948a0023-e3a7-11d2-96cf-0060b0fb9956}',
'contract_ids': ['@mozilla.org/widget/htmlformatconverter;1'],
'type': 'nsHTMLFormatConverter',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{77221d5a-1dd2-11b2-8c69-c710f15d2ed5}',
'contract_ids': ['@mozilla.org/widget/clipboardhelper;1'],
'type': 'nsClipboardHelper',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{9a155bb2-2b67-45de-83e3-13a9dacf8336}',
@ -96,7 +96,7 @@ Classes = [
'cid': '{841387c8-72e6-484b-9296-bf6eea80d58a}',
'contract_ids': ['@mozilla.org/gfx/printsettings-service;1'],
'type': 'nsPrintSettingsServiceX',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{06beec76-a183-4d9f-85dd-085f26da565a}',
@ -109,60 +109,60 @@ Classes = [
'contract_ids': ['@mozilla.org/widget/useridleservice;1'],
'type': 'nsUserIdleServiceX',
'singleton': True,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{84e11f80-ca55-11dd-ad8b-0800200c9a66}',
'contract_ids': ['@mozilla.org/system-alerts-service;1'],
'type': 'mozilla::OSXNotificationCenter',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{2451baed-8dc3-46d9-9e30-96e1baa03666}',
'contract_ids': ['@mozilla.org/widget/macdocksupport;1'],
'type': 'nsMacDockSupport',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{74ea4101-a5bb-49bc-9984-66da8b225a37}',
'contract_ids': ['@mozilla.org/widget/macfinderprogress;1'],
'type': 'nsMacFinderProgress',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{de59fe1a-46c8-490f-b04d-34545acb06c9}',
'contract_ids': ['@mozilla.org/widget/macsharingservice;1'],
'type': 'nsMacSharingService',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{29046c8f-cba6-4ffa-9141-1685e96c4ea0}',
'contract_ids': ['@mozilla.org/widget/macuseractivityupdater;1'],
'type': 'nsMacUserActivityUpdater',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{e9096367-ddd9-45e4-b762-49c0c18b7119}',
'contract_ids': ['@mozilla.org/widget/mac-web-app-utils;1'],
'type': 'nsMacWebAppUtils',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{1f39ae50-b6a0-4b37-90f4-60af614193d8}',
'contract_ids': ['@mozilla.org/widget/standalonenativemenu;1'],
'type': 'nsStandaloneNativeMenu',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{b6e1a890-b2b8-4883-a65f-9476f6185313}',
'contract_ids': ['@mozilla.org/widget/systemstatusbar;1'],
'type': 'nsSystemStatusBarCocoa',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{38f396e2-93c9-4a77-aaf7-2d50b9962186}',
'contract_ids': ['@mozilla.org/widget/touchbarupdater;1'],
'type': 'nsTouchBarUpdater',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
]

Просмотреть файл

@ -17,7 +17,7 @@ Classes = [
'contract_ids': ['@mozilla.org/widget/appshell/gtk;1'],
'legacy_constructor': 'nsAppShellConstructor',
'headers': ['/widget/gtk/nsWidgetFactory.h'],
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{e9537f8f-c07e-4435-8ab3-83f1ad6e3bbf}',

Просмотреть файл

@ -26,7 +26,7 @@ Classes = [
'contract_ids': ['@mozilla.org/widget/appshell/win;1'],
'headers': ['/widget/windows/nsWidgetFactory.h'],
'legacy_constructor': 'nsAppShellConstructor',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{6987230e-0098-4e78-bc5f-1493ee7519fa}',

Просмотреть файл

@ -78,7 +78,7 @@ Classes = [
'type': 'nsMemoryReporterManager',
'headers': ['/xpcom/base/nsMemoryReporterManager.h'],
'init_method': 'Init',
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
{
'cid': '{7b4eeb20-d781-11d4-8a83-0010a4e0c9ca}',
@ -241,7 +241,7 @@ Classes = [
'contract_ids': ['@mozilla.org/xpcom/ini-parser-factory;1'],
'type': 'nsINIParserFactory',
'headers': ['/xpcom/ds/nsINIParserImpl.h'],
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
]

Просмотреть файл

@ -24,9 +24,9 @@ enum ProcessSelector {
CONTENT_PROCESS_ONLY = 1 << 1,
/**
* By default, modules are not loaded in the GPU, VR, Socket, RDD, Utility,
* GMPlugin and IPDLUnitTest processes, even if ANY_PROCESS is specified.
* This flag enables a module in the relevant process.
* By default, modules are not loaded in the GPU, VR, Socket, RDD, Utility
* and IPDLUnitTest processes, even if ANY_PROCESS is specified. This flag
* enables a module in the relevant process.
*
* NOTE: IPDLUnitTest does not have its own flag, and will only load a
* module if it is enabled in all processes.
@ -36,7 +36,6 @@ enum ProcessSelector {
ALLOW_IN_SOCKET_PROCESS = 1 << 4,
ALLOW_IN_RDD_PROCESS = 1 << 5,
ALLOW_IN_UTILITY_PROCESS = 1 << 6,
ALLOW_IN_GMPLUGIN_PROCESS = 1 << 7,
ALLOW_IN_GPU_AND_MAIN_PROCESS = ALLOW_IN_GPU_PROCESS | MAIN_PROCESS_ONLY,
ALLOW_IN_GPU_AND_VR_PROCESS = ALLOW_IN_GPU_PROCESS | ALLOW_IN_VR_PROCESS,
ALLOW_IN_GPU_AND_SOCKET_PROCESS =
@ -54,15 +53,11 @@ enum ProcessSelector {
ALLOW_IN_SOCKET_PROCESS,
ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS =
ALLOW_IN_GPU_PROCESS | ALLOW_IN_RDD_PROCESS | ALLOW_IN_VR_PROCESS |
ALLOW_IN_SOCKET_PROCESS | ALLOW_IN_UTILITY_PROCESS,
ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS =
ALLOW_IN_GPU_PROCESS | ALLOW_IN_RDD_PROCESS | ALLOW_IN_VR_PROCESS |
ALLOW_IN_SOCKET_PROCESS | ALLOW_IN_UTILITY_PROCESS |
ALLOW_IN_GMPLUGIN_PROCESS
ALLOW_IN_SOCKET_PROCESS | ALLOW_IN_UTILITY_PROCESS
};
static constexpr size_t kMaxProcessSelector = size_t(
ProcessSelector::ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS);
static constexpr size_t kMaxProcessSelector =
size_t(ProcessSelector::ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS);
/**
* This allows category entries to be marked so that they are or are

Просмотреть файл

@ -18,6 +18,6 @@ Classes = [
'cid': '{91775d60-d5dc-11d2-92fb-00e09805570f}',
'legacy_constructor': 'nsComponentManagerImpl::Create',
'headers': ['/xpcom/components/nsComponentManager.h'],
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
]

Просмотреть файл

@ -64,7 +64,6 @@ class ProcessSelector:
ALLOW_IN_SOCKET_PROCESS = 1 << 4
ALLOW_IN_RDD_PROCESS = 1 << 5
ALLOW_IN_UTILITY_PROCESS = 1 << 6
ALLOW_IN_GMPLUGIN_PROCESS = 1 << 7
ALLOW_IN_GPU_AND_MAIN_PROCESS = ALLOW_IN_GPU_PROCESS | MAIN_PROCESS_ONLY
ALLOW_IN_GPU_AND_SOCKET_PROCESS = ALLOW_IN_GPU_PROCESS | ALLOW_IN_SOCKET_PROCESS
ALLOW_IN_GPU_AND_VR_PROCESS = ALLOW_IN_GPU_PROCESS | ALLOW_IN_VR_PROCESS
@ -94,14 +93,6 @@ class ProcessSelector:
| ALLOW_IN_SOCKET_PROCESS
| ALLOW_IN_UTILITY_PROCESS
)
ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS = (
ALLOW_IN_GPU_PROCESS
| ALLOW_IN_RDD_PROCESS
| ALLOW_IN_VR_PROCESS
| ALLOW_IN_SOCKET_PROCESS
| ALLOW_IN_UTILITY_PROCESS
| ALLOW_IN_GMPLUGIN_PROCESS
)
# Maps ProcessSelector constants to the name of the corresponding
@ -123,7 +114,6 @@ PROCESSES = {
ProcessSelector.ALLOW_IN_GPU_RDD_SOCKET_AND_UTILITY_PROCESS: "ALLOW_IN_GPU_RDD_SOCKET_AND_UTILITY_PROCESS", # NOQA: E501
ProcessSelector.ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS: "ALLOW_IN_GPU_RDD_VR_AND_SOCKET_PROCESS", # NOQA: E501
ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS: "ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS", # NOQA: E501
ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS: "ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS", # NOQA: E501
}

Просмотреть файл

@ -115,10 +115,6 @@ bool ProcessSelectorMatches(ProcessSelector aSelector) {
return !!(aSelector & Module::ALLOW_IN_UTILITY_PROCESS);
}
if (type == GeckoProcessType_GMPlugin) {
return !!(aSelector & Module::ALLOW_IN_GMPLUGIN_PROCESS);
}
// Only allow XPCOM modules which can be loaded in all processes to be loaded
// in the IPDLUnitTest process.
if (type == GeckoProcessType_IPDLUnitTest) {
@ -298,8 +294,6 @@ nsresult nsComponentManagerImpl::Init() {
ProcessSelectorMatches(ProcessSelector::ALLOW_IN_SOCKET_PROCESS);
gProcessMatchTable[size_t(ProcessSelector::ALLOW_IN_RDD_PROCESS)] =
ProcessSelectorMatches(ProcessSelector::ALLOW_IN_RDD_PROCESS);
gProcessMatchTable[size_t(ProcessSelector::ALLOW_IN_GMPLUGIN_PROCESS)] =
ProcessSelectorMatches(ProcessSelector::ALLOW_IN_GMPLUGIN_PROCESS);
gProcessMatchTable[size_t(ProcessSelector::ALLOW_IN_GPU_AND_MAIN_PROCESS)] =
ProcessSelectorMatches(ProcessSelector::ALLOW_IN_GPU_AND_MAIN_PROCESS);
gProcessMatchTable[size_t(ProcessSelector::ALLOW_IN_GPU_AND_VR_PROCESS)] =
@ -332,12 +326,6 @@ nsresult nsComponentManagerImpl::Init() {
ProcessSelector::ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS)] =
ProcessSelectorMatches(
ProcessSelector::ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS);
gProcessMatchTable[size_t(
ProcessSelector::
ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS)] =
ProcessSelectorMatches(
ProcessSelector::
ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS);
}
MOZ_ASSERT(NOT_INITIALIZED == mStatus);
@ -372,6 +360,7 @@ nsresult nsComponentManagerImpl::Init() {
// processes really need chrome manifests...?
case GeckoProcessType_Default:
case GeckoProcessType_Content:
case GeckoProcessType_GMPlugin:
loadChromeManifests = true;
break;
}

Просмотреть файл

@ -19,6 +19,6 @@ Classes = [
'interfaces': ['nsIObserverService'],
'legacy_constructor': 'nsObserverService::Create',
'headers': ['/xpcom/ds/nsObserverService.h'],
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS,
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
]