mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1276351 - Move away from mozilla::tuple to std::tuple. r=necko-reviewers,sergesanspaille
Differential Revision: https://phabricator.services.mozilla.com/D173256
This commit is contained in:
parent
f580576c9d
commit
4efa1bd0ba
@ -8,7 +8,6 @@
|
||||
|
||||
#include "EventQueue.h"
|
||||
|
||||
#include "mozilla/Tuple.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIFrame.h"
|
||||
|
@ -1356,13 +1356,13 @@ void BrowsingContext::SetTriggeringAndInheritPrincipals(
|
||||
}
|
||||
}
|
||||
|
||||
Tuple<nsCOMPtr<nsIPrincipal>, nsCOMPtr<nsIPrincipal>>
|
||||
std::tuple<nsCOMPtr<nsIPrincipal>, nsCOMPtr<nsIPrincipal>>
|
||||
BrowsingContext::GetTriggeringAndInheritPrincipalsForCurrentLoad() {
|
||||
nsCOMPtr<nsIPrincipal> triggeringPrincipal =
|
||||
GetSavedPrincipal(mTriggeringPrincipal);
|
||||
nsCOMPtr<nsIPrincipal> principalToInherit =
|
||||
GetSavedPrincipal(mPrincipalToInherit);
|
||||
return MakeTuple(triggeringPrincipal, principalToInherit);
|
||||
return std::make_tuple(triggeringPrincipal, principalToInherit);
|
||||
}
|
||||
|
||||
nsIPrincipal* BrowsingContext::GetSavedPrincipal(
|
||||
@ -1370,7 +1370,7 @@ nsIPrincipal* BrowsingContext::GetSavedPrincipal(
|
||||
if (aPrincipalTuple) {
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
uint64_t loadIdentifier;
|
||||
Tie(principal, loadIdentifier) = *aPrincipalTuple;
|
||||
std::tie(principal, loadIdentifier) = *aPrincipalTuple;
|
||||
// We want to return a principal only if the load identifier for it
|
||||
// matches the current one for this BC.
|
||||
if (auto current = GetCurrentLoadIdentifier();
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Span.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/LocationBase.h"
|
||||
#include "mozilla/dom/MaybeDiscarded.h"
|
||||
@ -878,7 +878,7 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
||||
|
||||
// Return mTriggeringPrincipal and mPrincipalToInherit if the load id
|
||||
// saved with the principal matches the current load identifier of this BC.
|
||||
Tuple<nsCOMPtr<nsIPrincipal>, nsCOMPtr<nsIPrincipal>>
|
||||
std::tuple<nsCOMPtr<nsIPrincipal>, nsCOMPtr<nsIPrincipal>>
|
||||
GetTriggeringAndInheritPrincipalsForCurrentLoad();
|
||||
|
||||
void HistoryGo(int32_t aOffset, uint64_t aHistoryEpoch,
|
||||
@ -1259,7 +1259,7 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
||||
void CreateChildSHistory();
|
||||
|
||||
using PrincipalWithLoadIdentifierTuple =
|
||||
Tuple<nsCOMPtr<nsIPrincipal>, uint64_t>;
|
||||
std::tuple<nsCOMPtr<nsIPrincipal>, uint64_t>;
|
||||
|
||||
nsIPrincipal* GetSavedPrincipal(
|
||||
Maybe<PrincipalWithLoadIdentifierTuple> aPrincipalTuple);
|
||||
|
@ -2373,13 +2373,13 @@ void CanonicalBrowsingContext::SynchronizeLayoutHistoryState() {
|
||||
cp->SendGetLayoutHistoryState(this)->Then(
|
||||
GetCurrentSerialEventTarget(), __func__,
|
||||
[activeEntry = mActiveEntry](
|
||||
const Tuple<RefPtr<nsILayoutHistoryState>, Maybe<Wireframe>>&
|
||||
const std::tuple<RefPtr<nsILayoutHistoryState>, Maybe<Wireframe>>&
|
||||
aResult) {
|
||||
if (mozilla::Get<0>(aResult)) {
|
||||
activeEntry->SetLayoutHistoryState(mozilla::Get<0>(aResult));
|
||||
if (std::get<0>(aResult)) {
|
||||
activeEntry->SetLayoutHistoryState(std::get<0>(aResult));
|
||||
}
|
||||
if (mozilla::Get<1>(aResult)) {
|
||||
activeEntry->SetWireframe(mozilla::Get<1>(aResult));
|
||||
if (std::get<1>(aResult)) {
|
||||
activeEntry->SetWireframe(std::get<1>(aResult));
|
||||
}
|
||||
},
|
||||
[]() {});
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include "mozilla/StorageAccess.h"
|
||||
#include "mozilla/StoragePrincipalHelper.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/WidgetUtils.h"
|
||||
|
||||
@ -4089,8 +4089,8 @@ nsDocShell::Reload(uint32_t aReloadFlags) {
|
||||
mBrowsingContext, forceReload,
|
||||
[docShell, doc, loadType, browsingContext, currentURI, referrerInfo,
|
||||
loadGroup, stopDetector](
|
||||
Tuple<bool, Maybe<NotNull<RefPtr<nsDocShellLoadState>>>,
|
||||
Maybe<bool>>&& aResult) {
|
||||
std::tuple<bool, Maybe<NotNull<RefPtr<nsDocShellLoadState>>>,
|
||||
Maybe<bool>>&& aResult) {
|
||||
auto scopeExit = MakeScopeExit([loadGroup, stopDetector]() {
|
||||
if (loadGroup) {
|
||||
loadGroup->RemoveRequest(stopDetector, nullptr, NS_OK);
|
||||
@ -4109,7 +4109,7 @@ nsDocShell::Reload(uint32_t aReloadFlags) {
|
||||
Maybe<NotNull<RefPtr<nsDocShellLoadState>>> loadState;
|
||||
Maybe<bool> reloadingActiveEntry;
|
||||
|
||||
Tie(canReload, loadState, reloadingActiveEntry) = aResult;
|
||||
std::tie(canReload, loadState, reloadingActiveEntry) = aResult;
|
||||
|
||||
if (!canReload) {
|
||||
return;
|
||||
@ -5297,7 +5297,7 @@ static const char16_t* SkipASCIIWhitespace(const char16_t* aStart,
|
||||
return iter;
|
||||
}
|
||||
|
||||
static Tuple<const char16_t*, const char16_t*> ExtractURLString(
|
||||
static std::tuple<const char16_t*, const char16_t*> ExtractURLString(
|
||||
const char16_t* aPosition, const char16_t* aEnd) {
|
||||
MOZ_ASSERT(aPosition != aEnd);
|
||||
|
||||
@ -5316,7 +5316,7 @@ static Tuple<const char16_t*, const char16_t*> ExtractURLString(
|
||||
// U+0072 (r), then advance position to the next code point.
|
||||
// Otherwise, jump to the step labeled parse.
|
||||
if (aPosition == aEnd || (*aPosition != 'R' && *aPosition != 'r')) {
|
||||
return MakeTuple(urlStart, urlEnd);
|
||||
return std::make_tuple(urlStart, urlEnd);
|
||||
}
|
||||
|
||||
++aPosition;
|
||||
@ -5325,7 +5325,7 @@ static Tuple<const char16_t*, const char16_t*> ExtractURLString(
|
||||
// U+006C (l), then advance position to the next code point.
|
||||
// Otherwise, jump to the step labeled parse.
|
||||
if (aPosition == aEnd || (*aPosition != 'L' && *aPosition != 'l')) {
|
||||
return MakeTuple(urlStart, urlEnd);
|
||||
return std::make_tuple(urlStart, urlEnd);
|
||||
}
|
||||
|
||||
++aPosition;
|
||||
@ -5337,7 +5337,7 @@ static Tuple<const char16_t*, const char16_t*> ExtractURLString(
|
||||
// then advance position to the next code point. Otherwise, jump to
|
||||
// the step labeled parse.
|
||||
if (aPosition == aEnd || *aPosition != '=') {
|
||||
return MakeTuple(urlStart, urlEnd);
|
||||
return std::make_tuple(urlStart, urlEnd);
|
||||
}
|
||||
|
||||
++aPosition;
|
||||
@ -5371,7 +5371,7 @@ static Tuple<const char16_t*, const char16_t*> ExtractURLString(
|
||||
urlEnd = quotePos;
|
||||
}
|
||||
|
||||
return MakeTuple(urlStart, urlEnd);
|
||||
return std::make_tuple(urlStart, urlEnd);
|
||||
}
|
||||
|
||||
void nsDocShell::SetupRefreshURIFromHeader(Document* aDocument,
|
||||
@ -5467,7 +5467,7 @@ void nsDocShell::SetupRefreshURIFromHeader(Document* aDocument,
|
||||
const char16_t* urlEnd;
|
||||
|
||||
// 1-10. See ExtractURLString.
|
||||
Tie(urlStart, urlEnd) = ExtractURLString(position, end);
|
||||
std::tie(urlStart, urlEnd) = ExtractURLString(position, end);
|
||||
|
||||
// 11. Parse: Parse urlString relative to document. If that fails, return.
|
||||
// Otherwise, set urlRecord to the resulting URL record.
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "mozilla/PresState.h"
|
||||
#include "mozilla/StaticPrefs_fission.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "mozilla/dom/BrowserParent.h"
|
||||
#include "mozilla/dom/CanonicalBrowsingContext.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
@ -1521,15 +1521,15 @@ void IPDLParamTraits<dom::SessionHistoryInfo>::Write(
|
||||
const dom::SessionHistoryInfo& aParam) {
|
||||
nsCOMPtr<nsIInputStream> postData = aParam.GetPostData();
|
||||
|
||||
Maybe<Tuple<uint32_t, dom::ClonedMessageData>> stateData;
|
||||
Maybe<std::tuple<uint32_t, dom::ClonedMessageData>> stateData;
|
||||
if (aParam.mStateData) {
|
||||
stateData.emplace();
|
||||
// FIXME: We should fail more aggressively if this fails, as currently we'll
|
||||
// just early return and the deserialization will break.
|
||||
NS_ENSURE_SUCCESS_VOID(
|
||||
aParam.mStateData->GetFormatVersion(&Get<0>(*stateData)));
|
||||
aParam.mStateData->GetFormatVersion(&std::get<0>(*stateData)));
|
||||
NS_ENSURE_TRUE_VOID(
|
||||
aParam.mStateData->BuildClonedMessageData(Get<1>(*stateData)));
|
||||
aParam.mStateData->BuildClonedMessageData(std::get<1>(*stateData)));
|
||||
}
|
||||
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mURI);
|
||||
@ -1572,7 +1572,7 @@ void IPDLParamTraits<dom::SessionHistoryInfo>::Write(
|
||||
bool IPDLParamTraits<dom::SessionHistoryInfo>::Read(
|
||||
IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
dom::SessionHistoryInfo* aResult) {
|
||||
Maybe<Tuple<uint32_t, dom::ClonedMessageData>> stateData;
|
||||
Maybe<std::tuple<uint32_t, dom::ClonedMessageData>> stateData;
|
||||
uint64_t sharedId;
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mURI) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mOriginalURI) ||
|
||||
@ -1679,9 +1679,9 @@ bool IPDLParamTraits<dom::SessionHistoryInfo>::Read(
|
||||
}
|
||||
|
||||
if (stateData.isSome()) {
|
||||
uint32_t version = Get<0>(*stateData);
|
||||
uint32_t version = std::get<0>(*stateData);
|
||||
aResult->mStateData = new nsStructuredCloneContainer(version);
|
||||
aResult->mStateData->StealFromClonedMessageData(Get<1>(*stateData));
|
||||
aResult->mStateData->StealFromClonedMessageData(std::get<1>(*stateData));
|
||||
}
|
||||
MOZ_ASSERT_IF(stateData.isNothing(), !aResult->mStateData);
|
||||
return true;
|
||||
|
@ -1806,10 +1806,10 @@ already_AddRefed<Promise> ChromeUtils::CollectScrollingData(
|
||||
|
||||
extPromise->Then(
|
||||
GetCurrentSerialEventTarget(), __func__,
|
||||
[promise](const Tuple<uint32_t, uint32_t>& aResult) {
|
||||
[promise](const std::tuple<uint32_t, uint32_t>& aResult) {
|
||||
InteractionData out = {};
|
||||
out.mInteractionTimeInMilliseconds = Get<0>(aResult);
|
||||
out.mScrollingDistanceInPixels = Get<1>(aResult);
|
||||
out.mInteractionTimeInMilliseconds = std::get<0>(aResult);
|
||||
out.mScrollingDistanceInPixels = std::get<1>(aResult);
|
||||
promise->MaybeResolve(out);
|
||||
},
|
||||
[promise](bool aValue) { promise->MaybeReject(NS_ERROR_FAILURE); });
|
||||
|
@ -75,15 +75,15 @@ ScrollingMetrics* ScrollingMetrics::GetSingleton() {
|
||||
}
|
||||
|
||||
struct ScrollingMetricsCollector {
|
||||
void AppendScrollingMetrics(const Tuple<uint32_t, uint32_t>& aMetrics,
|
||||
void AppendScrollingMetrics(const std::tuple<uint32_t, uint32_t>& aMetrics,
|
||||
dom::ContentParent* aParent) {
|
||||
mTimeScrolledMS += Get<0>(aMetrics);
|
||||
mDistanceScrolledPixels += Get<1>(aMetrics);
|
||||
mTimeScrolledMS += std::get<0>(aMetrics);
|
||||
mDistanceScrolledPixels += std::get<1>(aMetrics);
|
||||
}
|
||||
|
||||
~ScrollingMetricsCollector() {
|
||||
mPromiseHolder.Resolve(MakeTuple(mTimeScrolledMS, mDistanceScrolledPixels),
|
||||
__func__);
|
||||
mPromiseHolder.Resolve(
|
||||
std::make_tuple(mTimeScrolledMS, mDistanceScrolledPixels), __func__);
|
||||
}
|
||||
|
||||
uint32_t mTimeScrolledMS = 0;
|
||||
@ -101,8 +101,7 @@ auto ScrollingMetrics::CollectScrollingMetricsInternal()
|
||||
for (dom::ContentParent* parent : contentParents) {
|
||||
RefPtr<dom::ContentParent> parentRef = parent;
|
||||
parent->SendCollectScrollingMetrics(
|
||||
[collector,
|
||||
parentRef](const mozilla::Tuple<uint32_t, uint32_t>& aMetrics) {
|
||||
[collector, parentRef](const std::tuple<uint32_t, uint32_t>& aMetrics) {
|
||||
collector->AppendScrollingMetrics(aMetrics, parentRef.get());
|
||||
},
|
||||
[](mozilla::ipc::ResponseRejectReason) {});
|
||||
@ -111,13 +110,13 @@ auto ScrollingMetrics::CollectScrollingMetricsInternal()
|
||||
return collector->mPromiseHolder.Ensure(__func__);
|
||||
}
|
||||
|
||||
Tuple<uint32_t, uint32_t>
|
||||
std::tuple<uint32_t, uint32_t>
|
||||
ScrollingMetrics::CollectLocalScrollingMetricsInternal() {
|
||||
OnScrollingInteractionEnded();
|
||||
|
||||
Tuple<uint32_t, uint32_t> metrics =
|
||||
MakeTuple(gScrollingInteraction.mInteractionTimeInMilliseconds,
|
||||
gScrollingInteraction.mScrollingDistanceInPixels);
|
||||
std::tuple<uint32_t, uint32_t> metrics =
|
||||
std::make_tuple(gScrollingInteraction.mInteractionTimeInMilliseconds,
|
||||
gScrollingInteraction.mScrollingDistanceInPixels);
|
||||
gScrollingInteraction = {};
|
||||
return metrics;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace mozilla {
|
||||
class ScrollingMetrics {
|
||||
public:
|
||||
using ScrollingMetricsPromise =
|
||||
MozPromise<Tuple<uint32_t, uint32_t>, bool, true>;
|
||||
MozPromise<std::tuple<uint32_t, uint32_t>, bool, true>;
|
||||
|
||||
static RefPtr<ScrollingMetricsPromise> CollectScrollingMetrics() {
|
||||
return GetSingleton()->CollectScrollingMetricsInternal();
|
||||
@ -30,7 +30,7 @@ class ScrollingMetrics {
|
||||
|
||||
// Return the tuple of <scrollingTimeInMilliseconds,
|
||||
// ScrollingDistanceInPixels>
|
||||
static Tuple<uint32_t, uint32_t> CollectLocalScrollingMetrics() {
|
||||
static std::tuple<uint32_t, uint32_t> CollectLocalScrollingMetrics() {
|
||||
return GetSingleton()->CollectLocalScrollingMetricsInternal();
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ class ScrollingMetrics {
|
||||
static ScrollingMetrics* GetSingleton();
|
||||
static StaticAutoPtr<ScrollingMetrics> sSingleton;
|
||||
RefPtr<ScrollingMetricsPromise> CollectScrollingMetricsInternal();
|
||||
Tuple<uint32_t, uint32_t> CollectLocalScrollingMetricsInternal();
|
||||
std::tuple<uint32_t, uint32_t> CollectLocalScrollingMetricsInternal();
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -168,7 +168,7 @@ inline bool AssignJSString(JSContext* cx, T& dest, JSString* s) {
|
||||
|
||||
size_t read;
|
||||
size_t written;
|
||||
Tie(read, written) = *maybe;
|
||||
std::tie(read, written) = *maybe;
|
||||
|
||||
MOZ_ASSERT(read == JS::GetStringLength(s));
|
||||
handle.Finish(written, kAllowShrinking);
|
||||
|
@ -67,7 +67,7 @@ inline void ResolvePromiseForFinished(Promise* aPromise) {
|
||||
template <typename Key, typename Value>
|
||||
void ResolvePromiseWithKeyAndValue(Promise* aPromise, const Key& aKey,
|
||||
const Value& aValue) {
|
||||
aPromise->MaybeResolve(MakeTuple(aKey, aValue));
|
||||
aPromise->MaybeResolve(std::make_tuple(aKey, aValue));
|
||||
}
|
||||
|
||||
} // namespace iterator_utils
|
||||
|
@ -409,7 +409,7 @@ template <typename T>
|
||||
// Accept tuple of other things we accept. The result will be a JS array object.
|
||||
template <typename... Elements>
|
||||
[[nodiscard]] bool ToJSValue(JSContext* aCx,
|
||||
const Tuple<Elements...>& aArguments,
|
||||
const std::tuple<Elements...>& aArguments,
|
||||
JS::MutableHandle<JS::Value> aValue) {
|
||||
// Make sure we're called in a compartment
|
||||
MOZ_ASSERT(JS::CurrentGlobalOrNull(aCx));
|
||||
@ -420,9 +420,11 @@ template <typename... Elements>
|
||||
}
|
||||
bool ok = true;
|
||||
size_t i = 0;
|
||||
ForEach(aArguments, [aCx, &ok, &v, &i](auto& aElem) {
|
||||
auto Callable = [aCx, &ok, &v, &i](auto& aElem) {
|
||||
ok = ok && ToJSValue(aCx, aElem, v[i++]);
|
||||
});
|
||||
};
|
||||
std::apply([Callable](auto&&... args) { (Callable(args), ...); }, aArguments);
|
||||
|
||||
if (!ok) {
|
||||
return false;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ IdentityCredential::DiscoverFromExternalSourceInMainProcess(
|
||||
const IdentityProviderConfigWithManifest& providerAndManifest) {
|
||||
IdentityProviderAPIConfig manifest;
|
||||
IdentityProviderConfig provider;
|
||||
Tie(provider, manifest) = providerAndManifest;
|
||||
std::tie(provider, manifest) = providerAndManifest;
|
||||
return IdentityCredential::CreateCredential(
|
||||
principal, browsingContext, provider, manifest);
|
||||
},
|
||||
@ -256,12 +256,12 @@ IdentityCredential::CreateCredential(
|
||||
aManifest)
|
||||
->Then(
|
||||
GetCurrentSerialEventTarget(), __func__,
|
||||
[argumentPrincipal, browsingContext,
|
||||
aProvider](const Tuple<IdentityProviderAPIConfig,
|
||||
IdentityProviderAccountList>& promiseResult) {
|
||||
[argumentPrincipal, browsingContext, aProvider](
|
||||
const std::tuple<IdentityProviderAPIConfig,
|
||||
IdentityProviderAccountList>& promiseResult) {
|
||||
IdentityProviderAPIConfig currentManifest;
|
||||
IdentityProviderAccountList accountList;
|
||||
Tie(currentManifest, accountList) = promiseResult;
|
||||
std::tie(currentManifest, accountList) = promiseResult;
|
||||
if (!accountList.mAccounts.WasPassed() ||
|
||||
accountList.mAccounts.Value().Length() == 0) {
|
||||
return IdentityCredential::GetAccountPromise::CreateAndReject(
|
||||
@ -277,11 +277,11 @@ IdentityCredential::CreateCredential(
|
||||
->Then(
|
||||
GetCurrentSerialEventTarget(), __func__,
|
||||
[argumentPrincipal, browsingContext, aProvider](
|
||||
const Tuple<IdentityProviderAPIConfig, IdentityProviderAccount>&
|
||||
promiseResult) {
|
||||
const std::tuple<IdentityProviderAPIConfig,
|
||||
IdentityProviderAccount>& promiseResult) {
|
||||
IdentityProviderAPIConfig currentManifest;
|
||||
IdentityProviderAccount account;
|
||||
Tie(currentManifest, account) = promiseResult;
|
||||
std::tie(currentManifest, account) = promiseResult;
|
||||
return IdentityCredential::PromptUserWithPolicy(
|
||||
browsingContext, argumentPrincipal, account, currentManifest,
|
||||
aProvider);
|
||||
@ -293,11 +293,11 @@ IdentityCredential::CreateCredential(
|
||||
->Then(
|
||||
GetCurrentSerialEventTarget(), __func__,
|
||||
[argumentPrincipal, aProvider](
|
||||
const Tuple<IdentityProviderAPIConfig, IdentityProviderAccount>&
|
||||
promiseResult) {
|
||||
const std::tuple<IdentityProviderAPIConfig,
|
||||
IdentityProviderAccount>& promiseResult) {
|
||||
IdentityProviderAPIConfig currentManifest;
|
||||
IdentityProviderAccount account;
|
||||
Tie(currentManifest, account) = promiseResult;
|
||||
std::tie(currentManifest, account) = promiseResult;
|
||||
return IdentityCredential::FetchToken(argumentPrincipal, aProvider,
|
||||
currentManifest, account);
|
||||
},
|
||||
@ -307,11 +307,12 @@ IdentityCredential::CreateCredential(
|
||||
})
|
||||
->Then(
|
||||
GetCurrentSerialEventTarget(), __func__,
|
||||
[aProvider](const Tuple<IdentityProviderToken,
|
||||
IdentityProviderAccount>& promiseResult) {
|
||||
[aProvider](
|
||||
const std::tuple<IdentityProviderToken, IdentityProviderAccount>&
|
||||
promiseResult) {
|
||||
IdentityProviderToken token;
|
||||
IdentityProviderAccount account;
|
||||
Tie(token, account) = promiseResult;
|
||||
std::tie(token, account) = promiseResult;
|
||||
IPCIdentityCredential credential;
|
||||
credential.token() = token.mToken;
|
||||
credential.id() = account.mId;
|
||||
@ -541,7 +542,7 @@ IdentityCredential::FetchAccountList(
|
||||
GetCurrentSerialEventTarget(), __func__,
|
||||
[aManifest](const IdentityProviderAccountList& accountList) {
|
||||
return IdentityCredential::GetAccountListPromise::CreateAndResolve(
|
||||
MakeTuple(aManifest, accountList), __func__);
|
||||
std::make_tuple(aManifest, accountList), __func__);
|
||||
},
|
||||
[](nsresult error) {
|
||||
return IdentityCredential::GetAccountListPromise::CreateAndReject(
|
||||
@ -639,7 +640,7 @@ RefPtr<IdentityCredential::GetTokenPromise> IdentityCredential::FetchToken(
|
||||
GetCurrentSerialEventTarget(), __func__,
|
||||
[aAccount](const IdentityProviderToken& token) {
|
||||
return IdentityCredential::GetTokenPromise::CreateAndResolve(
|
||||
MakeTuple(token, aAccount), __func__);
|
||||
std::make_tuple(token, aAccount), __func__);
|
||||
},
|
||||
[](nsresult error) {
|
||||
return IdentityCredential::GetTokenPromise::CreateAndReject(error,
|
||||
@ -798,8 +799,8 @@ IdentityCredential::PromptUserToSelectProvider(
|
||||
}
|
||||
const IdentityProviderAPIConfig& resolvedManifest =
|
||||
aManifests.ElementAt(result).ResolveValue();
|
||||
resultPromise->Resolve(MakeTuple(resolvedProvider, resolvedManifest),
|
||||
__func__);
|
||||
resultPromise->Resolve(
|
||||
std::make_tuple(resolvedProvider, resolvedManifest), __func__);
|
||||
},
|
||||
[resultPromise](nsresult aRv) { resultPromise->Reject(aRv, __func__); });
|
||||
showPromptPromise->AppendNativeHandler(listener);
|
||||
@ -875,7 +876,7 @@ IdentityCredential::PromptUserToSelectAccount(
|
||||
}
|
||||
const IdentityProviderAccount& resolved =
|
||||
aAccounts.mAccounts.Value().ElementAt(result);
|
||||
resultPromise->Resolve(MakeTuple(aManifest, resolved), __func__);
|
||||
resultPromise->Resolve(std::make_tuple(aManifest, resolved), __func__);
|
||||
},
|
||||
[resultPromise](nsresult aRv) { resultPromise->Reject(aRv, __func__); });
|
||||
showPromptPromise->AppendNativeHandler(listener);
|
||||
@ -926,7 +927,7 @@ IdentityCredential::PromptUserWithPolicy(
|
||||
icStorageService->SetState(aPrincipal, idpPrincipal,
|
||||
NS_ConvertUTF16toUTF8(aAccount.mId), true, true);
|
||||
return IdentityCredential::GetAccountPromise::CreateAndResolve(
|
||||
MakeTuple(aManifest, aAccount), __func__);
|
||||
std::make_tuple(aManifest, aAccount), __func__);
|
||||
}
|
||||
|
||||
// otherwise, fetch ->Then display ->Then return ->Catch reject
|
||||
@ -1008,7 +1009,7 @@ IdentityCredential::PromptUserWithPolicy(
|
||||
[aManifest, aAccount](bool success) {
|
||||
if (success) {
|
||||
return IdentityCredential::GetAccountPromise::CreateAndResolve(
|
||||
MakeTuple(aManifest, aAccount), __func__);
|
||||
std::make_tuple(aManifest, aAccount), __func__);
|
||||
}
|
||||
return IdentityCredential::GetAccountPromise::CreateAndReject(
|
||||
NS_ERROR_FAILURE, __func__);
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "mozilla/dom/Credential.h"
|
||||
#include "mozilla/dom/IPCIdentityCredential.h"
|
||||
#include "mozilla/MozPromise.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
namespace mozilla::dom {
|
||||
|
||||
@ -36,19 +35,20 @@ class IdentityCredential final : public Credential {
|
||||
typedef MozPromise<bool, nsresult, true> ValidationPromise;
|
||||
typedef MozPromise<IdentityProviderAPIConfig, nsresult, true>
|
||||
GetManifestPromise;
|
||||
typedef Tuple<IdentityProviderConfig, IdentityProviderAPIConfig>
|
||||
typedef std::tuple<IdentityProviderConfig, IdentityProviderAPIConfig>
|
||||
IdentityProviderConfigWithManifest;
|
||||
typedef MozPromise<IdentityProviderConfigWithManifest, nsresult, true>
|
||||
GetIdentityProviderConfigWithManifestPromise;
|
||||
typedef MozPromise<
|
||||
Tuple<IdentityProviderAPIConfig, IdentityProviderAccountList>, nsresult,
|
||||
true>
|
||||
std::tuple<IdentityProviderAPIConfig, IdentityProviderAccountList>,
|
||||
nsresult, true>
|
||||
GetAccountListPromise;
|
||||
typedef MozPromise<Tuple<IdentityProviderToken, IdentityProviderAccount>,
|
||||
typedef MozPromise<std::tuple<IdentityProviderToken, IdentityProviderAccount>,
|
||||
nsresult, true>
|
||||
GetTokenPromise;
|
||||
typedef MozPromise<Tuple<IdentityProviderAPIConfig, IdentityProviderAccount>,
|
||||
nsresult, true>
|
||||
typedef MozPromise<
|
||||
std::tuple<IdentityProviderAPIConfig, IdentityProviderAccount>, nsresult,
|
||||
true>
|
||||
GetAccountPromise;
|
||||
typedef MozPromise<IdentityProviderClientMetadata, nsresult, true>
|
||||
GetMetadataPromise;
|
||||
|
@ -39,7 +39,7 @@ void TextEncoder::EncodeInto(JSContext* aCx, JS::Handle<JSString*> aSrc,
|
||||
aError.ReportOOM();
|
||||
return;
|
||||
}
|
||||
Tie(read, written) = *maybe;
|
||||
std::tie(read, written) = *maybe;
|
||||
MOZ_ASSERT(written <= aDst.Length());
|
||||
aResult.mRead.Construct() = read;
|
||||
aResult.mWritten.Construct() = written;
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#ifndef mozilla_dom_gamepad_GamepadHandle_h
|
||||
#define mozilla_dom_gamepad_GamepadHandle_h
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "PLDHashTable.h"
|
||||
#include <type_traits>
|
||||
#include <cinttypes>
|
||||
|
@ -2293,8 +2293,8 @@ mozilla::ipc::IPCResult ContentChild::RecvCollectPerfStatsJSON(
|
||||
mozilla::ipc::IPCResult ContentChild::RecvCollectScrollingMetrics(
|
||||
CollectScrollingMetricsResolver&& aResolver) {
|
||||
auto metrics = ScrollingMetrics::CollectLocalScrollingMetrics();
|
||||
using ResolverArgs = Tuple<const uint32_t&, const uint32_t&>;
|
||||
aResolver(ResolverArgs(Get<0>(metrics), Get<1>(metrics)));
|
||||
using ResolverArgs = std::tuple<const uint32_t&, const uint32_t&>;
|
||||
aResolver(ResolverArgs(std::get<0>(metrics), std::get<1>(metrics)));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
@ -4467,8 +4467,9 @@ mozilla::ipc::IPCResult ContentChild::RecvGetLayoutHistoryState(
|
||||
docShell->GetLayoutHistoryState(getter_AddRefs(state));
|
||||
wireframe = static_cast<nsDocShell*>(docShell)->GetWireframe();
|
||||
}
|
||||
aResolver(Tuple<nsILayoutHistoryState*, const mozilla::Maybe<Wireframe>&>(
|
||||
state, wireframe));
|
||||
aResolver(
|
||||
std::tuple<nsILayoutHistoryState*, const mozilla::Maybe<Wireframe>&>(
|
||||
state, wireframe));
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
@ -7840,8 +7840,9 @@ mozilla::ipc::IPCResult ContentParent::RecvNotifyOnHistoryReload(
|
||||
aForceReload, canReload, loadState, reloadActiveEntry);
|
||||
}
|
||||
aResolver(
|
||||
Tuple<const bool&, const Maybe<NotNull<RefPtr<nsDocShellLoadState>>>&,
|
||||
const Maybe<bool>&>(canReload, loadState, reloadActiveEntry));
|
||||
std::tuple<const bool&,
|
||||
const Maybe<NotNull<RefPtr<nsDocShellLoadState>>>&,
|
||||
const Maybe<bool>&>(canReload, loadState, reloadActiveEntry));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
@ -8243,7 +8244,7 @@ void ContentParent::DidLaunchSubprocess() {
|
||||
|
||||
IPCResult ContentParent::RecvGetSystemIcon(nsIURI* aURI,
|
||||
GetSystemIconResolver&& aResolver) {
|
||||
using ResolverArgs = Tuple<const nsresult&, mozilla::Maybe<ByteBuf>&&>;
|
||||
using ResolverArgs = std::tuple<const nsresult&, mozilla::Maybe<ByteBuf>&&>;
|
||||
|
||||
if (!aURI) {
|
||||
Maybe<ByteBuf> bytebuf = Nothing();
|
||||
|
@ -141,7 +141,7 @@ void JSValidatorChild::Resolve(ValidatorResult aResult) {
|
||||
}
|
||||
}
|
||||
|
||||
mResolver.ref()(Tuple<mozilla::Maybe<Shmem>&&, const ValidatorResult&>(
|
||||
mResolver.ref()(std::tuple<mozilla::Maybe<Shmem>&&, const ValidatorResult&>(
|
||||
std::move(data), aResult));
|
||||
mResolver.reset();
|
||||
}
|
||||
|
@ -36,9 +36,7 @@ void JSValidatorParent::IsOpaqueResponseAllowed(
|
||||
const IsOpaqueResponseAllowedPromise::ResolveOrRejectValue&
|
||||
aResult) {
|
||||
if (aResult.IsResolve()) {
|
||||
Maybe<Shmem> data;
|
||||
ValidatorResult result;
|
||||
Tie(data, result) = aResult.ResolveValue();
|
||||
auto [data, result] = aResult.ResolveValue();
|
||||
aCallback(std::move(data), result);
|
||||
} else {
|
||||
// For cases like the Utility Process crashes, the promise will be
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "mozilla/StaticPrefs_media.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TaskQueue.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsTArray.h"
|
||||
@ -251,11 +251,11 @@ class MediaDecoderStateMachine::StateObject {
|
||||
MediaQueue<VideoData>& VideoQueue() const { return mMaster->mVideoQueue; }
|
||||
|
||||
template <class S, typename... Args, size_t... Indexes>
|
||||
auto CallEnterMemberFunction(S* aS, Tuple<Args...>& aTuple,
|
||||
auto CallEnterMemberFunction(S* aS, std::tuple<Args...>& aTuple,
|
||||
std::index_sequence<Indexes...>)
|
||||
-> decltype(ReturnTypeHelper(&S::Enter)) {
|
||||
AUTO_PROFILER_LABEL("StateObject::CallEnterMemberFunction", MEDIA_PLAYBACK);
|
||||
return aS->Enter(std::move(Get<Indexes>(aTuple))...);
|
||||
return aS->Enter(std::move(std::get<Indexes>(aTuple))...);
|
||||
}
|
||||
|
||||
// Note this function will delete the current state object.
|
||||
@ -268,7 +268,7 @@ class MediaDecoderStateMachine::StateObject {
|
||||
// So we 1) pass the parameters by reference, but then 2) immediately copy
|
||||
// them into a Tuple to be safe against modification, and finally 3) move
|
||||
// the elements of the Tuple into the final function call.
|
||||
auto copiedArgs = MakeTuple(std::forward<Ts>(aArgs)...);
|
||||
auto copiedArgs = std::make_tuple(std::forward<Ts>(aArgs)...);
|
||||
|
||||
// Copy mMaster which will reset to null.
|
||||
auto* master = mMaster;
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/DataMutex.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
#include "nsISupportsImpl.h"
|
||||
|
@ -225,7 +225,7 @@ int MockCubebStream::Start() {
|
||||
}
|
||||
|
||||
int MockCubebStream::Stop() {
|
||||
mOutputVerificationEvent.Notify(MakeTuple(
|
||||
mOutputVerificationEvent.Notify(std::make_tuple(
|
||||
mAudioVerifier.PreSilenceSamples(), mAudioVerifier.EstimatedFreq(),
|
||||
mAudioVerifier.CountDiscontinuities()));
|
||||
int rv = MockCubeb::AsMock(context)->StopStream(this);
|
||||
@ -317,7 +317,7 @@ MediaEventSource<uint32_t>& MockCubebStream::FramesVerifiedEvent() {
|
||||
return mFramesVerifiedEvent;
|
||||
}
|
||||
|
||||
MediaEventSource<Tuple<uint64_t, float, uint32_t>>&
|
||||
MediaEventSource<std::tuple<uint64_t, float, uint32_t>>&
|
||||
MockCubebStream::OutputVerificationEvent() {
|
||||
return mOutputVerificationEvent;
|
||||
}
|
||||
|
@ -185,7 +185,8 @@ class MockCubebStream {
|
||||
MediaEventSource<cubeb_state>& StateEvent();
|
||||
MediaEventSource<uint32_t>& FramesProcessedEvent();
|
||||
MediaEventSource<uint32_t>& FramesVerifiedEvent();
|
||||
MediaEventSource<Tuple<uint64_t, float, uint32_t>>& OutputVerificationEvent();
|
||||
MediaEventSource<std::tuple<uint64_t, float, uint32_t>>&
|
||||
OutputVerificationEvent();
|
||||
MediaEventSource<void>& ErrorForcedEvent();
|
||||
MediaEventSource<void>& ErrorStoppedEvent();
|
||||
MediaEventSource<void>& DeviceChangeForcedEvent();
|
||||
@ -245,7 +246,8 @@ class MockCubebStream {
|
||||
MediaEventProducer<cubeb_state> mStateEvent;
|
||||
MediaEventProducer<uint32_t> mFramesProcessedEvent;
|
||||
MediaEventProducer<uint32_t> mFramesVerifiedEvent;
|
||||
MediaEventProducer<Tuple<uint64_t, float, uint32_t>> mOutputVerificationEvent;
|
||||
MediaEventProducer<std::tuple<uint64_t, float, uint32_t>>
|
||||
mOutputVerificationEvent;
|
||||
MediaEventProducer<void> mErrorForcedEvent;
|
||||
MediaEventProducer<void> mErrorStoppedEvent;
|
||||
MediaEventProducer<void> mDeviceChangedForcedEvent;
|
||||
|
@ -1283,7 +1283,7 @@ TEST(TestAudioTrackGraph, AudioProcessingTrack)
|
||||
uint64_t preSilenceSamples;
|
||||
uint32_t estimatedFreq;
|
||||
uint32_t nrDiscontinuities;
|
||||
Tie(preSilenceSamples, estimatedFreq, nrDiscontinuities) =
|
||||
std::tie(preSilenceSamples, estimatedFreq, nrDiscontinuities) =
|
||||
WaitFor(stream->OutputVerificationEvent());
|
||||
|
||||
EXPECT_EQ(estimatedFreq, inputFrequency);
|
||||
@ -1424,7 +1424,7 @@ TEST(TestAudioTrackGraph, ReConnectDeviceInput)
|
||||
uint64_t preSilenceSamples;
|
||||
uint32_t estimatedFreq;
|
||||
uint32_t nrDiscontinuities;
|
||||
Tie(preSilenceSamples, estimatedFreq, nrDiscontinuities) =
|
||||
std::tie(preSilenceSamples, estimatedFreq, nrDiscontinuities) =
|
||||
WaitFor(stream->OutputVerificationEvent());
|
||||
|
||||
EXPECT_EQ(estimatedFreq, inputFrequency);
|
||||
@ -1546,7 +1546,7 @@ TEST(TestAudioTrackGraph, AudioProcessingTrackDisabling)
|
||||
uint64_t preSilenceSamples;
|
||||
uint32_t estimatedFreq;
|
||||
uint32_t nrDiscontinuities;
|
||||
Tie(preSilenceSamples, estimatedFreq, nrDiscontinuities) =
|
||||
std::tie(preSilenceSamples, estimatedFreq, nrDiscontinuities) =
|
||||
WaitFor(stream->OutputVerificationEvent());
|
||||
|
||||
auto data = stream->TakeRecordedOutput();
|
||||
@ -2486,7 +2486,7 @@ void TestCrossGraphPort(uint32_t aInputRate, uint32_t aOutputRate,
|
||||
uint64_t preSilenceSamples;
|
||||
float estimatedFreq;
|
||||
uint32_t nrDiscontinuities;
|
||||
Tie(preSilenceSamples, estimatedFreq, nrDiscontinuities) =
|
||||
std::tie(preSilenceSamples, estimatedFreq, nrDiscontinuities) =
|
||||
WaitFor(partnerStream->OutputVerificationEvent());
|
||||
|
||||
EXPECT_NEAR(estimatedFreq, inputFrequency / aDriftFactor, 5);
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/gtest/MozAssertions.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "BufferStream.h"
|
||||
#include "MP4Metadata.h"
|
||||
#include "MoofParser.h"
|
||||
@ -840,10 +840,10 @@ TEST_F(MP4MetadataTelemetryFixture, Telemetry) {
|
||||
// and is used to log if our telem counts are not in an expected state.
|
||||
auto CheckHistograms =
|
||||
[this, &cx](
|
||||
const Tuple<uint32_t, uint32_t>& aExpectedMultipleCodecCounts,
|
||||
const Tuple<uint32_t, uint32_t>& aExpectedMultipleCryptoCounts,
|
||||
const Tuple<uint32_t, uint32_t, uint32_t, uint32_t, uint32_t,
|
||||
uint32_t>& aExpectedSampleDescriptionEntryCounts,
|
||||
const std::tuple<uint32_t, uint32_t>& aExpectedMultipleCodecCounts,
|
||||
const std::tuple<uint32_t, uint32_t>& aExpectedMultipleCryptoCounts,
|
||||
const std::tuple<uint32_t, uint32_t, uint32_t, uint32_t, uint32_t,
|
||||
uint32_t>& aExpectedSampleDescriptionEntryCounts,
|
||||
const char* aFileName) {
|
||||
// Get a snapshot of the current histograms
|
||||
JS::Rooted<JS::Value> snapshot(cx.GetJSContext());
|
||||
@ -870,13 +870,13 @@ TEST_F(MP4MetadataTelemetryFixture, Telemetry) {
|
||||
TelemetryTestHelpers::GetElement(cx.GetJSContext(), 0, values, &value);
|
||||
uint32_t uValue = 0;
|
||||
JS::ToUint32(cx.GetJSContext(), value, &uValue);
|
||||
EXPECT_EQ(Get<0>(aExpectedMultipleCodecCounts), uValue)
|
||||
EXPECT_EQ(std::get<0>(aExpectedMultipleCodecCounts), uValue)
|
||||
<< "Unexpected number of false multiple codecs after parsing "
|
||||
<< aFileName;
|
||||
// True count.
|
||||
TelemetryTestHelpers::GetElement(cx.GetJSContext(), 1, values, &value);
|
||||
JS::ToUint32(cx.GetJSContext(), value, &uValue);
|
||||
EXPECT_EQ(Get<1>(aExpectedMultipleCodecCounts), uValue)
|
||||
EXPECT_EQ(std::get<1>(aExpectedMultipleCodecCounts), uValue)
|
||||
<< "Unexpected number of true multiple codecs after parsing "
|
||||
<< aFileName;
|
||||
|
||||
@ -894,13 +894,13 @@ TEST_F(MP4MetadataTelemetryFixture, Telemetry) {
|
||||
// False count.
|
||||
TelemetryTestHelpers::GetElement(cx.GetJSContext(), 0, values, &value);
|
||||
JS::ToUint32(cx.GetJSContext(), value, &uValue);
|
||||
EXPECT_EQ(Get<0>(aExpectedMultipleCryptoCounts), uValue)
|
||||
EXPECT_EQ(std::get<0>(aExpectedMultipleCryptoCounts), uValue)
|
||||
<< "Unexpected number of false multiple cryptos after parsing "
|
||||
<< aFileName;
|
||||
// True count.
|
||||
TelemetryTestHelpers::GetElement(cx.GetJSContext(), 1, values, &value);
|
||||
JS::ToUint32(cx.GetJSContext(), value, &uValue);
|
||||
EXPECT_EQ(Get<1>(aExpectedMultipleCryptoCounts), uValue)
|
||||
EXPECT_EQ(std::get<1>(aExpectedMultipleCryptoCounts), uValue)
|
||||
<< "Unexpected number of true multiple cryptos after parsing "
|
||||
<< aFileName;
|
||||
|
||||
@ -917,32 +917,32 @@ TEST_F(MP4MetadataTelemetryFixture, Telemetry) {
|
||||
|
||||
TelemetryTestHelpers::GetElement(cx.GetJSContext(), 0, values, &value);
|
||||
JS::ToUint32(cx.GetJSContext(), value, &uValue);
|
||||
EXPECT_EQ(Get<0>(aExpectedSampleDescriptionEntryCounts), uValue)
|
||||
EXPECT_EQ(std::get<0>(aExpectedSampleDescriptionEntryCounts), uValue)
|
||||
<< "Unexpected number of 0 sample entry descriptions after parsing "
|
||||
<< aFileName;
|
||||
TelemetryTestHelpers::GetElement(cx.GetJSContext(), 1, values, &value);
|
||||
JS::ToUint32(cx.GetJSContext(), value, &uValue);
|
||||
EXPECT_EQ(Get<1>(aExpectedSampleDescriptionEntryCounts), uValue)
|
||||
EXPECT_EQ(std::get<1>(aExpectedSampleDescriptionEntryCounts), uValue)
|
||||
<< "Unexpected number of 1 sample entry descriptions after parsing "
|
||||
<< aFileName;
|
||||
TelemetryTestHelpers::GetElement(cx.GetJSContext(), 2, values, &value);
|
||||
JS::ToUint32(cx.GetJSContext(), value, &uValue);
|
||||
EXPECT_EQ(Get<2>(aExpectedSampleDescriptionEntryCounts), uValue)
|
||||
EXPECT_EQ(std::get<2>(aExpectedSampleDescriptionEntryCounts), uValue)
|
||||
<< "Unexpected number of 2 sample entry descriptions after parsing "
|
||||
<< aFileName;
|
||||
TelemetryTestHelpers::GetElement(cx.GetJSContext(), 3, values, &value);
|
||||
JS::ToUint32(cx.GetJSContext(), value, &uValue);
|
||||
EXPECT_EQ(Get<3>(aExpectedSampleDescriptionEntryCounts), uValue)
|
||||
EXPECT_EQ(std::get<3>(aExpectedSampleDescriptionEntryCounts), uValue)
|
||||
<< "Unexpected number of 3 sample entry descriptions after parsing "
|
||||
<< aFileName;
|
||||
TelemetryTestHelpers::GetElement(cx.GetJSContext(), 4, values, &value);
|
||||
JS::ToUint32(cx.GetJSContext(), value, &uValue);
|
||||
EXPECT_EQ(Get<4>(aExpectedSampleDescriptionEntryCounts), uValue)
|
||||
EXPECT_EQ(std::get<4>(aExpectedSampleDescriptionEntryCounts), uValue)
|
||||
<< "Unexpected number of 4 sample entry descriptions after parsing "
|
||||
<< aFileName;
|
||||
TelemetryTestHelpers::GetElement(cx.GetJSContext(), 5, values, &value);
|
||||
JS::ToUint32(cx.GetJSContext(), value, &uValue);
|
||||
EXPECT_EQ(Get<5>(aExpectedSampleDescriptionEntryCounts), uValue)
|
||||
EXPECT_EQ(std::get<5>(aExpectedSampleDescriptionEntryCounts), uValue)
|
||||
<< "Unexpected number of 5 sample entry descriptions after parsing "
|
||||
<< aFileName;
|
||||
};
|
||||
@ -977,11 +977,11 @@ TEST_F(MP4MetadataTelemetryFixture, Telemetry) {
|
||||
UpdateMetadataAndHistograms("test_case_1185230.mp4");
|
||||
|
||||
// Verify our histograms are updated.
|
||||
CheckHistograms(
|
||||
MakeTuple<uint32_t, uint32_t>(4, 0), MakeTuple<uint32_t, uint32_t>(4, 0),
|
||||
MakeTuple<uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t>(
|
||||
0, 4, 0, 0, 0, 0),
|
||||
"test_case_1185230.mp4");
|
||||
CheckHistograms(std::make_tuple<uint32_t, uint32_t>(4, 0),
|
||||
std::make_tuple<uint32_t, uint32_t>(4, 0),
|
||||
std::make_tuple<uint32_t, uint32_t, uint32_t, uint32_t,
|
||||
uint32_t, uint32_t>(0, 4, 0, 0, 0, 0),
|
||||
"test_case_1185230.mp4");
|
||||
|
||||
// Parse another test case. This one has a single moov with a single video
|
||||
// track. However, the track has two sample description entries, and our
|
||||
@ -990,11 +990,11 @@ TEST_F(MP4MetadataTelemetryFixture, Telemetry) {
|
||||
"test_case_1513651-2-sample-description-entries.mp4");
|
||||
|
||||
// Verify our histograms are updated.
|
||||
CheckHistograms(
|
||||
MakeTuple<uint32_t, uint32_t>(5, 0), MakeTuple<uint32_t, uint32_t>(5, 0),
|
||||
MakeTuple<uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t>(
|
||||
0, 4, 1, 0, 0, 0),
|
||||
"test_case_1513651-2-sample-description-entries.mp4");
|
||||
CheckHistograms(std::make_tuple<uint32_t, uint32_t>(5, 0),
|
||||
std::make_tuple<uint32_t, uint32_t>(5, 0),
|
||||
std::make_tuple<uint32_t, uint32_t, uint32_t, uint32_t,
|
||||
uint32_t, uint32_t>(0, 4, 1, 0, 0, 0),
|
||||
"test_case_1513651-2-sample-description-entries.mp4");
|
||||
|
||||
// Parse another test case. This one has 2 sample decription entries, both
|
||||
// with crypto information, which should be reflected in our telemetry.
|
||||
@ -1004,9 +1004,10 @@ TEST_F(MP4MetadataTelemetryFixture, Telemetry) {
|
||||
|
||||
// Verify our histograms are updated.
|
||||
CheckHistograms(
|
||||
MakeTuple<uint32_t, uint32_t>(6, 0), MakeTuple<uint32_t, uint32_t>(5, 1),
|
||||
MakeTuple<uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t>(
|
||||
0, 4, 2, 0, 0, 0),
|
||||
std::make_tuple<uint32_t, uint32_t>(6, 0),
|
||||
std::make_tuple<uint32_t, uint32_t>(5, 1),
|
||||
std::make_tuple<uint32_t, uint32_t, uint32_t, uint32_t, uint32_t,
|
||||
uint32_t>(0, 4, 2, 0, 0, 0),
|
||||
"test_case_1714125-2-sample-description-entires-with-identical-crypto."
|
||||
"mp4");
|
||||
}
|
||||
|
@ -492,13 +492,13 @@ RemoteDecoderManagerChild::LaunchRDDProcessIfNeeded() {
|
||||
return GenericNonExclusivePromise::CreateAndReject(
|
||||
NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
nsresult rv = Get<0>(aResult.ResolveValue());
|
||||
nsresult rv = std::get<0>(aResult.ResolveValue());
|
||||
if (NS_FAILED(rv)) {
|
||||
return GenericNonExclusivePromise::CreateAndReject(rv,
|
||||
__func__);
|
||||
}
|
||||
OpenRemoteDecoderManagerChildForProcess(
|
||||
Get<1>(std::move(aResult.ResolveValue())),
|
||||
std::get<1>(std::move(aResult.ResolveValue())),
|
||||
RemoteDecodeIn::RddProcess);
|
||||
return GenericNonExclusivePromise::CreateAndResolve(true,
|
||||
__func__);
|
||||
@ -586,13 +586,14 @@ RemoteDecoderManagerChild::LaunchUtilityProcessIfNeeded(
|
||||
return GenericNonExclusivePromise::CreateAndReject(
|
||||
NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
nsresult rv = Get<0>(aResult.ResolveValue());
|
||||
nsresult rv = std::get<0>(aResult.ResolveValue());
|
||||
if (NS_FAILED(rv)) {
|
||||
return GenericNonExclusivePromise::CreateAndReject(
|
||||
rv, __func__);
|
||||
}
|
||||
OpenRemoteDecoderManagerChildForProcess(
|
||||
Get<1>(std::move(aResult.ResolveValue())), aLocation);
|
||||
std::get<1>(std::move(aResult.ResolveValue())),
|
||||
aLocation);
|
||||
return GenericNonExclusivePromise::CreateAndResolve(
|
||||
true, __func__);
|
||||
});
|
||||
|
@ -88,12 +88,12 @@ already_AddRefed<MediaByteBuffer> RemoteArrayOfByteBuffer::MediaByteBufferAt(
|
||||
size_t aIndex) const {
|
||||
MOZ_ASSERT(aIndex < Count());
|
||||
const OffsetEntry& entry = mOffsets[aIndex];
|
||||
if (!mBuffers || !Get<1>(entry)) {
|
||||
if (!mBuffers || !std::get<1>(entry)) {
|
||||
// It's an empty one.
|
||||
return nullptr;
|
||||
}
|
||||
size_t entrySize = Get<1>(entry);
|
||||
if (!Check(Get<0>(entry), entrySize)) {
|
||||
size_t entrySize = std::get<1>(entry);
|
||||
if (!Check(std::get<0>(entry), entrySize)) {
|
||||
// This Shmem is corrupted and can't contain the data we are about to
|
||||
// retrieve. We return an empty array instead of asserting to allow for
|
||||
// recovery.
|
||||
@ -101,7 +101,7 @@ already_AddRefed<MediaByteBuffer> RemoteArrayOfByteBuffer::MediaByteBufferAt(
|
||||
}
|
||||
RefPtr<MediaByteBuffer> buffer = new MediaByteBuffer(entrySize);
|
||||
buffer->SetLength(entrySize);
|
||||
memcpy(buffer->Elements(), mBuffers->get<uint8_t>() + Get<0>(entry),
|
||||
memcpy(buffer->Elements(), mBuffers->get<uint8_t>() + std::get<0>(entry),
|
||||
entrySize);
|
||||
return buffer.forget();
|
||||
}
|
||||
|
@ -149,12 +149,12 @@ class RemoteArrayOfByteBuffer {
|
||||
AlignedBuffer<Type> AlignedBufferAt(size_t aIndex) const {
|
||||
MOZ_ASSERT(aIndex < Count());
|
||||
const OffsetEntry& entry = mOffsets[aIndex];
|
||||
size_t entrySize = Get<1>(entry);
|
||||
size_t entrySize = std::get<1>(entry);
|
||||
if (!mBuffers || !entrySize) {
|
||||
// It's an empty one.
|
||||
return AlignedBuffer<Type>();
|
||||
}
|
||||
if (!Check(Get<0>(entry), entrySize)) {
|
||||
if (!Check(std::get<0>(entry), entrySize)) {
|
||||
// This Shmem is corrupted and can't contain the data we are about to
|
||||
// retrieve. We return an empty array instead of asserting to allow for
|
||||
// recovery.
|
||||
@ -165,7 +165,7 @@ class RemoteArrayOfByteBuffer {
|
||||
return AlignedBuffer<Type>();
|
||||
}
|
||||
return AlignedBuffer<Type>(
|
||||
reinterpret_cast<Type*>(BuffersStartAddress() + Get<0>(entry)),
|
||||
reinterpret_cast<Type*>(BuffersStartAddress() + std::get<0>(entry)),
|
||||
entrySize / sizeof(Type));
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ class RemoteArrayOfByteBuffer {
|
||||
// Will return nullptr if the packed buffer was originally empty.
|
||||
already_AddRefed<MediaByteBuffer> MediaByteBufferAt(size_t aIndex) const;
|
||||
// Return the size of the aIndexth buffer.
|
||||
size_t SizeAt(size_t aIndex) const { return Get<1>(mOffsets[aIndex]); }
|
||||
size_t SizeAt(size_t aIndex) const { return std::get<1>(mOffsets[aIndex]); }
|
||||
// Return false if an out of memory error was encountered during construction.
|
||||
bool IsValid() const { return mIsValid; };
|
||||
// Return the number of buffers packed into this entity.
|
||||
@ -198,7 +198,7 @@ class RemoteArrayOfByteBuffer {
|
||||
Maybe<ipc::Shmem> mBuffers;
|
||||
// The offset to the start of the individual buffer and its size (all in
|
||||
// bytes)
|
||||
typedef Tuple<size_t, size_t> OffsetEntry;
|
||||
typedef std::tuple<size_t, size_t> OffsetEntry;
|
||||
nsTArray<OffsetEntry> mOffsets;
|
||||
};
|
||||
|
||||
|
@ -289,8 +289,8 @@ class PerformanceRecorderImpl : public PerformanceRecorderBase {
|
||||
void Start(int64_t aId, Args... aArgs) {
|
||||
if (IsMeasurementEnabled()) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
mStages.Push(MakeTuple(aId, GetCurrentTimeForMeasurement(),
|
||||
StageType(std::move(aArgs)...)));
|
||||
mStages.Push(std::make_tuple(aId, GetCurrentTimeForMeasurement(),
|
||||
StageType(std::move(aArgs)...)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,20 +302,20 @@ class PerformanceRecorderImpl : public PerformanceRecorderBase {
|
||||
Maybe<Entry> entry;
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
while (!mStages.IsEmpty() && Get<0>(mStages.Top()) < aId) {
|
||||
while (!mStages.IsEmpty() && std::get<0>(mStages.Top()) < aId) {
|
||||
mStages.Pop();
|
||||
}
|
||||
if (mStages.IsEmpty()) {
|
||||
return 0.0;
|
||||
}
|
||||
if (Get<0>(mStages.Top()) != aId) {
|
||||
if (std::get<0>(mStages.Top()) != aId) {
|
||||
return 0.0;
|
||||
}
|
||||
entry = Some(mStages.Pop());
|
||||
}
|
||||
const auto& startTime = Get<1>(*entry);
|
||||
auto& stage = Get<2>(*entry);
|
||||
MOZ_ASSERT(Get<0>(*entry) == aId);
|
||||
const auto& startTime = std::get<1>(*entry);
|
||||
auto& stage = std::get<2>(*entry);
|
||||
MOZ_ASSERT(std::get<0>(*entry) == aId);
|
||||
double elapsedTimeUs = 0.0;
|
||||
if (!startTime.IsNull() && IsMeasurementEnabled()) {
|
||||
const auto now = TimeStamp::Now();
|
||||
@ -334,11 +334,11 @@ class PerformanceRecorderImpl : public PerformanceRecorderBase {
|
||||
}
|
||||
|
||||
protected:
|
||||
using Entry = Tuple<int64_t, TimeStamp, StageType>;
|
||||
using Entry = std::tuple<int64_t, TimeStamp, StageType>;
|
||||
|
||||
struct IdComparator {
|
||||
bool LessThan(const Entry& aTupleA, const Entry& aTupleB) {
|
||||
return Get<0>(aTupleA) < Get<0>(aTupleB);
|
||||
return std::get<0>(aTupleA) < std::get<0>(aTupleB);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "mozilla/Result.h"
|
||||
#include "mozilla/ResultVariant.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/dom/CanvasUtils.h"
|
||||
#include "mozilla/dom/DOMRect.h"
|
||||
@ -53,8 +53,8 @@ NS_INTERFACE_MAP_END
|
||||
* The below are helpers to operate ArrayBuffer or ArrayBufferView.
|
||||
*/
|
||||
template <class T>
|
||||
static Result<Tuple<RangedPtr<uint8_t>, size_t>, nsresult> GetArrayBufferData(
|
||||
const T& aBuffer) {
|
||||
static Result<std::tuple<RangedPtr<uint8_t>, size_t>, nsresult>
|
||||
GetArrayBufferData(const T& aBuffer) {
|
||||
// Get buffer's data and length before using it.
|
||||
aBuffer.ComputeState();
|
||||
|
||||
@ -64,11 +64,11 @@ static Result<Tuple<RangedPtr<uint8_t>, size_t>, nsresult> GetArrayBufferData(
|
||||
return Err(NS_ERROR_INVALID_ARG);
|
||||
}
|
||||
|
||||
return MakeTuple(RangedPtr(aBuffer.Data(), byteLength.value()),
|
||||
byteLength.value());
|
||||
return std::make_tuple(RangedPtr(aBuffer.Data(), byteLength.value()),
|
||||
byteLength.value());
|
||||
}
|
||||
|
||||
static Result<Tuple<RangedPtr<uint8_t>, size_t>, nsresult>
|
||||
static Result<std::tuple<RangedPtr<uint8_t>, size_t>, nsresult>
|
||||
GetSharedArrayBufferData(
|
||||
const MaybeSharedArrayBufferViewOrMaybeSharedArrayBuffer& aBuffer) {
|
||||
if (aBuffer.IsArrayBufferView()) {
|
||||
@ -458,8 +458,9 @@ static Result<Maybe<gfx::IntSize>, nsCString> MaybeGetDisplaySize(
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webcodecs/#valid-videoframebufferinit
|
||||
static Result<Tuple<gfx::IntSize, Maybe<gfx::IntRect>, Maybe<gfx::IntSize>>,
|
||||
nsCString>
|
||||
static Result<
|
||||
std::tuple<gfx::IntSize, Maybe<gfx::IntRect>, Maybe<gfx::IntSize>>,
|
||||
nsCString>
|
||||
ValidateVideoFrameBufferInit(const VideoFrameBufferInit& aInit) {
|
||||
gfx::IntSize codedSize;
|
||||
MOZ_TRY_VAR(codedSize, ToIntSize(aInit.mCodedWidth, aInit.mCodedHeight)
|
||||
@ -483,7 +484,7 @@ ValidateVideoFrameBufferInit(const VideoFrameBufferInit& aInit) {
|
||||
Maybe<gfx::IntSize> displaySize;
|
||||
MOZ_TRY_VAR(displaySize, MaybeGetDisplaySize(aInit));
|
||||
|
||||
return MakeTuple(codedSize, visibleRect, displaySize);
|
||||
return std::make_tuple(codedSize, visibleRect, displaySize);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webcodecs/#videoframe-verify-rect-offset-alignment
|
||||
@ -736,7 +737,7 @@ static VideoColorSpaceInit PickColorSpace(
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webcodecs/#validate-videoframeinit
|
||||
static Result<Tuple<Maybe<gfx::IntRect>, Maybe<gfx::IntSize>>, nsCString>
|
||||
static Result<std::tuple<Maybe<gfx::IntRect>, Maybe<gfx::IntSize>>, nsCString>
|
||||
ValidateVideoFrameInit(const VideoFrameInit& aInit,
|
||||
const VideoFrame::Format& aFormat,
|
||||
const gfx::IntSize& aCodedSize) {
|
||||
@ -761,7 +762,7 @@ ValidateVideoFrameInit(const VideoFrameInit& aInit,
|
||||
Maybe<gfx::IntSize> displaySize;
|
||||
MOZ_TRY_VAR(displaySize, MaybeGetDisplaySize(aInit));
|
||||
|
||||
return MakeTuple(visibleRect, displaySize);
|
||||
return std::make_tuple(visibleRect, displaySize);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -984,11 +985,11 @@ static Result<RefPtr<VideoFrame>, nsCString> CreateVideoFrameFromBuffer(
|
||||
return Err(nsCString("linear RGB is not supported"));
|
||||
}
|
||||
|
||||
Tuple<gfx::IntSize, Maybe<gfx::IntRect>, Maybe<gfx::IntSize>> init;
|
||||
std::tuple<gfx::IntSize, Maybe<gfx::IntRect>, Maybe<gfx::IntSize>> init;
|
||||
MOZ_TRY_VAR(init, ValidateVideoFrameBufferInit(aInit));
|
||||
gfx::IntSize codedSize = Get<0>(init);
|
||||
Maybe<gfx::IntRect> visibleRect = Get<1>(init);
|
||||
Maybe<gfx::IntSize> displaySize = Get<2>(init);
|
||||
gfx::IntSize codedSize = std::get<0>(init);
|
||||
Maybe<gfx::IntRect> visibleRect = std::get<1>(init);
|
||||
Maybe<gfx::IntSize> displaySize = std::get<2>(init);
|
||||
|
||||
VideoFrame::Format format(aInit.mFormat);
|
||||
// TODO: Spec doesn't ask for this in ctor but Pixel Format does. See
|
||||
@ -1017,9 +1018,9 @@ static Result<RefPtr<VideoFrame>, nsCString> CreateVideoFrameFromBuffer(
|
||||
if (r.isErr()) {
|
||||
return Err(nsCString("data is too large"));
|
||||
}
|
||||
Tuple<RangedPtr<uint8_t>, size_t> bufInfo = r.unwrap();
|
||||
RangedPtr<uint8_t> ptr(Get<0>(bufInfo));
|
||||
size_t byteLength = Get<1>(bufInfo);
|
||||
std::tuple<RangedPtr<uint8_t>, size_t> bufInfo = r.unwrap();
|
||||
RangedPtr<uint8_t> ptr(std::get<0>(bufInfo));
|
||||
size_t byteLength = std::get<1>(bufInfo);
|
||||
|
||||
if (byteLength < static_cast<size_t>(combinedLayout.mAllocationSize)) {
|
||||
return Err(nsCString("data is too small"));
|
||||
@ -1115,11 +1116,11 @@ InitializeFrameWithResourceAndSize(
|
||||
return Err(nsCString("This image has unsupport format"));
|
||||
}
|
||||
|
||||
Tuple<Maybe<gfx::IntRect>, Maybe<gfx::IntSize>> init;
|
||||
std::tuple<Maybe<gfx::IntRect>, Maybe<gfx::IntSize>> init;
|
||||
MOZ_TRY_VAR(init,
|
||||
ValidateVideoFrameInit(aInit, format.ref(), image->GetSize()));
|
||||
Maybe<gfx::IntRect> visibleRect = Get<0>(init);
|
||||
Maybe<gfx::IntSize> displaySize = Get<1>(init);
|
||||
Maybe<gfx::IntRect> visibleRect = std::get<0>(init);
|
||||
Maybe<gfx::IntSize> displaySize = std::get<1>(init);
|
||||
|
||||
if (aInit.mAlpha == AlphaOption::Discard) {
|
||||
format->MakeOpaque();
|
||||
@ -1154,11 +1155,11 @@ InitializeFrameFromOtherFrame(nsIGlobalObject* aGlobal, VideoFrameData&& aData,
|
||||
// Keep the alpha data in image for now until it's being rendered.
|
||||
}
|
||||
|
||||
Tuple<Maybe<gfx::IntRect>, Maybe<gfx::IntSize>> init;
|
||||
std::tuple<Maybe<gfx::IntRect>, Maybe<gfx::IntSize>> init;
|
||||
MOZ_TRY_VAR(init,
|
||||
ValidateVideoFrameInit(aInit, format, aData.mImage->GetSize()));
|
||||
Maybe<gfx::IntRect> visibleRect = Get<0>(init);
|
||||
Maybe<gfx::IntSize> displaySize = Get<1>(init);
|
||||
Maybe<gfx::IntRect> visibleRect = std::get<0>(init);
|
||||
Maybe<gfx::IntSize> displaySize = std::get<1>(init);
|
||||
|
||||
InitializeVisibleRectAndDisplaySize(visibleRect, displaySize,
|
||||
aData.mVisibleRect, aData.mDisplaySize);
|
||||
@ -1732,9 +1733,9 @@ already_AddRefed<Promise> VideoFrame::CopyTo(
|
||||
p->MaybeRejectWithTypeError("Failed to get buffer");
|
||||
return p.forget();
|
||||
}
|
||||
Tuple<RangedPtr<uint8_t>, size_t> bufInfo = r2.unwrap();
|
||||
RangedPtr<uint8_t> ptr(Get<0>(bufInfo));
|
||||
size_t byteLength = Get<1>(bufInfo);
|
||||
std::tuple<RangedPtr<uint8_t>, size_t> bufInfo = r2.unwrap();
|
||||
RangedPtr<uint8_t> ptr(std::get<0>(bufInfo));
|
||||
size_t byteLength = std::get<1>(bufInfo);
|
||||
|
||||
if (byteLength < layout.mAllocationSize) {
|
||||
p->MaybeRejectWithTypeError("Destination buffer is too small");
|
||||
|
@ -39,7 +39,6 @@
|
||||
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/net/DataChannel.h"
|
||||
#include "mozilla/TupleCycleCollection.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "VideoSegment.h"
|
||||
#include "mozilla/dom/RTCStatsReportBinding.h"
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "mozilla/AlreadyAddRefed.h"
|
||||
#include "mozilla/TupleCycleCollection.h"
|
||||
#include "mozilla/ResultExtensions.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
|
@ -25,7 +25,7 @@ using namespace ipc;
|
||||
|
||||
namespace dom {
|
||||
|
||||
Tuple<Maybe<ParentToParentInternalResponse>, Maybe<ResponseEndArgs>>
|
||||
std::tuple<Maybe<ParentToParentInternalResponse>, Maybe<ResponseEndArgs>>
|
||||
FetchEventOpParent::OnStart(
|
||||
MovingNotNull<RefPtr<FetchEventOpProxyParent>> aFetchEventOpProxyParent) {
|
||||
Maybe<ParentToParentInternalResponse> preloadResponse =
|
||||
@ -33,7 +33,7 @@ FetchEventOpParent::OnStart(
|
||||
Maybe<ResponseEndArgs> preloadResponseEndArgs =
|
||||
std::move(mState.as<Pending>().mEndArgs);
|
||||
mState = AsVariant(Started{std::move(aFetchEventOpProxyParent)});
|
||||
return MakeTuple(preloadResponse, preloadResponseEndArgs);
|
||||
return std::make_tuple(preloadResponse, preloadResponseEndArgs);
|
||||
}
|
||||
|
||||
void FetchEventOpParent::OnFinish() {
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
#include "mozilla/Tuple.h"
|
||||
#include "mozilla/dom/FetchEventOpProxyParent.h"
|
||||
#include "mozilla/dom/PFetchEventOpParent.h"
|
||||
|
||||
@ -25,7 +24,8 @@ class FetchEventOpParent final : public PFetchEventOpParent {
|
||||
|
||||
// Transition from the Pending state to the Started state. Returns the preload
|
||||
// response and response end args, if it has already arrived.
|
||||
Tuple<Maybe<ParentToParentInternalResponse>, Maybe<ResponseEndArgs>> OnStart(
|
||||
std::tuple<Maybe<ParentToParentInternalResponse>, Maybe<ResponseEndArgs>>
|
||||
OnStart(
|
||||
MovingNotNull<RefPtr<FetchEventOpProxyParent>> aFetchEventOpProxyParent);
|
||||
|
||||
// Transition from the Started state to the Finished state.
|
||||
|
@ -40,10 +40,7 @@ nsresult GetIPCSynthesizeResponseArgs(
|
||||
SynthesizeResponseArgs&& aArgs) {
|
||||
MOZ_ASSERT(RemoteWorkerService::Thread()->IsOnCurrentThread());
|
||||
|
||||
SafeRefPtr<InternalResponse> internalResponse;
|
||||
FetchEventRespondWithClosure closure;
|
||||
FetchEventTimeStamps timeStamps;
|
||||
Tie(internalResponse, closure, timeStamps) = std::move(aArgs);
|
||||
auto [internalResponse, closure, timeStamps] = std::move(aArgs);
|
||||
|
||||
aIPCArgs->closure() = std::move(closure);
|
||||
aIPCArgs->timeStamps() = std::move(timeStamps);
|
||||
|
@ -142,9 +142,7 @@ ParentToParentFetchEventRespondWithResult ToParentToParent(
|
||||
// need to add it to the arguments. Note that we have to make sure that the
|
||||
// arguments don't contain the preload response already, otherwise we'll end
|
||||
// up overwriting it with a Nothing.
|
||||
Maybe<ParentToParentInternalResponse> preloadResponse;
|
||||
Maybe<ResponseEndArgs> preloadResponseEndArgs;
|
||||
Tie(preloadResponse, preloadResponseEndArgs) =
|
||||
auto [preloadResponse, preloadResponseEndArgs] =
|
||||
actor->mReal->OnStart(WrapNotNull(actor));
|
||||
if (copyArgs.preloadResponse().isNothing() && preloadResponse.isSome()) {
|
||||
copyArgs.preloadResponse() = Some(ToParentToChild(
|
||||
|
@ -1520,7 +1520,7 @@ void FetchEventOp::ResolvedCallback(JSContext* aCx,
|
||||
// where it's going.
|
||||
mHandled->MaybeResolveWithUndefined();
|
||||
mRespondWithPromiseHolder.Resolve(
|
||||
FetchEventRespondWithResult(MakeTuple(
|
||||
FetchEventRespondWithResult(std::make_tuple(
|
||||
std::move(ir), mRespondWithClosure.ref(),
|
||||
FetchEventTimeStamps(mFetchHandlerStart, mFetchHandlerFinish))),
|
||||
__func__);
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "mozilla/MozPromise.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "mozilla/dom/SafeRefPtr.h"
|
||||
#include "mozilla/dom/ServiceWorkerOpArgs.h"
|
||||
|
||||
@ -19,8 +19,8 @@ namespace mozilla::dom {
|
||||
class InternalResponse;
|
||||
|
||||
using SynthesizeResponseArgs =
|
||||
Tuple<SafeRefPtr<InternalResponse>, FetchEventRespondWithClosure,
|
||||
FetchEventTimeStamps>;
|
||||
std::tuple<SafeRefPtr<InternalResponse>, FetchEventRespondWithClosure,
|
||||
FetchEventTimeStamps>;
|
||||
|
||||
using FetchEventRespondWithResult =
|
||||
Variant<SynthesizeResponseArgs, ResetInterceptionArgs,
|
||||
|
@ -328,17 +328,17 @@ already_AddRefed<Promise> ServiceWorkerRegistration::Unregister(
|
||||
}
|
||||
|
||||
mActor->SendUnregister(
|
||||
[outer](Tuple<bool, CopyableErrorResult>&& aResult) {
|
||||
if (Get<1>(aResult).Failed()) {
|
||||
[outer](std::tuple<bool, CopyableErrorResult>&& aResult) {
|
||||
if (std::get<1>(aResult).Failed()) {
|
||||
// application layer error
|
||||
// register() should be resilient and resolve false instead of
|
||||
// rejecting in most cases.
|
||||
Get<1>(aResult).SuppressException();
|
||||
std::get<1>(aResult).SuppressException();
|
||||
outer->MaybeResolve(false);
|
||||
return;
|
||||
}
|
||||
// success
|
||||
outer->MaybeResolve(Get<0>(aResult));
|
||||
outer->MaybeResolve(std::get<0>(aResult));
|
||||
},
|
||||
[outer](ResponseRejectReason&& aReason) {
|
||||
// IPC layer error
|
||||
|
@ -31,7 +31,7 @@ namespace {
|
||||
void ResolveUnregister(
|
||||
PServiceWorkerRegistrationParent::UnregisterResolver&& aResolver,
|
||||
bool aSuccess, nsresult aRv) {
|
||||
aResolver(Tuple<const bool&, const CopyableErrorResult&>(
|
||||
aResolver(std::tuple<const bool&, const CopyableErrorResult&>(
|
||||
aSuccess, CopyableErrorResult(aRv)));
|
||||
}
|
||||
|
||||
|
@ -330,13 +330,13 @@ void WebTransport::Init(const GlobalObject& aGlobal, const nsAString& aURL,
|
||||
[self = RefPtr{this},
|
||||
child](PBackgroundChild::CreateWebTransportParentPromise::
|
||||
ResolveOrRejectValue&& aResult) {
|
||||
// aResult is a Tuple<nsresult, uint8_t>
|
||||
// aResult is a std::tuple<nsresult, uint8_t>
|
||||
// TODO: is there a better/more-spec-compliant error in the
|
||||
// reject case? Which begs the question, why would we get a
|
||||
// reject?
|
||||
nsresult rv = aResult.IsReject()
|
||||
? NS_ERROR_FAILURE
|
||||
: Get<0>(aResult.ResolveValue());
|
||||
: std::get<0>(aResult.ResolveValue());
|
||||
LOG(("isreject: %d nsresult 0x%x", aResult.IsReject(),
|
||||
(uint32_t)rv));
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -347,7 +347,7 @@ void WebTransport::Init(const GlobalObject& aGlobal, const nsAString& aURL,
|
||||
|
||||
self->ResolveWaitingConnection(
|
||||
static_cast<WebTransportReliabilityMode>(
|
||||
Get<1>(aResult.ResolveValue())),
|
||||
std::get<1>(aResult.ResolveValue())),
|
||||
child);
|
||||
}
|
||||
});
|
||||
|
@ -36,7 +36,8 @@ void WebTransportParent::Create(
|
||||
const bool& aRequireUnreliable, const uint32_t& aCongestionControl,
|
||||
// Sequence<WebTransportHash>* aServerCertHashes,
|
||||
Endpoint<PWebTransportParent>&& aParentEndpoint,
|
||||
std::function<void(Tuple<const nsresult&, const uint8_t&>)>&& aResolver) {
|
||||
std::function<void(std::tuple<const nsresult&, const uint8_t&>)>&&
|
||||
aResolver) {
|
||||
LOG(("Created WebTransportParent %p %s %s %s congestion=%s", this,
|
||||
NS_ConvertUTF16toUTF8(aURL).get(),
|
||||
aDedicated ? "Dedicated" : "AllowPooling",
|
||||
|
@ -30,12 +30,13 @@ class WebTransportParent : public PWebTransportParent,
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_WEBTRANSPORTSESSIONEVENTLISTENER
|
||||
|
||||
void Create(
|
||||
const nsAString& aURL, nsIPrincipal* aPrincipal, const bool& aDedicated,
|
||||
const bool& aRequireUnreliable, const uint32_t& aCongestionControl,
|
||||
// Sequence<WebTransportHash>* aServerCertHashes,
|
||||
Endpoint<PWebTransportParent>&& aParentEndpoint,
|
||||
std::function<void(Tuple<const nsresult&, const uint8_t&>)>&& aResolver);
|
||||
void Create(const nsAString& aURL, nsIPrincipal* aPrincipal,
|
||||
const bool& aDedicated, const bool& aRequireUnreliable,
|
||||
const uint32_t& aCongestionControl,
|
||||
// Sequence<WebTransportHash>* aServerCertHashes,
|
||||
Endpoint<PWebTransportParent>&& aParentEndpoint,
|
||||
std::function<void(std::tuple<const nsresult&, const uint8_t&>)>&&
|
||||
aResolver);
|
||||
|
||||
IPCResult RecvClose(const uint32_t& aCode, const nsACString& aReason);
|
||||
|
||||
@ -57,7 +58,7 @@ class WebTransportParent : public PWebTransportParent,
|
||||
private:
|
||||
void NotifyRemoteClosed(uint32_t aErrorCode, const nsACString& aReason);
|
||||
|
||||
using ResolveType = Tuple<const nsresult&, const uint8_t&>;
|
||||
using ResolveType = std::tuple<const nsresult&, const uint8_t&>;
|
||||
nsCOMPtr<nsISerialEventTarget> mSocketThread;
|
||||
Atomic<bool> mSessionReady{false};
|
||||
|
||||
|
@ -2085,7 +2085,7 @@ template <class T>
|
||||
nsresult PermissionManager::RemovePermissionEntries(T aCondition) {
|
||||
EnsureReadCompleted();
|
||||
|
||||
Vector<Tuple<nsCOMPtr<nsIPrincipal>, nsCString, nsCString>, 10> array;
|
||||
Vector<std::tuple<nsCOMPtr<nsIPrincipal>, nsCString, nsCString>, 10> array;
|
||||
for (const PermissionHashKey& entry : mPermissionTable) {
|
||||
for (const auto& permEntry : entry.GetPermissions()) {
|
||||
if (!aCondition(permEntry)) {
|
||||
@ -2110,10 +2110,10 @@ nsresult PermissionManager::RemovePermissionEntries(T aCondition) {
|
||||
|
||||
for (auto& i : array) {
|
||||
// AddInternal handles removal, so let it do the work...
|
||||
AddInternal(Get<0>(i), Get<1>(i), nsIPermissionManager::UNKNOWN_ACTION, 0,
|
||||
nsIPermissionManager::EXPIRE_NEVER, 0, 0,
|
||||
PermissionManager::eNotify, PermissionManager::eWriteToDB,
|
||||
false, &Get<2>(i));
|
||||
AddInternal(
|
||||
std::get<0>(i), std::get<1>(i), nsIPermissionManager::UNKNOWN_ACTION, 0,
|
||||
nsIPermissionManager::EXPIRE_NEVER, 0, 0, PermissionManager::eNotify,
|
||||
PermissionManager::eWriteToDB, false, &std::get<2>(i));
|
||||
}
|
||||
|
||||
// now re-import any defaults as they may now be required if we just deleted
|
||||
@ -2630,7 +2630,8 @@ nsresult PermissionManager::RemovePermissionsWithAttributes(
|
||||
OriginAttributesPattern& aPattern) {
|
||||
EnsureReadCompleted();
|
||||
|
||||
Vector<Tuple<nsCOMPtr<nsIPrincipal>, nsCString, nsCString>, 10> permissions;
|
||||
Vector<std::tuple<nsCOMPtr<nsIPrincipal>, nsCString, nsCString>, 10>
|
||||
permissions;
|
||||
for (const PermissionHashKey& entry : mPermissionTable) {
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
nsresult rv = GetPrincipalFromOrigin(entry.GetKey()->mOrigin, false,
|
||||
@ -2652,10 +2653,10 @@ nsresult PermissionManager::RemovePermissionsWithAttributes(
|
||||
}
|
||||
|
||||
for (auto& i : permissions) {
|
||||
AddInternal(Get<0>(i), Get<1>(i), nsIPermissionManager::UNKNOWN_ACTION, 0,
|
||||
nsIPermissionManager::EXPIRE_NEVER, 0, 0,
|
||||
PermissionManager::eNotify, PermissionManager::eWriteToDB,
|
||||
false, &Get<2>(i));
|
||||
AddInternal(
|
||||
std::get<0>(i), std::get<1>(i), nsIPermissionManager::UNKNOWN_ACTION, 0,
|
||||
nsIPermissionManager::EXPIRE_NEVER, 0, 0, PermissionManager::eNotify,
|
||||
PermissionManager::eWriteToDB, false, &std::get<2>(i));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -47,15 +47,15 @@ RemoteSpellcheckEngineChild::SetCurrentDictionaryFromList(
|
||||
|
||||
return SendSetDictionaryFromList(aList)->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[spellChecker](Tuple<bool, nsCString>&& aParam) {
|
||||
if (!Get<0>(aParam)) {
|
||||
[spellChecker](std::tuple<bool, nsCString>&& aParam) {
|
||||
if (!std::get<0>(aParam)) {
|
||||
spellChecker->mCurrentDictionaries.Clear();
|
||||
return GenericPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE,
|
||||
__func__);
|
||||
}
|
||||
spellChecker->mCurrentDictionaries.Clear();
|
||||
spellChecker->mCurrentDictionaries.AppendElement(
|
||||
std::move(Get<1>(aParam)));
|
||||
std::move(std::get<1>(aParam)));
|
||||
return GenericPromise::CreateAndResolve(true, __func__);
|
||||
},
|
||||
[spellChecker](ResponseRejectReason&& aReason) {
|
||||
|
@ -38,11 +38,11 @@ mozilla::ipc::IPCResult RemoteSpellcheckEngineParent::RecvSetDictionaryFromList(
|
||||
for (auto& dictionary : aList) {
|
||||
nsresult rv = mSpellChecker->SetCurrentDictionary(dictionary);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aResolve(Tuple<const bool&, const nsACString&>(true, dictionary));
|
||||
aResolve(std::tuple<const bool&, const nsACString&>(true, dictionary));
|
||||
return IPC_OK();
|
||||
}
|
||||
}
|
||||
aResolve(Tuple<const bool&, const nsACString&>(false, ""_ns));
|
||||
aResolve(std::tuple<const bool&, const nsACString&>(false, ""_ns));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
#ifdef MOZ_LOGGING
|
||||
# include "mozilla/Logging.h"
|
||||
#endif
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
# include "nsDebug.h"
|
||||
@ -196,7 +195,7 @@ struct CriticalLogger {
|
||||
// preset capacity we may not get all of them, so the indices help figure out
|
||||
// which ones we did save. The double is expected to be the "TimeDuration",
|
||||
// time in seconds since the process creation.
|
||||
typedef mozilla::Tuple<int32_t, std::string, double> LoggingRecordEntry;
|
||||
typedef std::tuple<int32_t, std::string, double> LoggingRecordEntry;
|
||||
|
||||
// Implement this interface and init the Factory with an instance to
|
||||
// forward critical logs.
|
||||
|
@ -287,8 +287,8 @@ void CrashStatsLogForwarder::UpdateCrashReport() {
|
||||
}
|
||||
|
||||
for (auto& it : mBuffer) {
|
||||
message << logAnnotation << Get<0>(it) << "]" << Get<1>(it)
|
||||
<< " (t=" << Get<2>(it) << ") ";
|
||||
message << logAnnotation << std::get<0>(it) << "]" << std::get<1>(it)
|
||||
<< " (t=" << std::get<2>(it) << ") ";
|
||||
}
|
||||
|
||||
nsCString reportString(message.str().c_str());
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "gfxUtils.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/SVGImageContext.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "mozilla/gfx/2D.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -215,9 +215,8 @@ Maybe<AspectRatio> ClippedImage::GetIntrinsicRatio() {
|
||||
|
||||
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
|
||||
ClippedImage::GetFrame(uint32_t aWhichFrame, uint32_t aFlags) {
|
||||
ImgDrawResult result;
|
||||
RefPtr<SourceSurface> surface;
|
||||
Tie(result, surface) = GetFrameInternal(mClip.Size(), SVGImageContext(),
|
||||
std::tie(std::ignore, surface) = GetFrameInternal(mClip.Size(), SVGImageContext(),
|
||||
Nothing(), aWhichFrame, aFlags, 1.0);
|
||||
return surface.forget();
|
||||
}
|
||||
@ -338,10 +337,8 @@ ClippedImage::Draw(gfxContext* aContext, const nsIntSize& aSize,
|
||||
if (MustCreateSurface(aContext, aSize, aRegion, aFlags)) {
|
||||
// Create a temporary surface containing a single tile of this image.
|
||||
// GetFrame will call DrawSingleTile internally.
|
||||
ImgDrawResult result;
|
||||
RefPtr<SourceSurface> surface;
|
||||
Tie(result, surface) = GetFrameInternal(aSize, aSVGContext, Nothing(),
|
||||
aWhichFrame, aFlags, aOpacity);
|
||||
auto [result, surface] = GetFrameInternal(aSize, aSVGContext, Nothing(),
|
||||
aWhichFrame, aFlags, aOpacity);
|
||||
if (!surface) {
|
||||
MOZ_ASSERT(result != ImgDrawResult::SUCCESS);
|
||||
return result;
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/SizeOfState.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Tuple.h" // for Tie
|
||||
// for Tie
|
||||
#include "mozilla/layers/SharedSurfacesChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "mozilla/SizeOfState.h"
|
||||
#include "mozilla/ThreadSafeWeakPtr.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "gfx2DGlue.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "ImageContainer.h"
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "mozilla/StaticPrefs_image.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/Scale.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "mozilla/StaticMutex.h"
|
||||
#include "mozilla/StaticPrefs_image.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "nsExpirationTracker.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
@ -330,19 +330,21 @@ class ImageSurfaceCache {
|
||||
* an IntSize which is the size the caller should choose to decode
|
||||
* at should it attempt to do so.
|
||||
*/
|
||||
Tuple<already_AddRefed<CachedSurface>, MatchType, IntSize> LookupBestMatch(
|
||||
const SurfaceKey& aIdealKey) {
|
||||
std::tuple<already_AddRefed<CachedSurface>, MatchType, IntSize>
|
||||
LookupBestMatch(const SurfaceKey& aIdealKey) {
|
||||
// Try for an exact match first.
|
||||
RefPtr<CachedSurface> exactMatch;
|
||||
mSurfaces.Get(aIdealKey, getter_AddRefs(exactMatch));
|
||||
if (exactMatch) {
|
||||
if (exactMatch->IsDecoded()) {
|
||||
return MakeTuple(exactMatch.forget(), MatchType::EXACT, IntSize());
|
||||
return std::make_tuple(exactMatch.forget(), MatchType::EXACT,
|
||||
IntSize());
|
||||
}
|
||||
} else if (aIdealKey.Region()) {
|
||||
// We cannot substitute if we have a region. Allow it to create an exact
|
||||
// match.
|
||||
return MakeTuple(exactMatch.forget(), MatchType::NOT_FOUND, IntSize());
|
||||
return std::make_tuple(exactMatch.forget(), MatchType::NOT_FOUND,
|
||||
IntSize());
|
||||
} else if (!mFactor2Mode) {
|
||||
// If no exact match is found, and we are not in factor of 2 mode, then
|
||||
// we know that we will trigger a decode because at best we will provide
|
||||
@ -358,8 +360,9 @@ class ImageSurfaceCache {
|
||||
mSurfaces.Get(compactKey, getter_AddRefs(exactMatch));
|
||||
if (exactMatch && exactMatch->IsDecoded()) {
|
||||
MOZ_ASSERT(suggestedSize != aIdealKey.Size());
|
||||
return MakeTuple(exactMatch.forget(),
|
||||
MatchType::SUBSTITUTE_BECAUSE_BEST, suggestedSize);
|
||||
return std::make_tuple(exactMatch.forget(),
|
||||
MatchType::SUBSTITUTE_BECAUSE_BEST,
|
||||
suggestedSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -439,7 +442,7 @@ class ImageSurfaceCache {
|
||||
}
|
||||
}
|
||||
|
||||
return MakeTuple(bestMatch.forget(), matchType, suggestedSize);
|
||||
return std::make_tuple(bestMatch.forget(), matchType, suggestedSize);
|
||||
}
|
||||
|
||||
void MaybeSetFactor2Mode() {
|
||||
@ -1029,7 +1032,7 @@ class SurfaceCacheImpl final : public nsIMemoryReporter {
|
||||
MatchType matchType = MatchType::NOT_FOUND;
|
||||
IntSize suggestedSize;
|
||||
while (true) {
|
||||
Tie(surface, matchType, suggestedSize) =
|
||||
std::tie(surface, matchType, suggestedSize) =
|
||||
cache->LookupBestMatch(aSurfaceKey);
|
||||
|
||||
if (!surface) {
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "AnimationParams.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/Variant.h"
|
||||
@ -546,9 +546,7 @@ class SurfaceFilter {
|
||||
|
||||
PixelType* rowPtr = reinterpret_cast<PixelType*>(mRowPointer);
|
||||
int32_t remainder = mInputSize.width - mCol;
|
||||
int32_t written;
|
||||
Maybe<WriteState> result;
|
||||
Tie(written, result) = aFunc(&rowPtr[mCol], remainder);
|
||||
auto [written, result] = aFunc(&rowPtr[mCol], remainder);
|
||||
if (written == remainder) {
|
||||
MOZ_ASSERT(result.isNothing());
|
||||
mCol = mInputSize.width;
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/StaticPrefs_image.h"
|
||||
#include "mozilla/SVGObserverUtils.h" // for SVGRenderingObserver
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsPresContext.h"
|
||||
@ -692,9 +692,7 @@ VectorImage::GetFrameAtSize(const IntSize& aSize, uint32_t aWhichFrame,
|
||||
|
||||
uint32_t whichFrame = mHaveAnimations ? aWhichFrame : FRAME_FIRST;
|
||||
|
||||
RefPtr<SourceSurface> sourceSurface;
|
||||
IntSize decodeSize;
|
||||
Tie(sourceSurface, decodeSize) =
|
||||
auto [sourceSurface, decodeSize] =
|
||||
LookupCachedSurface(aSize, SVGImageContext(), aFlags);
|
||||
if (sourceSurface) {
|
||||
return sourceSurface.forget();
|
||||
@ -1008,7 +1006,7 @@ VectorImage::Draw(gfxContext* aContext, const nsIntSize& aSize,
|
||||
// If we have an prerasterized version of this image that matches the
|
||||
// drawing parameters, use that.
|
||||
RefPtr<SourceSurface> sourceSurface;
|
||||
Tie(sourceSurface, params.size) =
|
||||
std::tie(sourceSurface, params.size) =
|
||||
LookupCachedSurface(aSize, params.svgContext, aFlags);
|
||||
if (sourceSurface) {
|
||||
RefPtr<gfxDrawable> drawable =
|
||||
@ -1051,7 +1049,7 @@ already_AddRefed<gfxDrawable> VectorImage::CreateSVGDrawable(
|
||||
return svgDrawable.forget();
|
||||
}
|
||||
|
||||
Tuple<RefPtr<SourceSurface>, IntSize> VectorImage::LookupCachedSurface(
|
||||
std::tuple<RefPtr<SourceSurface>, IntSize> VectorImage::LookupCachedSurface(
|
||||
const IntSize& aSize, const SVGImageContext& aSVGContext, uint32_t aFlags) {
|
||||
// We can't use cached surfaces if we:
|
||||
// - Explicitly disallow it via FLAG_BYPASS_SURFACE_CACHE
|
||||
@ -1059,7 +1057,7 @@ Tuple<RefPtr<SourceSurface>, IntSize> VectorImage::LookupCachedSurface(
|
||||
// - Have animations which aren't supported by the cache.
|
||||
if (aFlags & (FLAG_BYPASS_SURFACE_CACHE | FLAG_RECORD_BLOB) ||
|
||||
mHaveAnimations) {
|
||||
return MakeTuple(RefPtr<SourceSurface>(), aSize);
|
||||
return std::make_tuple(RefPtr<SourceSurface>(), aSize);
|
||||
}
|
||||
|
||||
LookupResult result(MatchType::NOT_FOUND);
|
||||
@ -1077,7 +1075,7 @@ Tuple<RefPtr<SourceSurface>, IntSize> VectorImage::LookupCachedSurface(
|
||||
MOZ_ASSERT(result.Type() != MatchType::SUBSTITUTE_BECAUSE_PENDING);
|
||||
if (!result || result.Type() == MatchType::SUBSTITUTE_BECAUSE_NOT_FOUND) {
|
||||
// No matching surface, or the OS freed the volatile buffer.
|
||||
return MakeTuple(RefPtr<SourceSurface>(), rasterSize);
|
||||
return std::make_tuple(RefPtr<SourceSurface>(), rasterSize);
|
||||
}
|
||||
|
||||
RefPtr<SourceSurface> sourceSurface = result.Surface()->GetSourceSurface();
|
||||
@ -1085,10 +1083,10 @@ Tuple<RefPtr<SourceSurface>, IntSize> VectorImage::LookupCachedSurface(
|
||||
// Something went wrong. (Probably a GPU driver crash or device reset.)
|
||||
// Attempt to recover.
|
||||
RecoverFromLossOfSurfaces();
|
||||
return MakeTuple(RefPtr<SourceSurface>(), rasterSize);
|
||||
return std::make_tuple(RefPtr<SourceSurface>(), rasterSize);
|
||||
}
|
||||
|
||||
return MakeTuple(std::move(sourceSurface), rasterSize);
|
||||
return std::make_tuple(std::move(sourceSurface), rasterSize);
|
||||
}
|
||||
|
||||
already_AddRefed<SourceSurface> VectorImage::CreateSurface(
|
||||
|
@ -81,7 +81,7 @@ class VectorImage final : public ImageResource, public nsIStreamListener {
|
||||
* cached surface, if found, and the size to rasterize at, if applicable.
|
||||
* If we cannot rasterize, it will be the requested size to draw at (aSize).
|
||||
*/
|
||||
Tuple<RefPtr<gfx::SourceSurface>, gfx::IntSize> LookupCachedSurface(
|
||||
std::tuple<RefPtr<gfx::SourceSurface>, gfx::IntSize> LookupCachedSurface(
|
||||
const gfx::IntSize& aSize, const SVGImageContext& aSVGContext,
|
||||
uint32_t aFlags);
|
||||
|
||||
|
@ -427,10 +427,9 @@ nsresult nsIconChannel::Init(nsIURI* aURI) {
|
||||
|
||||
icon->Then(
|
||||
mozilla::GetCurrentSerialEventTarget(), __func__,
|
||||
[outputStream](
|
||||
mozilla::Tuple<nsresult, mozilla::Maybe<ByteBuf>>&& aArg) {
|
||||
nsresult rv = mozilla::Get<0>(aArg);
|
||||
mozilla::Maybe<ByteBuf> bytes = std::move(mozilla::Get<1>(aArg));
|
||||
[outputStream](std::tuple<nsresult, mozilla::Maybe<ByteBuf>>&& aArg) {
|
||||
nsresult rv = std::get<0>(aArg);
|
||||
mozilla::Maybe<ByteBuf> bytes = std::move(std::get<1>(aArg));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
MOZ_RELEASE_ASSERT(bytes);
|
||||
|
@ -810,10 +810,9 @@ nsresult nsIconChannel::StartAsyncOpen() {
|
||||
|
||||
iconPromise->Then(
|
||||
mozilla::GetCurrentSerialEventTarget(), __func__,
|
||||
[outputStream](
|
||||
mozilla::Tuple<nsresult, mozilla::Maybe<ByteBuf>>&& aArg) {
|
||||
nsresult rv = mozilla::Get<0>(aArg);
|
||||
mozilla::Maybe<ByteBuf> iconBuffer = std::move(mozilla::Get<1>(aArg));
|
||||
[outputStream](std::tuple<nsresult, mozilla::Maybe<ByteBuf>>&& aArg) {
|
||||
nsresult rv = std::get<0>(aArg);
|
||||
mozilla::Maybe<ByteBuf> iconBuffer = std::move(std::get<1>(aArg));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
MOZ_RELEASE_ASSERT(iconBuffer);
|
||||
|
@ -295,7 +295,7 @@ uint8_t nsGIFDecoder2::ColormapIndexToPixel<uint8_t>(uint8_t aIndex) {
|
||||
}
|
||||
|
||||
template <typename PixelSize>
|
||||
Tuple<int32_t, Maybe<WriteState>> nsGIFDecoder2::YieldPixels(
|
||||
std::tuple<int32_t, Maybe<WriteState>> nsGIFDecoder2::YieldPixels(
|
||||
const uint8_t* aData, size_t aLength, size_t* aBytesReadOut,
|
||||
PixelSize* aPixelBlock, int32_t aBlockSize) {
|
||||
MOZ_ASSERT(aData);
|
||||
@ -320,7 +320,7 @@ Tuple<int32_t, Maybe<WriteState>> nsGIFDecoder2::YieldPixels(
|
||||
}
|
||||
|
||||
if (mGIFStruct.bits < mGIFStruct.codesize) {
|
||||
return MakeTuple(written, Some(WriteState::NEED_MORE_DATA));
|
||||
return std::make_tuple(written, Some(WriteState::NEED_MORE_DATA));
|
||||
}
|
||||
|
||||
// Get the leading variable-length symbol from the data stream.
|
||||
@ -336,20 +336,20 @@ Tuple<int32_t, Maybe<WriteState>> nsGIFDecoder2::YieldPixels(
|
||||
mGIFStruct.codemask = (1 << mGIFStruct.codesize) - 1;
|
||||
mGIFStruct.avail = clearCode + 2;
|
||||
mGIFStruct.oldcode = -1;
|
||||
return MakeTuple(written, Some(WriteState::NEED_MORE_DATA));
|
||||
return std::make_tuple(written, Some(WriteState::NEED_MORE_DATA));
|
||||
}
|
||||
|
||||
// Check for explicit end-of-stream code. It should only appear after all
|
||||
// image data, but if that was the case we wouldn't be in this function,
|
||||
// so this is always an error condition.
|
||||
if (code == (clearCode + 1)) {
|
||||
return MakeTuple(written, Some(WriteState::FAILURE));
|
||||
return std::make_tuple(written, Some(WriteState::FAILURE));
|
||||
}
|
||||
|
||||
if (mGIFStruct.oldcode == -1) {
|
||||
if (code >= MAX_BITS) {
|
||||
// The code's too big; something's wrong.
|
||||
return MakeTuple(written, Some(WriteState::FAILURE));
|
||||
return std::make_tuple(written, Some(WriteState::FAILURE));
|
||||
}
|
||||
|
||||
mGIFStruct.firstchar = mGIFStruct.oldcode = code;
|
||||
@ -368,13 +368,13 @@ Tuple<int32_t, Maybe<WriteState>> nsGIFDecoder2::YieldPixels(
|
||||
|
||||
if (mGIFStruct.stackp >= mGIFStruct.stack + MAX_BITS) {
|
||||
// Stack overflow; something's wrong.
|
||||
return MakeTuple(written, Some(WriteState::FAILURE));
|
||||
return std::make_tuple(written, Some(WriteState::FAILURE));
|
||||
}
|
||||
}
|
||||
|
||||
while (code >= clearCode) {
|
||||
if ((code >= MAX_BITS) || (code == mGIFStruct.prefix[code])) {
|
||||
return MakeTuple(written, Some(WriteState::FAILURE));
|
||||
return std::make_tuple(written, Some(WriteState::FAILURE));
|
||||
}
|
||||
|
||||
*mGIFStruct.stackp++ = mGIFStruct.suffix[code];
|
||||
@ -382,7 +382,7 @@ Tuple<int32_t, Maybe<WriteState>> nsGIFDecoder2::YieldPixels(
|
||||
|
||||
if (mGIFStruct.stackp >= mGIFStruct.stack + MAX_BITS) {
|
||||
// Stack overflow; something's wrong.
|
||||
return MakeTuple(written, Some(WriteState::FAILURE));
|
||||
return std::make_tuple(written, Some(WriteState::FAILURE));
|
||||
}
|
||||
}
|
||||
|
||||
@ -409,7 +409,7 @@ Tuple<int32_t, Maybe<WriteState>> nsGIFDecoder2::YieldPixels(
|
||||
|
||||
if (MOZ_UNLIKELY(mGIFStruct.stackp <= mGIFStruct.stack)) {
|
||||
MOZ_ASSERT_UNREACHABLE("No decoded data but we didn't return early?");
|
||||
return MakeTuple(written, Some(WriteState::FAILURE));
|
||||
return std::make_tuple(written, Some(WriteState::FAILURE));
|
||||
}
|
||||
|
||||
// Yield a pixel at the appropriate index in the colormap.
|
||||
@ -418,7 +418,7 @@ Tuple<int32_t, Maybe<WriteState>> nsGIFDecoder2::YieldPixels(
|
||||
ColormapIndexToPixel<PixelSize>(*--mGIFStruct.stackp);
|
||||
}
|
||||
|
||||
return MakeTuple(written, Maybe<WriteState>());
|
||||
return std::make_tuple(written, Maybe<WriteState>());
|
||||
}
|
||||
|
||||
/// Expand the colormap from RGB to Packed ARGB as needed by Cairo.
|
||||
|
@ -68,11 +68,11 @@ class nsGIFDecoder2 : public Decoder {
|
||||
|
||||
/// A generator function that performs LZW decompression and yields pixels.
|
||||
template <typename PixelSize>
|
||||
Tuple<int32_t, Maybe<WriteState>> YieldPixels(const uint8_t* aData,
|
||||
size_t aLength,
|
||||
size_t* aBytesReadOut,
|
||||
PixelSize* aPixelBlock,
|
||||
int32_t aBlockSize);
|
||||
std::tuple<int32_t, Maybe<WriteState>> YieldPixels(const uint8_t* aData,
|
||||
size_t aLength,
|
||||
size_t* aBytesReadOut,
|
||||
PixelSize* aPixelBlock,
|
||||
int32_t aBlockSize);
|
||||
|
||||
/// Checks if we have transparency, either because the header indicates that
|
||||
/// there's alpha, or because the frame rect doesn't cover the entire image.
|
||||
|
@ -668,7 +668,8 @@ WriteState nsJPEGDecoder::OutputScanlines() {
|
||||
[&](uint32_t* aPixelBlock, int32_t aBlockSize) {
|
||||
JSAMPROW sampleRow = (JSAMPROW)(mCMSLine ? mCMSLine : aPixelBlock);
|
||||
if (jpeg_read_scanlines(&mInfo, &sampleRow, 1) != 1) {
|
||||
return MakeTuple(/* aWritten */ 0, Some(WriteState::NEED_MORE_DATA));
|
||||
return std::make_tuple(/* aWritten */ 0,
|
||||
Some(WriteState::NEED_MORE_DATA));
|
||||
}
|
||||
|
||||
switch (mInfo.out_color_space) {
|
||||
@ -692,7 +693,7 @@ WriteState nsJPEGDecoder::OutputScanlines() {
|
||||
break;
|
||||
}
|
||||
|
||||
return MakeTuple(aBlockSize, Maybe<WriteState>());
|
||||
return std::make_tuple(aBlockSize, Maybe<WriteState>());
|
||||
});
|
||||
|
||||
Maybe<SurfaceInvalidRect> invalidRect = mPipe.TakeInvalidRect();
|
||||
|
@ -158,7 +158,7 @@ TEST_F(ImageSurfacePipeIntegration, SurfacePipe) {
|
||||
++count;
|
||||
EXPECT_EQ(int32_t(100), aLength);
|
||||
memcpy(aBlockStart, buffer, 100 * sizeof(uint32_t));
|
||||
return MakeTuple(int32_t(100), Maybe<WriteState>());
|
||||
return std::make_tuple(int32_t(100), Maybe<WriteState>());
|
||||
});
|
||||
|
||||
EXPECT_EQ(WriteState::FINISHED, result);
|
||||
|
@ -594,7 +594,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocks)
|
||||
++count;
|
||||
EXPECT_EQ(int32_t(100), aLength);
|
||||
memcpy(aBlockStart, buffer, 100 * sizeof(uint32_t));
|
||||
return MakeTuple(int32_t(100), Maybe<WriteState>());
|
||||
return std::make_tuple(int32_t(100), Maybe<WriteState>());
|
||||
});
|
||||
|
||||
EXPECT_EQ(WriteState::FINISHED, result);
|
||||
@ -614,7 +614,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocks)
|
||||
for (int32_t i = 0; i < aLength; ++i) {
|
||||
aBlockStart[i] = BGRAColor::Red().AsPixel();
|
||||
}
|
||||
return MakeTuple(aLength, Maybe<WriteState>());
|
||||
return std::make_tuple(aLength, Maybe<WriteState>());
|
||||
});
|
||||
|
||||
EXPECT_EQ(WriteState::FINISHED, result);
|
||||
@ -646,7 +646,8 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocksPartialRow)
|
||||
// When we write the final block of pixels, it will request we
|
||||
// start another row. We should abort at that point.
|
||||
if (aLength == int32_t(100) && written == int32_t(100)) {
|
||||
return MakeTuple(int32_t(0), Some(WriteState::NEED_MORE_DATA));
|
||||
return std::make_tuple(int32_t(0),
|
||||
Some(WriteState::NEED_MORE_DATA));
|
||||
}
|
||||
|
||||
// It should always request enough data to fill the row. So it
|
||||
@ -659,11 +660,12 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocksPartialRow)
|
||||
|
||||
// We've written the last pixels remaining for the row.
|
||||
if (written == int32_t(100)) {
|
||||
return MakeTuple(int32_t(25), Maybe<WriteState>());
|
||||
return std::make_tuple(int32_t(25), Maybe<WriteState>());
|
||||
}
|
||||
|
||||
// We've written another quarter of the row but not yet all of it.
|
||||
return MakeTuple(int32_t(25), Some(WriteState::NEED_MORE_DATA));
|
||||
return std::make_tuple(int32_t(25),
|
||||
Some(WriteState::NEED_MORE_DATA));
|
||||
});
|
||||
|
||||
EXPECT_EQ(WriteState::NEED_MORE_DATA, result);
|
||||
@ -686,7 +688,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocksPartialRow)
|
||||
++count;
|
||||
EXPECT_EQ(int32_t(100), aLength);
|
||||
memcpy(aBlockStart, buffer, 100 * sizeof(uint32_t));
|
||||
return MakeTuple(int32_t(100), Maybe<WriteState>());
|
||||
return std::make_tuple(int32_t(100), Maybe<WriteState>());
|
||||
});
|
||||
|
||||
EXPECT_EQ(WriteState::FINISHED, result);
|
||||
@ -708,7 +710,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocksPartialRow)
|
||||
for (int32_t i = 0; i < aLength; ++i) {
|
||||
aBlockStart[i] = BGRAColor::Red().AsPixel();
|
||||
}
|
||||
return MakeTuple(aLength, Maybe<WriteState>());
|
||||
return std::make_tuple(aLength, Maybe<WriteState>());
|
||||
});
|
||||
|
||||
EXPECT_EQ(WriteState::FINISHED, result);
|
||||
|
@ -36,7 +36,6 @@
|
||||
|
||||
#if defined(MOZ_ENABLE_FORKSERVER)
|
||||
# include "nsStringFwd.h"
|
||||
# include "mozilla/Tuple.h"
|
||||
# include "mozilla/ipc/FileDescriptorShuffle.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -314,8 +313,8 @@ class EnvironmentLog {
|
||||
};
|
||||
|
||||
#if defined(MOZ_ENABLE_FORKSERVER)
|
||||
typedef Tuple<nsCString, nsCString> EnvVar;
|
||||
typedef Tuple<mozilla::ipc::FileDescriptor, int> FdMapping;
|
||||
typedef std::tuple<nsCString, nsCString> EnvVar;
|
||||
typedef std::tuple<mozilla::ipc::FileDescriptor, int> FdMapping;
|
||||
#endif
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "base/revocable_store.h"
|
||||
#include "base/tuple.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
@ -26,15 +26,15 @@ namespace details {
|
||||
// be IndexSequence<0, 1, ..., N-1>.
|
||||
template <size_t... Indices, class ObjT, class Method, typename... Args>
|
||||
void CallMethod(std::index_sequence<Indices...>, ObjT* obj, Method method,
|
||||
mozilla::Tuple<Args...>& arg) {
|
||||
(obj->*method)(std::move(mozilla::Get<Indices>(arg))...);
|
||||
std::tuple<Args...>& arg) {
|
||||
(obj->*method)(std::move(std::get<Indices>(arg))...);
|
||||
}
|
||||
|
||||
// Same as above, but call a function.
|
||||
template <size_t... Indices, typename Function, typename... Args>
|
||||
void CallFunction(std::index_sequence<Indices...>, Function function,
|
||||
mozilla::Tuple<Args...>& arg) {
|
||||
(*function)(std::move(mozilla::Get<Indices>(arg))...);
|
||||
std::tuple<Args...>& arg) {
|
||||
(*function)(std::move(std::get<Indices>(arg))...);
|
||||
}
|
||||
|
||||
} // namespace details
|
||||
@ -42,14 +42,13 @@ void CallFunction(std::index_sequence<Indices...>, Function function,
|
||||
// Call a method on the given object. Arguments are passed by move semantics
|
||||
// from the given tuple.
|
||||
template <class ObjT, class Method, typename... Args>
|
||||
void DispatchTupleToMethod(ObjT* obj, Method method,
|
||||
mozilla::Tuple<Args...>& arg) {
|
||||
void DispatchTupleToMethod(ObjT* obj, Method method, std::tuple<Args...>& arg) {
|
||||
details::CallMethod(std::index_sequence_for<Args...>{}, obj, method, arg);
|
||||
}
|
||||
|
||||
// Same as above, but call a function.
|
||||
template <typename Function, typename... Args>
|
||||
void DispatchTupleToFunction(Function function, mozilla::Tuple<Args...>& arg) {
|
||||
void DispatchTupleToFunction(Function function, std::tuple<Args...>& arg) {
|
||||
details::CallFunction(std::index_sequence_for<Args...>{}, function, arg);
|
||||
}
|
||||
|
||||
@ -138,13 +137,13 @@ class ScopedRunnableMethodFactory : public RevocableStore {
|
||||
template <class Method, typename... Elements>
|
||||
inline already_AddRefed<mozilla::Runnable> NewRunnableMethod(
|
||||
Method method, Elements&&... elements) {
|
||||
typedef mozilla::Tuple<std::decay_t<Elements>...> ArgsTuple;
|
||||
typedef std::tuple<std::decay_t<Elements>...> ArgsTuple;
|
||||
typedef RunnableMethod<Method, ArgsTuple> Runnable;
|
||||
typedef typename ScopedTaskFactory<Runnable>::TaskWrapper TaskWrapper;
|
||||
|
||||
RefPtr<TaskWrapper> task = new TaskWrapper(this);
|
||||
task->Init(object_, method,
|
||||
mozilla::MakeTuple(std::forward<Elements>(elements)...));
|
||||
std::make_tuple(std::forward<Elements>(elements)...));
|
||||
return task.forget();
|
||||
}
|
||||
|
||||
@ -300,9 +299,9 @@ template <class T, class Method, typename... Args>
|
||||
inline already_AddRefed<mozilla::Runnable> NewRunnableMethod(T* object,
|
||||
Method method,
|
||||
Args&&... args) {
|
||||
typedef mozilla::Tuple<std::decay_t<Args>...> ArgsTuple;
|
||||
typedef std::tuple<std::decay_t<Args>...> ArgsTuple;
|
||||
RefPtr<mozilla::Runnable> t = new RunnableMethod<T, Method, ArgsTuple>(
|
||||
object, method, mozilla::MakeTuple(std::forward<Args>(args)...));
|
||||
object, method, std::make_tuple(std::forward<Args>(args)...));
|
||||
return t.forget();
|
||||
}
|
||||
|
||||
@ -338,19 +337,19 @@ template <class Function, typename... Args>
|
||||
inline already_AddRefed<mozilla::CancelableRunnable>
|
||||
NewCancelableRunnableFunction(const char* name, Function function,
|
||||
Args&&... args) {
|
||||
typedef mozilla::Tuple<std::decay_t<Args>...> ArgsTuple;
|
||||
typedef std::tuple<std::decay_t<Args>...> ArgsTuple;
|
||||
RefPtr<mozilla::CancelableRunnable> t =
|
||||
new RunnableFunction<Function, ArgsTuple>(
|
||||
name, function, mozilla::MakeTuple(std::forward<Args>(args)...));
|
||||
name, function, std::make_tuple(std::forward<Args>(args)...));
|
||||
return t.forget();
|
||||
}
|
||||
|
||||
template <class Function, typename... Args>
|
||||
inline already_AddRefed<mozilla::Runnable> NewRunnableFunction(
|
||||
const char* name, Function function, Args&&... args) {
|
||||
typedef mozilla::Tuple<std::decay_t<Args>...> ArgsTuple;
|
||||
typedef std::tuple<std::decay_t<Args>...> ArgsTuple;
|
||||
RefPtr<mozilla::Runnable> t = new RunnableFunction<Function, ArgsTuple>(
|
||||
name, function, mozilla::MakeTuple(std::forward<Args>(args)...));
|
||||
name, function, std::make_tuple(std::forward<Args>(args)...));
|
||||
return t.forget();
|
||||
}
|
||||
|
||||
|
@ -1347,8 +1347,8 @@ mozilla::ipc::IPCResult
|
||||
BackgroundParentImpl::RecvEnsureRDDProcessAndCreateBridge(
|
||||
EnsureRDDProcessAndCreateBridgeResolver&& aResolver) {
|
||||
RDDProcessManager* rdd = RDDProcessManager::Get();
|
||||
using Type =
|
||||
Tuple<const nsresult&, Endpoint<mozilla::PRemoteDecoderManagerChild>&&>;
|
||||
using Type = std::tuple<const nsresult&,
|
||||
Endpoint<mozilla::PRemoteDecoderManagerChild>&&>;
|
||||
if (!rdd) {
|
||||
aResolver(
|
||||
Type(NS_ERROR_NOT_AVAILABLE, Endpoint<PRemoteDecoderManagerChild>()));
|
||||
@ -1383,8 +1383,9 @@ BackgroundParentImpl::RecvEnsureUtilityProcessAndCreateBridge(
|
||||
[aResolver, managerThread, otherPid, aLocation]() {
|
||||
RefPtr<UtilityProcessManager> upm =
|
||||
UtilityProcessManager::GetSingleton();
|
||||
using Type = Tuple<const nsresult&,
|
||||
Endpoint<mozilla::PRemoteDecoderManagerChild>&&>;
|
||||
using Type =
|
||||
std::tuple<const nsresult&,
|
||||
Endpoint<mozilla::PRemoteDecoderManagerChild>&&>;
|
||||
if (!upm) {
|
||||
aResolver(Type(NS_ERROR_NOT_AVAILABLE,
|
||||
Endpoint<PRemoteDecoderManagerChild>()));
|
||||
|
@ -656,9 +656,7 @@ nsresult LoadInfoArgsToLoadInfo(
|
||||
: loadInfoArgs.browsingContextID();
|
||||
if (RefPtr<BrowsingContext> bc =
|
||||
BrowsingContext::Get(targetBrowsingContextId)) {
|
||||
nsCOMPtr<nsIPrincipal> originalTriggeringPrincipal;
|
||||
nsCOMPtr<nsIPrincipal> originalPrincipalToInherit;
|
||||
Tie(originalTriggeringPrincipal, originalPrincipalToInherit) =
|
||||
auto [originalTriggeringPrincipal, originalPrincipalToInherit] =
|
||||
bc->GetTriggeringAndInheritPrincipalsForCurrentLoad();
|
||||
|
||||
if (originalTriggeringPrincipal &&
|
||||
|
@ -94,8 +94,8 @@ inline void PrepareArguments(std::vector<std::string>& aArgv,
|
||||
inline void PrepareEnv(base::LaunchOptions* aOptions,
|
||||
nsTArray<EnvVar>& aEnvMap) {
|
||||
for (auto& elt : aEnvMap) {
|
||||
nsCString& var = Get<0>(elt);
|
||||
nsCString& val = Get<1>(elt);
|
||||
nsCString& var = std::get<0>(elt);
|
||||
nsCString& val = std::get<1>(elt);
|
||||
aOptions->env_map[var.get()] = val.get();
|
||||
CleanCString(var);
|
||||
CleanCString(val);
|
||||
@ -108,8 +108,8 @@ inline void PrepareFdsRemap(base::LaunchOptions* aOptions,
|
||||
MOZ_LOG(gForkServiceLog, LogLevel::Verbose, ("fds mapping:"));
|
||||
for (auto& elt : aFdsRemap) {
|
||||
// FDs are duplicated here.
|
||||
int fd = Get<0>(elt).ClonePlatformHandle().release();
|
||||
std::pair<int, int> fdmap(fd, Get<1>(elt));
|
||||
int fd = std::get<0>(elt).ClonePlatformHandle().release();
|
||||
std::pair<int, int> fdmap(fd, std::get<1>(elt));
|
||||
aOptions->fds_to_remap.push_back(fdmap);
|
||||
MOZ_LOG(gForkServiceLog, LogLevel::Verbose,
|
||||
("\t%d => %d", fdmap.first, fdmap.second));
|
||||
|
@ -29,7 +29,7 @@
|
||||
#ifdef XP_WIN
|
||||
# include "mozilla/TimeStamp_windows.h"
|
||||
#endif
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/Vector.h"
|
||||
@ -710,8 +710,8 @@ struct ParamTraits<mozilla::UniquePtr<T>> {
|
||||
};
|
||||
|
||||
template <typename... Ts>
|
||||
struct ParamTraits<mozilla::Tuple<Ts...>> {
|
||||
typedef mozilla::Tuple<Ts...> paramType;
|
||||
struct ParamTraits<std::tuple<Ts...>> {
|
||||
typedef std::tuple<Ts...> paramType;
|
||||
|
||||
template <typename U>
|
||||
static void Write(IPC::MessageWriter* aWriter, U&& aParam) {
|
||||
@ -719,31 +719,30 @@ struct ParamTraits<mozilla::Tuple<Ts...>> {
|
||||
std::index_sequence_for<Ts...>{});
|
||||
}
|
||||
|
||||
static bool Read(IPC::MessageReader* aReader,
|
||||
mozilla::Tuple<Ts...>* aResult) {
|
||||
static bool Read(IPC::MessageReader* aReader, std::tuple<Ts...>* aResult) {
|
||||
return ReadInternal(aReader, *aResult, std::index_sequence_for<Ts...>{});
|
||||
}
|
||||
|
||||
private:
|
||||
template <size_t... Is>
|
||||
static void WriteInternal(IPC::MessageWriter* aWriter,
|
||||
const mozilla::Tuple<Ts...>& aParam,
|
||||
const std::tuple<Ts...>& aParam,
|
||||
std::index_sequence<Is...>) {
|
||||
WriteParams(aWriter, mozilla::Get<Is>(aParam)...);
|
||||
WriteParams(aWriter, std::get<Is>(aParam)...);
|
||||
}
|
||||
|
||||
template <size_t... Is>
|
||||
static void WriteInternal(IPC::MessageWriter* aWriter,
|
||||
mozilla::Tuple<Ts...>&& aParam,
|
||||
std::tuple<Ts...>&& aParam,
|
||||
std::index_sequence<Is...>) {
|
||||
WriteParams(aWriter, std::move(mozilla::Get<Is>(aParam))...);
|
||||
WriteParams(aWriter, std::move(std::get<Is>(aParam))...);
|
||||
}
|
||||
|
||||
template <size_t... Is>
|
||||
static bool ReadInternal(IPC::MessageReader* aReader,
|
||||
mozilla::Tuple<Ts...>& aResult,
|
||||
std::tuple<Ts...>& aResult,
|
||||
std::index_sequence<Is...>) {
|
||||
return ReadParams(aReader, mozilla::Get<Is>(aResult)...);
|
||||
return ReadParams(aReader, std::get<Is>(aResult)...);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "ipc/IPCMessageUtilsSpecializations.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Variant.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include <type_traits>
|
||||
|
@ -30,11 +30,11 @@ void IdleSchedulerChild::Init(IdlePeriodState* aIdlePeriodState) {
|
||||
|
||||
RefPtr<IdleSchedulerChild> scheduler = this;
|
||||
auto resolve =
|
||||
[&](Tuple<mozilla::Maybe<SharedMemoryHandle>, uint32_t>&& aResult) {
|
||||
if (Get<0>(aResult)) {
|
||||
mActiveCounter.SetHandle(std::move(*Get<0>(aResult)), false);
|
||||
[&](std::tuple<mozilla::Maybe<SharedMemoryHandle>, uint32_t>&& aResult) {
|
||||
if (std::get<0>(aResult)) {
|
||||
mActiveCounter.SetHandle(std::move(*std::get<0>(aResult)), false);
|
||||
mActiveCounter.Map(sizeof(int32_t));
|
||||
mChildId = Get<1>(aResult);
|
||||
mChildId = std::get<1>(aResult);
|
||||
if (mChildId && mIdlePeriodState && mIdlePeriodState->IsActive()) {
|
||||
SetActive();
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ IPCResult IdleSchedulerParent::RecvInitForIdleUse(
|
||||
// If there wasn't an empty item, we'll fallback to 0.
|
||||
mChildId = unusedId;
|
||||
|
||||
aResolve(Tuple<mozilla::Maybe<SharedMemoryHandle>&&, const uint32_t&>(
|
||||
aResolve(std::tuple<mozilla::Maybe<SharedMemoryHandle>&&, const uint32_t&>(
|
||||
std::move(activeCounter), mChildId));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ def _alreadyaddrefed(T):
|
||||
|
||||
|
||||
def _tuple(types, const=False, ref=False):
|
||||
return Type("Tuple", T=types, const=const, ref=ref)
|
||||
return Type("std::tuple", T=types, const=const, ref=ref)
|
||||
|
||||
|
||||
def _promise(resolvetype, rejecttype, tail, resolver=False):
|
||||
@ -4825,7 +4825,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
if len(md.returns) > 1:
|
||||
resolvetype = _tuple([d.bareType(self.side) for d in md.returns])
|
||||
resolvearg = ExprCall(
|
||||
ExprVar("MakeTuple"), args=[ExprMove(p.var()) for p in md.returns]
|
||||
ExprVar("std::make_tuple"), args=[ExprMove(p.var()) for p in md.returns]
|
||||
)
|
||||
else:
|
||||
resolvetype = md.returns[0].bareType(self.side)
|
||||
@ -5048,7 +5048,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
def paramValue(idx):
|
||||
assert idx < len(md.returns)
|
||||
if len(md.returns) > 1:
|
||||
return ExprCode("mozilla::Get<${idx}>(aParam)", idx=idx)
|
||||
return ExprCode("std::get<${idx}>(aParam)", idx=idx)
|
||||
return ExprVar("aParam")
|
||||
|
||||
serializeParams = [
|
||||
|
@ -60,7 +60,7 @@ void TestAsyncReturnsParent::Main() {
|
||||
|
||||
mozilla::ipc::IPCResult TestAsyncReturnsParent::RecvPong(
|
||||
PongResolver&& aResolve) {
|
||||
aResolve(Tuple<const uint32_t&, const uint32_t&>(sMagic1, sMagic2));
|
||||
aResolve(std::tuple<const uint32_t&, const uint32_t&>(sMagic1, sMagic2));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
@ -85,8 +85,8 @@ mozilla::ipc::IPCResult TestAsyncReturnsChild::RecvPing(
|
||||
PingResolver&& aResolve) {
|
||||
SendPong()->Then(
|
||||
MessageLoop::current()->SerialEventTarget(), __func__,
|
||||
[aResolve](const Tuple<uint32_t, uint32_t>& aParam) {
|
||||
if (Get<0>(aParam) == sMagic1 && Get<1>(aParam) == sMagic2) {
|
||||
[aResolve](const std::tuple<uint32_t, uint32_t>& aParam) {
|
||||
if (std::get<0>(aParam) == sMagic1 && std::get<1>(aParam) == sMagic2) {
|
||||
passed("take two arguments");
|
||||
} else {
|
||||
fail("get two argument but has wrong value");
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "mozilla/Maybe.h" // mozilla::Maybe
|
||||
#include "mozilla/Range.h" // mozilla::Range
|
||||
#include "mozilla/Span.h" // mozilla::Span
|
||||
#include "mozilla/Tuple.h" // mozilla::Tuple
|
||||
// std::tuple
|
||||
|
||||
#include <algorithm> // std::copy_n
|
||||
#include <stddef.h> // size_t
|
||||
@ -317,7 +317,7 @@ JS_PUBLIC_API size_t JS_GetStringEncodingLength(JSContext* cx, JSString* str);
|
||||
*
|
||||
* The function does not store an additional zero byte.
|
||||
*/
|
||||
JS_PUBLIC_API mozilla::Maybe<mozilla::Tuple<size_t, size_t>>
|
||||
JS_PUBLIC_API mozilla::Maybe<std::tuple<size_t, size_t>>
|
||||
JS_EncodeStringToUTF8BufferPartial(JSContext* cx, JSString* str,
|
||||
mozilla::Span<char> buffer);
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "mozilla/TextUtils.h"
|
||||
#include "mozilla/ThreadLocal.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cfloat>
|
||||
@ -151,8 +150,6 @@ using mozilla::AssertedCast;
|
||||
using mozilla::AsWritableChars;
|
||||
using mozilla::Maybe;
|
||||
using mozilla::Span;
|
||||
using mozilla::Tie;
|
||||
using mozilla::Tuple;
|
||||
|
||||
using JS::AutoStableStringChars;
|
||||
using JS::CompileOptions;
|
||||
@ -7754,15 +7751,15 @@ static bool EncodeAsUtf8InBuffer(JSContext* cx, unsigned argc, Value* vp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Maybe<Tuple<size_t, size_t>> amounts = JS_EncodeStringToUTF8BufferPartial(
|
||||
cx, args[0].toString(), AsWritableChars(Span(data, length)));
|
||||
Maybe<std::tuple<size_t, size_t>> amounts =
|
||||
JS_EncodeStringToUTF8BufferPartial(cx, args[0].toString(),
|
||||
AsWritableChars(Span(data, length)));
|
||||
if (!amounts) {
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t unitsRead, bytesWritten;
|
||||
Tie(unitsRead, bytesWritten) = *amounts;
|
||||
auto [unitsRead, bytesWritten] = *amounts;
|
||||
|
||||
array->initDenseElement(0, Int32Value(AssertedCast<int32_t>(unitsRead)));
|
||||
array->initDenseElement(1, Int32Value(AssertedCast<int32_t>(bytesWritten)));
|
||||
|
@ -268,7 +268,7 @@ var ignoreFunctions = {
|
||||
|
||||
// Stores a function pointer in an AutoProfilerLabelData struct and calls it.
|
||||
// And it's in mozglue, which doesn't have access to the attributes yet.
|
||||
"void mozilla::ProfilerLabelEnd(mozilla::Tuple<void*, unsigned int>*)" : true,
|
||||
"void mozilla::ProfilerLabelEnd(std::tuple<void*, unsigned int>*)" : true,
|
||||
|
||||
// This gets into PLDHashTable function pointer territory, and should get
|
||||
// set up early enough to not do anything when it matters anyway.
|
||||
|
@ -330,7 +330,7 @@ static bool addScriptToFinalWarmUpCountMap(JSContext* cx, HandleScript script) {
|
||||
}
|
||||
|
||||
if (!zone->scriptFinalWarmUpCountMap->put(
|
||||
script, mozilla::MakeTuple(uint32_t(0), std::move(sfilename)))) {
|
||||
script, std::make_tuple(uint32_t(0), std::move(sfilename)))) {
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "mozilla/Latin1.h"
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
@ -396,14 +395,14 @@ void CodeGenerator::callVM(LInstruction* ins) {
|
||||
|
||||
template <typename... ArgTypes>
|
||||
class ArgSeq {
|
||||
mozilla::Tuple<std::remove_reference_t<ArgTypes>...> args_;
|
||||
std::tuple<std::remove_reference_t<ArgTypes>...> args_;
|
||||
|
||||
template <std::size_t... ISeq>
|
||||
inline void generate(CodeGenerator* codegen,
|
||||
std::index_sequence<ISeq...>) const {
|
||||
// Arguments are pushed in reverse order, from last argument to first
|
||||
// argument.
|
||||
(codegen->pushArg(mozilla::Get<sizeof...(ISeq) - 1 - ISeq>(args_)), ...);
|
||||
(codegen->pushArg(std::get<sizeof...(ISeq) - 1 - ISeq>(args_)), ...);
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -3356,7 +3356,7 @@ JS_PUBLIC_API bool JS_EncodeStringToBuffer(JSContext* cx, JSString* str,
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API mozilla::Maybe<mozilla::Tuple<size_t, size_t>>
|
||||
JS_PUBLIC_API mozilla::Maybe<std::tuple<size_t, size_t>>
|
||||
JS_EncodeStringToUTF8BufferPartial(JSContext* cx, JSString* str,
|
||||
mozilla::Span<char> buffer) {
|
||||
AssertHeapIsIdle();
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <type_traits>
|
||||
@ -185,7 +184,7 @@ class ThreadTrampoline {
|
||||
// thread. To avoid this dangerous and highly non-obvious footgun, the
|
||||
// standard requires a "decay" copy of the arguments at the cost of making it
|
||||
// impossible to pass references between threads.
|
||||
mozilla::Tuple<std::decay_t<Args>...> args;
|
||||
std::tuple<std::decay_t<Args>...> args;
|
||||
|
||||
// Protect the thread id during creation.
|
||||
Mutex createMutex MOZ_UNANNOTATED;
|
||||
@ -217,7 +216,7 @@ class ThreadTrampoline {
|
||||
// thread that spawned us is ready.
|
||||
createMutex.lock();
|
||||
createMutex.unlock();
|
||||
f(std::move(mozilla::Get<Indices>(args))...);
|
||||
f(std::move(std::get<Indices>(args))...);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -31,8 +31,6 @@ using mozilla::IsAscii;
|
||||
using mozilla::IsUtf8Latin1;
|
||||
using mozilla::LossyConvertUtf16toLatin1;
|
||||
using mozilla::Span;
|
||||
using mozilla::Tie;
|
||||
using mozilla::Tuple;
|
||||
using mozilla::Utf8Unit;
|
||||
|
||||
using JS::Latin1CharsZ;
|
||||
@ -105,16 +103,12 @@ JS_PUBLIC_API size_t JS::DeflateStringToUTF8Buffer(JSLinearString* src,
|
||||
JS::AutoCheckCannotGC nogc;
|
||||
if (src->hasLatin1Chars()) {
|
||||
auto source = AsChars(Span(src->latin1Chars(nogc), src->length()));
|
||||
size_t read;
|
||||
size_t written;
|
||||
Tie(read, written) = ConvertLatin1toUtf8Partial(source, dst);
|
||||
auto [read, written] = ConvertLatin1toUtf8Partial(source, dst);
|
||||
(void)read;
|
||||
return written;
|
||||
}
|
||||
auto source = Span(src->twoByteChars(nogc), src->length());
|
||||
size_t read;
|
||||
size_t written;
|
||||
Tie(read, written) = ConvertUtf16toUtf8Partial(source, dst);
|
||||
auto [read, written] = ConvertUtf16toUtf8Partial(source, dst);
|
||||
(void)read;
|
||||
return written;
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ bool InitScriptCoverage(JSContext* cx, JSScript* script) {
|
||||
|
||||
// Save source in map for when we collect coverage.
|
||||
if (!zone->scriptLCovMap->putNew(script,
|
||||
mozilla::MakeTuple(source, scriptName))) {
|
||||
std::make_tuple(source, scriptName))) {
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
@ -655,9 +655,7 @@ bool CollectScriptCoverage(JSScript* script, bool finalizing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LCovSource* source;
|
||||
const char* scriptName;
|
||||
mozilla::Tie(source, scriptName) = p->value();
|
||||
auto [source, scriptName] = p->value();
|
||||
|
||||
if (script->hasBytecode()) {
|
||||
source->writeScript(script, scriptName);
|
||||
|
@ -2775,7 +2775,7 @@ void js::maybeUpdateWarmUpCount(JSScript* script) {
|
||||
ScriptFinalWarmUpCountMap::Ptr p = map->lookup(script);
|
||||
MOZ_ASSERT(p);
|
||||
|
||||
mozilla::Get<0>(p->value()) += script->jitScript()->warmUpCount();
|
||||
std::get<0>(p->value()) += script->jitScript()->warmUpCount();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2789,8 +2789,8 @@ void js::maybeSpewScriptFinalWarmUpCount(JSScript* script) {
|
||||
ScriptFinalWarmUpCountMap::Ptr p = map->lookup(script);
|
||||
MOZ_ASSERT(p);
|
||||
auto& tuple = p->value();
|
||||
uint32_t warmUpCount = mozilla::Get<0>(tuple);
|
||||
SharedImmutableString& scriptName = mozilla::Get<1>(tuple);
|
||||
uint32_t warmUpCount = std::get<0>(tuple);
|
||||
SharedImmutableString& scriptName = std::get<1>(tuple);
|
||||
|
||||
JSContext* cx = TlsContext.get();
|
||||
cx->spewer().enableSpewing();
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Span.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Utf8.h"
|
||||
#include "mozilla/Variant.h"
|
||||
@ -173,7 +173,7 @@ using ScriptCountsMap =
|
||||
|
||||
// The 'const char*' for the function name is a pointer within the LCovSource's
|
||||
// LifoAlloc and will be discarded at the same time.
|
||||
using ScriptLCovEntry = mozilla::Tuple<coverage::LCovSource*, const char*>;
|
||||
using ScriptLCovEntry = std::tuple<coverage::LCovSource*, const char*>;
|
||||
using ScriptLCovMap =
|
||||
GCRekeyableHashMap<HeapPtr<BaseScript*>, ScriptLCovEntry,
|
||||
DefaultHasher<HeapPtr<BaseScript*>>, SystemAllocPolicy>;
|
||||
@ -184,8 +184,7 @@ using ScriptVTuneIdMap =
|
||||
DefaultHasher<HeapPtr<BaseScript*>>, SystemAllocPolicy>;
|
||||
#endif
|
||||
#ifdef JS_CACHEIR_SPEW
|
||||
using ScriptFinalWarmUpCountEntry =
|
||||
mozilla::Tuple<uint32_t, SharedImmutableString>;
|
||||
using ScriptFinalWarmUpCountEntry = std::tuple<uint32_t, SharedImmutableString>;
|
||||
using ScriptFinalWarmUpCountMap =
|
||||
GCRekeyableHashMap<HeapPtr<BaseScript*>, ScriptFinalWarmUpCountEntry,
|
||||
DefaultHasher<HeapPtr<BaseScript*>>, SystemAllocPolicy>;
|
||||
|
@ -132,7 +132,7 @@ JS::ubi::Node::Size JS::ubi::Concrete<JSString>::size(
|
||||
|
||||
const char16_t JS::ubi::Concrete<JSString>::concreteTypeName[] = u"JSString";
|
||||
|
||||
mozilla::Maybe<mozilla::Tuple<size_t, size_t> > JSString::encodeUTF8Partial(
|
||||
mozilla::Maybe<std::tuple<size_t, size_t> > JSString::encodeUTF8Partial(
|
||||
const JS::AutoRequireNoGC& nogc, mozilla::Span<char> buffer) const {
|
||||
mozilla::Vector<const JSString*, 16, SystemAllocPolicy> stack;
|
||||
const JSString* current = this;
|
||||
@ -154,7 +154,7 @@ mozilla::Maybe<mozilla::Tuple<size_t, size_t> > JSString::encodeUTF8Partial(
|
||||
if (MOZ_LIKELY(linear.hasLatin1Chars())) {
|
||||
if (MOZ_UNLIKELY(pendingLeadSurrogate)) {
|
||||
if (buffer.Length() < 3) {
|
||||
return mozilla::Some(mozilla::MakeTuple(totalRead, totalWritten));
|
||||
return mozilla::Some(std::make_tuple(totalRead, totalWritten));
|
||||
}
|
||||
buffer[0] = '\xEF';
|
||||
buffer[1] = '\xBF';
|
||||
@ -168,13 +168,13 @@ mozilla::Maybe<mozilla::Tuple<size_t, size_t> > JSString::encodeUTF8Partial(
|
||||
mozilla::Span(linear.latin1Chars(nogc), linear.length()));
|
||||
size_t read;
|
||||
size_t written;
|
||||
mozilla::Tie(read, written) =
|
||||
std::tie(read, written) =
|
||||
mozilla::ConvertLatin1toUtf8Partial(src, buffer);
|
||||
buffer = buffer.From(written);
|
||||
totalRead += read;
|
||||
totalWritten += written;
|
||||
if (read < src.Length()) {
|
||||
return mozilla::Some(mozilla::MakeTuple(totalRead, totalWritten));
|
||||
return mozilla::Some(std::make_tuple(totalRead, totalWritten));
|
||||
}
|
||||
} else {
|
||||
auto src = mozilla::Span(linear.twoByteChars(nogc), linear.length());
|
||||
@ -186,7 +186,7 @@ mozilla::Maybe<mozilla::Tuple<size_t, size_t> > JSString::encodeUTF8Partial(
|
||||
if (unicode::IsTrailSurrogate(first)) {
|
||||
// Got a surrogate pair
|
||||
if (buffer.Length() < 4) {
|
||||
return mozilla::Some(mozilla::MakeTuple(totalRead, totalWritten));
|
||||
return mozilla::Some(std::make_tuple(totalRead, totalWritten));
|
||||
}
|
||||
uint32_t astral = unicode::UTF16Decode(pendingLeadSurrogate, first);
|
||||
buffer[0] = char(0b1111'0000 | (astral >> 18));
|
||||
@ -200,7 +200,7 @@ mozilla::Maybe<mozilla::Tuple<size_t, size_t> > JSString::encodeUTF8Partial(
|
||||
} else {
|
||||
// unpaired surrogate
|
||||
if (buffer.Length() < 3) {
|
||||
return mozilla::Some(mozilla::MakeTuple(totalRead, totalWritten));
|
||||
return mozilla::Some(std::make_tuple(totalRead, totalWritten));
|
||||
}
|
||||
buffer[0] = '\xEF';
|
||||
buffer[1] = '\xBF';
|
||||
@ -221,13 +221,13 @@ mozilla::Maybe<mozilla::Tuple<size_t, size_t> > JSString::encodeUTF8Partial(
|
||||
}
|
||||
size_t read;
|
||||
size_t written;
|
||||
mozilla::Tie(read, written) =
|
||||
std::tie(read, written) =
|
||||
mozilla::ConvertUtf16toUtf8Partial(src, buffer);
|
||||
buffer = buffer.From(written);
|
||||
totalRead += read;
|
||||
totalWritten += written;
|
||||
if (read < src.Length()) {
|
||||
return mozilla::Some(mozilla::MakeTuple(totalRead, totalWritten));
|
||||
return mozilla::Some(std::make_tuple(totalRead, totalWritten));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -238,7 +238,7 @@ mozilla::Maybe<mozilla::Tuple<size_t, size_t> > JSString::encodeUTF8Partial(
|
||||
}
|
||||
if (MOZ_UNLIKELY(pendingLeadSurrogate)) {
|
||||
if (buffer.Length() < 3) {
|
||||
return mozilla::Some(mozilla::MakeTuple(totalRead, totalWritten));
|
||||
return mozilla::Some(std::make_tuple(totalRead, totalWritten));
|
||||
}
|
||||
buffer[0] = '\xEF';
|
||||
buffer[1] = '\xBF';
|
||||
@ -247,7 +247,7 @@ mozilla::Maybe<mozilla::Tuple<size_t, size_t> > JSString::encodeUTF8Partial(
|
||||
totalRead += 1;
|
||||
totalWritten += 3;
|
||||
}
|
||||
return mozilla::Some(mozilla::MakeTuple(totalRead, totalWritten));
|
||||
return mozilla::Some(std::make_tuple(totalRead, totalWritten));
|
||||
}
|
||||
|
||||
#if defined(DEBUG) || defined(JS_JITSPEW) || defined(JS_CACHEIR_SPEW)
|
||||
|
@ -609,7 +609,7 @@ class JSString : public js::gc::CellWithLengthAndFlags {
|
||||
*
|
||||
* Returns mozilla::Nothing on OOM.
|
||||
*/
|
||||
mozilla::Maybe<mozilla::Tuple<size_t, size_t>> encodeUTF8Partial(
|
||||
mozilla::Maybe<std::tuple<size_t, size_t>> encodeUTF8Partial(
|
||||
const JS::AutoRequireNoGC& nogc, mozilla::Span<char> buffer) const;
|
||||
|
||||
private:
|
||||
|
@ -389,7 +389,7 @@ opaque-types = [
|
||||
# for clang.
|
||||
"mozilla::SeenPtrs",
|
||||
"mozilla::SupportsWeakPtr",
|
||||
"mozilla::Tuple",
|
||||
"std::tuple",
|
||||
"SupportsWeakPtr",
|
||||
"mozilla::detail::WeakReference",
|
||||
"mozilla::WeakPtr",
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/PresShellInlines.h"
|
||||
#include "mozilla/ServoStyleSet.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsString.h"
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#define GTEST_HAS_RTTI 0
|
||||
#include "gtest/gtest.h"
|
||||
@ -981,7 +980,7 @@ class JsepSessionTest : public JsepSessionTestBase,
|
||||
session.AddLocalIceCandidate(kAEqualsCandidate + candidate.str(),
|
||||
transportId, "", &level, &mid, &skipped);
|
||||
if (!skipped) {
|
||||
mCandidatesToTrickle.push_back(Tuple<Level, Mid, Candidate>(
|
||||
mCandidatesToTrickle.push_back(std::tuple<Level, Mid, Candidate>(
|
||||
level, mid, kAEqualsCandidate + candidate.str()));
|
||||
candidates.push_back(candidate.str());
|
||||
}
|
||||
@ -1026,10 +1025,7 @@ class JsepSessionTest : public JsepSessionTestBase,
|
||||
void Trickle(JsepSession& session) {
|
||||
std::string transportId;
|
||||
for (const auto& levelMidAndCandidate : mCandidatesToTrickle) {
|
||||
Level level;
|
||||
Mid mid;
|
||||
Candidate candidate;
|
||||
Tie(level, mid, candidate) = levelMidAndCandidate;
|
||||
auto [level, mid, candidate] = levelMidAndCandidate;
|
||||
std::cerr << "trickling candidate: " << candidate << " level: " << level
|
||||
<< " mid: " << mid << std::endl;
|
||||
Maybe<unsigned long> lev = Some(level);
|
||||
@ -1157,7 +1153,7 @@ class JsepSessionTest : public JsepSessionTestBase,
|
||||
std::map<TransportId, std::map<ComponentType, std::vector<Candidate>>>
|
||||
mCandidates;
|
||||
// Level/mid/candidate tuples that need to be trickled
|
||||
std::vector<Tuple<Level, Mid, Candidate>> mCandidatesToTrickle;
|
||||
std::vector<std::tuple<Level, Mid, Candidate>> mCandidatesToTrickle;
|
||||
};
|
||||
|
||||
// For streaming parse errors
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include "mozilla/JsRust.h"
|
||||
#include "mozilla/Span.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#if MOZ_HAS_JSRUST()
|
||||
# include "encoding_rs_mem.h"
|
||||
@ -220,13 +219,13 @@ inline size_t ConvertLatin1toUtf8(mozilla::Span<const char> aSource,
|
||||
* TextEncoder.encodeInto.
|
||||
* https://encoding.spec.whatwg.org/#dom-textencoder-encodeinto
|
||||
*/
|
||||
inline mozilla::Tuple<size_t, size_t> ConvertLatin1toUtf8Partial(
|
||||
inline std::tuple<size_t, size_t> ConvertLatin1toUtf8Partial(
|
||||
mozilla::Span<const char> aSource, mozilla::Span<char> aDest) {
|
||||
size_t srcLen = aSource.Length();
|
||||
size_t dstLen = aDest.Length();
|
||||
encoding_mem_convert_latin1_to_utf8_partial(aSource.Elements(), &srcLen,
|
||||
aDest.Elements(), &dstLen);
|
||||
return mozilla::MakeTuple(srcLen, dstLen);
|
||||
return std::make_tuple(srcLen, dstLen);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18,10 +18,10 @@
|
||||
#include "mozilla/Span.h" // for mozilla::Span
|
||||
#include "mozilla/TextUtils.h" // for mozilla::IsAscii and via Latin1.h for
|
||||
// encoding_rs_mem.h and MOZ_HAS_JSRUST.
|
||||
#include "mozilla/Tuple.h" // for mozilla::Tuple
|
||||
#include "mozilla/Types.h" // for MFBT_API
|
||||
|
||||
#include <limits> // for CHAR_BIT / std::numeric_limits
|
||||
#include <limits> // for std::numeric_limits
|
||||
#include <limits.h> // for CHAR_BIT
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint8_t
|
||||
|
||||
@ -320,13 +320,13 @@ inline size_t ConvertUtf16toUtf8(mozilla::Span<const char16_t> aSource,
|
||||
* TextEncoder.encodeInto.
|
||||
* https://encoding.spec.whatwg.org/#dom-textencoder-encodeinto
|
||||
*/
|
||||
inline mozilla::Tuple<size_t, size_t> ConvertUtf16toUtf8Partial(
|
||||
inline std::tuple<size_t, size_t> ConvertUtf16toUtf8Partial(
|
||||
mozilla::Span<const char16_t> aSource, mozilla::Span<char> aDest) {
|
||||
size_t srcLen = aSource.Length();
|
||||
size_t dstLen = aDest.Length();
|
||||
encoding_mem_convert_utf16_to_utf8_partial(aSource.Elements(), &srcLen,
|
||||
aDest.Elements(), &dstLen);
|
||||
return mozilla::MakeTuple(srcLen, dstLen);
|
||||
return std::make_tuple(srcLen, dstLen);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/ThreadLocal.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Vector.h"
|
||||
#include "prdtoa.h"
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/ProfileBufferIndex.h"
|
||||
#include "mozilla/Span.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
#include "mozilla/UniquePtrExtensions.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/Variant.h"
|
||||
@ -1019,79 +1018,6 @@ struct ProfileBufferEntryReader::Deserializer<std::tuple<Ts...>> {
|
||||
return ob;
|
||||
}
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// mozilla::Tuple
|
||||
|
||||
// Tuple is serialized as a sequence of each recursively-serialized
|
||||
// item.
|
||||
//
|
||||
// This is equivalent to manually serializing each item, so reading/writing
|
||||
// tuples is equivalent to reading/writing their elements in order, e.g.:
|
||||
// ```
|
||||
// Tuple<int, std::string> is = ...;
|
||||
// aEW.WriteObject(is); // Write the Tuple, equivalent to:
|
||||
// aEW.WriteObject(/* int */ std::get<0>(is), /* string */ std::get<1>(is));
|
||||
// ...
|
||||
// // Reading back can be done directly into a Tuple:
|
||||
// auto is = aER.ReadObject<Tuple<int, std::string>>();
|
||||
// // Or each item could be read separately:
|
||||
// auto i = aER.ReadObject<int>(); auto s = aER.ReadObject<std::string>();
|
||||
// ```
|
||||
template <typename... Ts>
|
||||
struct ProfileBufferEntryWriter::Serializer<Tuple<Ts...>> {
|
||||
private:
|
||||
template <size_t... Is>
|
||||
static Length TupleBytes(const Tuple<Ts...>& aTuple,
|
||||
std::index_sequence<Is...>) {
|
||||
return (0 + ... + SumBytes(Get<Is>(aTuple)));
|
||||
}
|
||||
|
||||
template <size_t... Is>
|
||||
static void TupleWrite(ProfileBufferEntryWriter& aEW,
|
||||
const Tuple<Ts...>& aTuple,
|
||||
std::index_sequence<Is...>) {
|
||||
(aEW.WriteObject(Get<Is>(aTuple)), ...);
|
||||
}
|
||||
|
||||
public:
|
||||
static Length Bytes(const Tuple<Ts...>& aTuple) {
|
||||
// Generate a 0..N-1 index pack, we'll add the sizes of each item.
|
||||
return TupleBytes(aTuple, std::index_sequence_for<Ts...>());
|
||||
}
|
||||
|
||||
static void Write(ProfileBufferEntryWriter& aEW, const Tuple<Ts...>& aTuple) {
|
||||
// Generate a 0..N-1 index pack, we'll write each item.
|
||||
TupleWrite(aEW, aTuple, std::index_sequence_for<Ts...>());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename... Ts>
|
||||
struct ProfileBufferEntryReader::Deserializer<Tuple<Ts...>> {
|
||||
template <size_t I>
|
||||
static void TupleIReadInto(ProfileBufferEntryReader& aER,
|
||||
Tuple<Ts...>& aTuple) {
|
||||
aER.ReadIntoObject(Get<I>(aTuple));
|
||||
}
|
||||
|
||||
template <size_t... Is>
|
||||
static void TupleReadInto(ProfileBufferEntryReader& aER, Tuple<Ts...>& aTuple,
|
||||
std::index_sequence<Is...>) {
|
||||
(TupleIReadInto<Is>(aER, aTuple), ...);
|
||||
}
|
||||
|
||||
static void ReadInto(ProfileBufferEntryReader& aER, Tuple<Ts...>& aTuple) {
|
||||
TupleReadInto(aER, aTuple, std::index_sequence_for<Ts...>());
|
||||
}
|
||||
|
||||
static Tuple<Ts...> Read(ProfileBufferEntryReader& aER) {
|
||||
// Note that this creates default `Ts` first, and then overwrites them.
|
||||
Tuple<Ts...> ob;
|
||||
ReadInto(aER, ob);
|
||||
return ob;
|
||||
}
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// mozilla::Span
|
||||
|
||||
|
@ -82,7 +82,7 @@ ProfilerLabel ProfilerLabelBegin(const char* aLabelName,
|
||||
: nullptr;
|
||||
uint32_t generation = data.GenerationCRef();
|
||||
|
||||
return MakeTuple(entryContext, generation);
|
||||
return std::make_tuple(entryContext, generation);
|
||||
}
|
||||
|
||||
void ProfilerLabelEnd(const ProfilerLabel& aLabel) {
|
||||
@ -91,19 +91,19 @@ void ProfilerLabelEnd(const ProfilerLabel& aLabel) {
|
||||
}
|
||||
|
||||
const AutoProfilerLabelData data;
|
||||
if (data.ExitCRef() && (Get<1>(aLabel) == data.GenerationCRef())) {
|
||||
data.ExitCRef()(Get<0>(aLabel));
|
||||
if (data.ExitCRef() && (std::get<1>(aLabel) == data.GenerationCRef())) {
|
||||
data.ExitCRef()(std::get<0>(aLabel));
|
||||
}
|
||||
}
|
||||
|
||||
AutoProfilerLabel::AutoProfilerLabel(const char* aLabel,
|
||||
const char* aDynamicString) {
|
||||
Tie(mEntryContext, mGeneration) =
|
||||
std::tie(mEntryContext, mGeneration) =
|
||||
ProfilerLabelBegin(aLabel, aDynamicString, this);
|
||||
}
|
||||
|
||||
AutoProfilerLabel::~AutoProfilerLabel() {
|
||||
ProfilerLabelEnd(MakeTuple(mEntryContext, mGeneration));
|
||||
ProfilerLabelEnd(std::make_tuple(mEntryContext, mGeneration));
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -8,8 +8,9 @@
|
||||
#define mozilla_AutoProfilerLabel_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
|
||||
#include "mozilla/Types.h"
|
||||
#include <tuple>
|
||||
|
||||
// The Gecko Profiler defines AutoProfilerLabel, an RAII class for
|
||||
// pushing/popping frames to/from the ProfilingStack.
|
||||
@ -52,7 +53,7 @@ class MOZ_RAII AutoProfilerLabel {
|
||||
uint32_t mGeneration;
|
||||
};
|
||||
|
||||
using ProfilerLabel = Tuple<void*, uint32_t>;
|
||||
using ProfilerLabel = std::tuple<void*, uint32_t>;
|
||||
|
||||
bool IsProfilerPresent();
|
||||
ProfilerLabel ProfilerLabelBegin(const char* aLabelName,
|
||||
@ -60,7 +61,7 @@ ProfilerLabel ProfilerLabelBegin(const char* aLabelName,
|
||||
void ProfilerLabelEnd(const ProfilerLabel& aLabel);
|
||||
|
||||
inline bool IsValidProfilerLabel(const ProfilerLabel& aLabel) {
|
||||
return !!Get<0>(aLabel);
|
||||
return !!std::get<0>(aLabel);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -4352,9 +4352,9 @@ void TestBlocksRingBufferSerialization() {
|
||||
});
|
||||
|
||||
rb.Clear();
|
||||
rb.PutObjects(MakeTuple('0',
|
||||
WrapProfileBufferLiteralCStringPointer(THE_ANSWER),
|
||||
42, std::string(" but pi="), 3.14));
|
||||
rb.PutObjects(
|
||||
std::make_tuple('0', WrapProfileBufferLiteralCStringPointer(THE_ANSWER),
|
||||
42, std::string(" but pi="), 3.14));
|
||||
rb.ReadEach([&](ProfileBufferEntryReader& aER) {
|
||||
MOZ_RELEASE_ASSERT(aER.ReadObject<char>() == '0');
|
||||
MOZ_RELEASE_ASSERT(aER.ReadObject<const char*>() == theAnswer);
|
||||
|
@ -927,10 +927,8 @@ void RemoteProxyAutoConfig::GetProxyForURIWithCallback(
|
||||
|
||||
mProxyAutoConfigParent->SendGetProxyForURI(
|
||||
aTestURI, aTestHost,
|
||||
[aCallback](Tuple<nsresult, nsCString>&& aResult) {
|
||||
nsresult status;
|
||||
nsCString result;
|
||||
Tie(status, result) = aResult;
|
||||
[aCallback](std::tuple<nsresult, nsCString>&& aResult) {
|
||||
auto [status, result] = aResult;
|
||||
aCallback(status, result);
|
||||
},
|
||||
[aCallback](mozilla::ipc::ResponseRejectReason&& aReason) {
|
||||
|
@ -144,14 +144,14 @@ void nsSocketTransportService::ApplyPortRemap(uint16_t* aPort) {
|
||||
|
||||
// Reverse the array to make later rules override earlier rules.
|
||||
for (auto const& portMapping : Reversed(*mPortRemapping)) {
|
||||
if (*aPort < Get<0>(portMapping)) {
|
||||
if (*aPort < std::get<0>(portMapping)) {
|
||||
continue;
|
||||
}
|
||||
if (*aPort > Get<1>(portMapping)) {
|
||||
if (*aPort > std::get<1>(portMapping)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
*aPort = Get<2>(portMapping);
|
||||
*aPort = std::get<2>(portMapping);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -168,7 +168,7 @@ bool nsSocketTransportService::UpdatePortRemapPreference(
|
||||
return true;
|
||||
}
|
||||
|
||||
nsTArray<Tuple<uint16_t, uint16_t>> ranges(2);
|
||||
nsTArray<std::tuple<uint16_t, uint16_t>> ranges(2);
|
||||
while (true) {
|
||||
uint16_t loPort;
|
||||
tokenizer.SkipWhites();
|
||||
@ -187,7 +187,7 @@ bool nsSocketTransportService::UpdatePortRemapPreference(
|
||||
hiPort = loPort;
|
||||
}
|
||||
|
||||
ranges.AppendElement(MakeTuple(loPort, hiPort));
|
||||
ranges.AppendElement(std::make_tuple(loPort, hiPort));
|
||||
|
||||
tokenizer.SkipWhites();
|
||||
if (tokenizer.CheckChar(',')) {
|
||||
@ -207,8 +207,8 @@ bool nsSocketTransportService::UpdatePortRemapPreference(
|
||||
// remapping array from the end, this may have a small perf win by
|
||||
// hitting the most common cases earlier.
|
||||
for (auto const& range : Reversed(ranges)) {
|
||||
portRemapping.AppendElement(
|
||||
MakeTuple(Get<0>(range), Get<1>(range), targetPort));
|
||||
portRemapping.AppendElement(std::make_tuple(
|
||||
std::get<0>(range), std::get<1>(range), targetPort));
|
||||
}
|
||||
ranges.Clear();
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user