tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ScriptCompression.h (1646B)


      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/. */
      6 
      7 #ifndef js_loader_ScriptCompression_h
      8 #define js_loader_ScriptCompression_h
      9 
     10 #include "ErrorList.h"
     11 #include "mozilla/Vector.h"
     12 
     13 namespace JS::loader {
     14 
     15 class ScriptLoadRequest;
     16 
     17 /**
     18 * Compress the bytecode stored in a buffer. All data before the bytecode is
     19 * copied into the output buffer without modification.
     20 *
     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
     24 */
     25 bool ScriptBytecodeCompress(
     26    mozilla::Vector<uint8_t>& aBytecodeBuf, size_t aBytecodeOffset,
     27    mozilla::Vector<uint8_t>& aCompressedBytecodeBufOut);
     28 
     29 /**
     30 * Uncompress the bytecode stored in a buffer. All data before the bytecode is
     31 * copied into the output buffer without modification.
     32 *
     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
     36 */
     37 bool ScriptBytecodeDecompress(mozilla::Vector<uint8_t>& aCompressedBytecodeBuf,
     38                              size_t aBytecodeOffset,
     39                              mozilla::Vector<uint8_t>& aBytecodeBufOut);
     40 
     41 }  // namespace JS::loader
     42 
     43 #endif  // js_loader_ScriptCompression_h