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