netwerk/base/src/ArrayBufferInputStream.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef ArrayBufferInputStream_h
michael@0 7 #define ArrayBufferInputStream_h
michael@0 8
michael@0 9 #include "nsIArrayBufferInputStream.h"
michael@0 10 #include "js/Value.h"
michael@0 11 #include "mozilla/Maybe.h"
michael@0 12
michael@0 13 #define NS_ARRAYBUFFERINPUTSTREAM_CONTRACTID "@mozilla.org/io/arraybuffer-input-stream;1"
michael@0 14 #define NS_ARRAYBUFFERINPUTSTREAM_CID \
michael@0 15 { /* 3014dde6-aa1c-41db-87d0-48764a3710f6 */ \
michael@0 16 0x3014dde6, \
michael@0 17 0xaa1c, \
michael@0 18 0x41db, \
michael@0 19 {0x87, 0xd0, 0x48, 0x76, 0x4a, 0x37, 0x10, 0xf6} \
michael@0 20 }
michael@0 21
michael@0 22 class ArrayBufferInputStream : public nsIArrayBufferInputStream {
michael@0 23 public:
michael@0 24 ArrayBufferInputStream();
michael@0 25 virtual ~ArrayBufferInputStream() {}
michael@0 26 NS_DECL_ISUPPORTS
michael@0 27 NS_DECL_NSIARRAYBUFFERINPUTSTREAM
michael@0 28 NS_DECL_NSIINPUTSTREAM
michael@0 29
michael@0 30 private:
michael@0 31 mozilla::Maybe<JS::PersistentRooted<JS::Value> > mArrayBuffer;
michael@0 32 uint8_t* mBuffer; // start of actual buffer
michael@0 33 uint32_t mBufferLength; // length of slice
michael@0 34 uint32_t mOffset; // permanent offset from start of actual buffer
michael@0 35 uint32_t mPos; // offset from start of slice
michael@0 36 bool mClosed;
michael@0 37 };
michael@0 38
michael@0 39 #endif // ArrayBufferInputStream_h

mercurial