diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /dom/media/gmp/GMPProcessChild.cpp | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/gmp/GMPProcessChild.cpp')
-rw-r--r-- | dom/media/gmp/GMPProcessChild.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/dom/media/gmp/GMPProcessChild.cpp b/dom/media/gmp/GMPProcessChild.cpp new file mode 100644 index 0000000000..cf093065bc --- /dev/null +++ b/dom/media/gmp/GMPProcessChild.cpp @@ -0,0 +1,56 @@ +/* -*- 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/ipc/IOThreadChild.h" +#include "mozilla/GeckoArgs.h" + +using mozilla::ipc::IOThreadChild; + +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; + + Maybe<uint64_t> prefsLen = + geckoargs::sPrefsLen.Get(aArgc, aArgv, CheckArgFlag::None); + Maybe<uint64_t> prefMapSize = + geckoargs::sPrefMapSize.Get(aArgc, aArgv, CheckArgFlag::None); + sUseXpcom = prefsLen.isSome() && prefMapSize.isSome(); +} + +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 |