Files
tubestation/dom/media/gmp/GMPProcessChild.cpp
Alex Franchuk f7ee08eef3 Bug 1942129 pt4 - Convert old shmem call sites to use the new shmem classes r=ipc-reviewers,media-playback-reviewers,padenot,lsalzman,aosmond,nika
While much of this is simply converting code (and removing extraneous
`size` parameters), toolkit/xre/GeckoArgs.{h,cpp} has some significant
changes to support sending read-only handles (which is all we need!).

Differential Revision: https://phabricator.services.mozilla.com/D236750
2025-03-03 19:53:20 +00:00

52 lines
1.7 KiB
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/. */
#include "GMPProcessChild.h"
#include "base/command_line.h"
#include "base/string_util.h"
#include "mozilla/GeckoArgs.h"
namespace mozilla::gmp {
/* static */ bool GMPProcessChild::sUseXpcom = false;
/* static */ bool GMPProcessChild::sUseNativeEventProcessing = true;
void GMPProcessChild::InitStatics(int aArgc, char* aArgv[]) {
Maybe<bool> nativeEvent = geckoargs::sPluginNativeEvent.Get(aArgc, aArgv);
sUseNativeEventProcessing = nativeEvent.isSome() && *nativeEvent;
auto prefsHandlePresent = geckoargs::sPrefsHandle.IsPresent(aArgc, aArgv);
auto prefMapHandlePresent = geckoargs::sPrefMapHandle.IsPresent(aArgc, aArgv);
sUseXpcom = prefsHandlePresent && prefMapHandlePresent;
}
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;
}
Maybe<const char*> pluginPath = geckoargs::sPluginPath.Get(aArgc, aArgv);
if (NS_WARN_IF(pluginPath.isNothing())) {
return false;
}
NS_ConvertUTF8toUTF16 widePluginPath(*pluginPath);
if (sUseXpcom && NS_WARN_IF(!ProcessChild::InitPrefs(aArgc, aArgv))) {
return false;
}
return mPlugin->Init(widePluginPath, *parentBuildID, TakeInitialEndpoint());
}
void GMPProcessChild::CleanUp() { mPlugin->Shutdown(); }
} // namespace mozilla::gmp