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 js_loader_ScriptCompression_h
8 #define js_loader_ScriptCompression_h
10 #include "ErrorList.h"
11 #include "mozilla/Vector.h"
13 namespace JS::loader
{
15 class ScriptLoadRequest
;
18 * Compress the bytecode stored in a buffer. All data before the bytecode is
19 * copied into the output buffer without modification.
21 * @param aBytecodeBuf buffer containing the uncompressed bytecode
22 * @param aBytecodeOffset offset of the bytecode in the buffer
23 * @param aCompressedBytecodeBufOut buffer to store the compressed bytecode in
25 bool ScriptBytecodeCompress(
26 mozilla::Vector
<uint8_t>& aBytecodeBuf
, size_t aBytecodeOffset
,
27 mozilla::Vector
<uint8_t>& aCompressedBytecodeBufOut
);
30 * Uncompress the bytecode stored in a buffer. All data before the bytecode is
31 * copied into the output buffer without modification.
33 * @param aCompressedBytecodeBuf buffer containing the compressed bytecode
34 * @param aBytecodeOffset offset of the bytecode in the buffer
35 * @param aBytecodeBufOut buffer to store the uncompressed bytecode in
37 bool ScriptBytecodeDecompress(mozilla::Vector
<uint8_t>& aCompressedBytecodeBuf
,
38 size_t aBytecodeOffset
,
39 mozilla::Vector
<uint8_t>& aBytecodeBufOut
);
41 } // namespace JS::loader
43 #endif // js_loader_ScriptCompression_h