michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* vim: set sw=4 ts=8 et tw=80 : */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_StructuredCloneUtils_h michael@0: #define mozilla_dom_StructuredCloneUtils_h michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsTArray.h" michael@0: #include "nsIDOMFile.h" michael@0: michael@0: #include "js/StructuredClone.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: struct SerializedStructuredCloneBuffer; michael@0: michael@0: namespace dom { michael@0: michael@0: struct michael@0: StructuredCloneClosure michael@0: { michael@0: nsTArray > mBlobs; michael@0: }; michael@0: michael@0: struct michael@0: StructuredCloneData michael@0: { michael@0: StructuredCloneData() : mData(nullptr), mDataLength(0) {} michael@0: uint64_t* mData; michael@0: size_t mDataLength; michael@0: StructuredCloneClosure mClosure; michael@0: }; michael@0: michael@0: bool michael@0: ReadStructuredClone(JSContext* aCx, uint64_t* aData, size_t aDataLength, michael@0: const StructuredCloneClosure& aClosure, michael@0: JS::MutableHandle aClone); michael@0: michael@0: inline bool michael@0: ReadStructuredClone(JSContext* aCx, const StructuredCloneData& aData, michael@0: JS::MutableHandle aClone) michael@0: { michael@0: return ReadStructuredClone(aCx, aData.mData, aData.mDataLength, michael@0: aData.mClosure, aClone); michael@0: } michael@0: michael@0: bool michael@0: WriteStructuredClone(JSContext* aCx, JS::Handle aSource, michael@0: JSAutoStructuredCloneBuffer& aBuffer, michael@0: StructuredCloneClosure& aClosure); michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_dom_StructuredCloneUtils_h