Commit a1b827b5 authored by Andi-Bogdan Postelnicu's avatar Andi-Bogdan Postelnicu
Browse files

Bug 1276351 - Move away from mozilla::tuple to std::tuple. r=necko-reviewers,sergesanspaille

parent 10b02973
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@

#include "EventQueue.h"

#include "mozilla/Tuple.h"
#include "nsClassHashtable.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIFrame.h"
+3 −3
Original line number Diff line number Diff line
@@ -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();
+3 −3
Original line number Diff line number Diff line
@@ -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);
+5 −5
Original line number Diff line number Diff line
@@ -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));
            }
          },
          []() {});
+10 −10
Original line number Diff line number Diff line
@@ -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,7 +4089,7 @@ nsDocShell::Reload(uint32_t aReloadFlags) {
          mBrowsingContext, forceReload,
          [docShell, doc, loadType, browsingContext, currentURI, referrerInfo,
           loadGroup, stopDetector](
              Tuple<bool, Maybe<NotNull<RefPtr<nsDocShellLoadState>>>,
              std::tuple<bool, Maybe<NotNull<RefPtr<nsDocShellLoadState>>>,
                         Maybe<bool>>&& aResult) {
            auto scopeExit = MakeScopeExit([loadGroup, stopDetector]() {
              if (loadGroup) {
@@ -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.
Loading