Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 "use strict";
7 if (typeof Components != "undefined") {
8 throw new Error("This file is meant to be loaded in a worker");
9 }
10 if (!module || !exports) {
11 throw new Error("Please load this module with require()");
12 }
14 let SharedAll = require("resource://gre/modules/osfile/osfile_shared_allthreads.jsm");
15 let libxul = new SharedAll.Library("libxul", SharedAll.Constants.Path.libxul);
16 let Type = SharedAll.Type;
18 let Primitives = {};
20 libxul.declareLazyFFI(Primitives, "compress",
21 "workerlz4_compress",
22 null,
23 /*return*/ Type.size_t,
24 /*const source*/ Type.void_t.in_ptr,
25 /*inputSize*/ Type.size_t,
26 /*dest*/ Type.void_t.out_ptr
27 );
29 libxul.declareLazyFFI(Primitives, "decompress",
30 "workerlz4_decompress",
31 null,
32 /*return*/ Type.int,
33 /*const source*/ Type.void_t.in_ptr,
34 /*inputSize*/ Type.size_t,
35 /*dest*/ Type.void_t.out_ptr,
36 /*maxOutputSize*/ Type.size_t,
37 /*actualOutputSize*/ Type.size_t.out_ptr
38 );
40 libxul.declareLazyFFI(Primitives, "maxCompressedSize",
41 "workerlz4_maxCompressedSize",
42 null,
43 /*return*/ Type.size_t,
44 /*inputSize*/ Type.size_t
45 );
47 module.exports = {
48 get compress() {
49 return Primitives.compress;
50 },
51 get decompress() {
52 return Primitives.decompress;
53 },
54 get maxCompressedSize() {
55 return Primitives.maxCompressedSize;
56 }
57 };