docshell/shistory/MaybeNewPSHEntry.h
author Jeff Walden <jwalden@mit.edu>
Tue, 19 Nov 2019 04:55:39 +0000
changeset 502538 b5c5ba07d3dbd0d07b66fa42a103f4df2c27d3a2
parent 500514 13da9115c96bb79d33ff7bb56a170c9834157bf6
permissions -rw-r--r--
Bug 1596544 - intl_ValidateAndCanonicalizeUnicodeExtensionType should ignore the second |option| argument until it's needed to report an error. r=anba Differential Revision: https://phabricator.services.mozilla.com/D53145

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef mozilla_dom_MaybeNewPSHEntry_h
#define mozilla_dom_MaybeNewPSHEntry_h

#include "ipc/IPCMessageUtils.h"
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/Variant.h"
#include "mozilla/ipc/IPDLParamTraits.h"
#include "mozilla/ipc/ProtocolUtils.h"

namespace mozilla {
namespace dom {

class LegacySHEntry;
class PSHEntryChild;
class PSHEntryParent;
class SHEntryChild;

struct NewPSHEntry final {
  mozilla::ipc::ManagedEndpoint<PSHEntryChild> mEndpoint;
  PSHistoryParent* mSHistoryParent;
  PSHistoryChild* mSHistoryChild;
  uint64_t mSharedID;
};

typedef Variant<PSHEntryParent*, NewPSHEntry> MaybeNewPSHEntryParent;
typedef Variant<PSHEntryChild*, NewPSHEntry> MaybeNewPSHEntryChild;

// Any IPDL protocol trying to pass this (as argument or return value) needs to
// be managed by PContent.
class CrossProcessSHEntry {
  NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING

  SHEntryChild* ToSHEntryChild();
};

}  // namespace dom

namespace ipc {

template <>
struct IPDLParamTraits<dom::CrossProcessSHEntry*> {
  static void Write(IPC::Message* aMsg, IProtocol* aActor,
                    dom::CrossProcessSHEntry* aEntry);

  static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
                   IProtocol* aActor, RefPtr<dom::CrossProcessSHEntry>* aEntry);
};

}  // namespace ipc
}  // namespace mozilla

#endif /* mozilla_dom_MaybeNewPSHEntry_h */