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__
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"
26 template <typename
...>
30 template <typename
...>
33 } // namespace mozilla
37 struct SerializedStructuredCloneBuffer final
{
38 SerializedStructuredCloneBuffer() = default;
40 SerializedStructuredCloneBuffer(SerializedStructuredCloneBuffer
&&) = default;
41 SerializedStructuredCloneBuffer
& operator=(
42 SerializedStructuredCloneBuffer
&&) = default;
44 SerializedStructuredCloneBuffer(const SerializedStructuredCloneBuffer
&) =
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
57 JSStructuredCloneData data
{JS::StructuredCloneScope::Unassigned
};
60 } // namespace mozilla
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
);
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
);
87 #endif /* __IPC_GLUE_SERIALIZEDSTRUCTUREDCLONEBUFFER_H__ */