Bug 1845811 remove unused rv variable r=padenot
[gecko.git] / ipc / glue / SerializedStructuredCloneBuffer.h
blobed4e404dbc5ad8e1a6e00a3b734558acabc67711
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef __IPC_GLUE_SERIALIZEDSTRUCTUREDCLONEBUFFER_H__
8 #define __IPC_GLUE_SERIALIZEDSTRUCTUREDCLONEBUFFER_H__
10 #include <algorithm>
11 #include <cstdint>
12 #include <cstdlib>
13 #include <string>
14 #include <utility>
15 #include "chrome/common/ipc_message.h"
16 #include "chrome/common/ipc_message_utils.h"
17 #include "js/AllocPolicy.h"
18 #include "js/StructuredClone.h"
19 #include "mozilla/Assertions.h"
20 #include "mozilla/BufferList.h"
21 #include "mozilla/Vector.h"
22 #include "mozilla/mozalloc.h"
23 class PickleIterator;
25 namespace mozilla {
26 template <typename...>
27 class Variant;
29 namespace detail {
30 template <typename...>
31 struct VariantTag;
33 } // namespace mozilla
35 namespace mozilla {
37 struct SerializedStructuredCloneBuffer final {
38 SerializedStructuredCloneBuffer() = default;
40 SerializedStructuredCloneBuffer(SerializedStructuredCloneBuffer&&) = default;
41 SerializedStructuredCloneBuffer& operator=(
42 SerializedStructuredCloneBuffer&&) = default;
44 SerializedStructuredCloneBuffer(const SerializedStructuredCloneBuffer&) =
45 delete;
46 SerializedStructuredCloneBuffer& operator=(
47 const SerializedStructuredCloneBuffer& aOther) = delete;
49 bool operator==(const SerializedStructuredCloneBuffer& aOther) const {
50 // The copy assignment operator and the equality operator are
51 // needed by the IPDL generated code. We relied on the copy
52 // assignment operator at some places but we never use the
53 // equality operator.
54 return false;
57 JSStructuredCloneData data{JS::StructuredCloneScope::Unassigned};
60 } // namespace mozilla
62 namespace IPC {
63 template <>
64 struct ParamTraits<JSStructuredCloneData> {
65 typedef JSStructuredCloneData paramType;
67 static void Write(MessageWriter* aWriter, const paramType& aParam);
69 static bool Read(MessageReader* aReader, paramType* aResult);
72 template <>
73 struct ParamTraits<mozilla::SerializedStructuredCloneBuffer> {
74 typedef mozilla::SerializedStructuredCloneBuffer paramType;
76 static void Write(MessageWriter* aWriter, const paramType& aParam) {
77 WriteParam(aWriter, aParam.data);
80 static bool Read(MessageReader* aReader, paramType* aResult) {
81 return ReadParam(aReader, &aResult->data);
85 } // namespace IPC
87 #endif /* __IPC_GLUE_SERIALIZEDSTRUCTUREDCLONEBUFFER_H__ */