/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=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/. */
if (NS_FAILED(rv)) {
MOZ_ASSERT(false, "Protocol endpoints failure"); return NS_ERROR_FAILURE;
}
if (!aUtilityParent->SendStartWinFileDialogService(std::move(childEnd))) {
MOZ_ASSERT(false, "SendStartWinFileDialogService failed"); return NS_ERROR_FAILURE;
}
if (!parentEnd.Bind(this)) {
MOZ_ASSERT(false, "parentEnd.Bind failed"); return NS_ERROR_FAILURE;
}
sOpenDialogActors++; return NS_OK;
}
// Convert the raw IPC promise-type to a filedialog::Promise. template <typename T, typename Ex> staticauto ConvertToFDPromise(
StaticString aMethod, // __func__
Ex&& extractor,
RefPtr<MozPromise<T, mozilla::ipc::ResponseRejectReason, true>>
aSrcPromise) { // The extractor must produce a `mozilla::Result<..., Error>` from `T`. using SrcResultInfo = detail::DestructureResult<std::invoke_result_t<Ex, T>>; using ResolveT = typename SrcResultInfo::OkT;
static_assert(std::is_same_v<typename SrcResultInfo::ErrorT, Error>, "expected T to be a Result<..., Error>");
using SrcPromiseT = MozPromise<T, mozilla::ipc::ResponseRejectReason, true>; using DstPromiseT = MozPromise<ResolveT, Error, true>;
RefPtr<DstPromiseT> ret = aSrcPromise->Then(
mozilla::GetCurrentSerialEventTarget(), aMethod,
// ... and possibly the process if (!--sOpenDialogActors) {
StopProcess();
}
}
void ProcessProxy::Contents::StopProcess() { autoconst upm = ipc::UtilityProcessManager::GetSingleton(); if (!upm) { // This is only possible when the UtilityProcessManager has shut down -- in // which case the file-dialog process has also already been directed to shut // down, and there's nothing we need to do here. return;
}
MOZ_LOG(sLogFileDialog, LogLevel::Debug,
("%s: killing the WINDOWS_FILE_DIALOG process (no more live " "actors)",
__PRETTY_FUNCTION__));
upm->CleanShutdown(ipc::SandboxingKind::WINDOWS_FILE_DIALOG);
}
} // namespace mozilla::widget::filedialog
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.