tor-browser

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

CompressionStream.h (1769B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
      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 DOM_COMPRESSION_COMPRESSIONSTREAM_H_
      8 #define DOM_COMPRESSION_COMPRESSIONSTREAM_H_
      9 
     10 #include "js/TypeDecls.h"
     11 #include "mozilla/Attributes.h"
     12 #include "mozilla/ErrorResult.h"
     13 #include "mozilla/dom/BindingDeclarations.h"
     14 #include "nsCycleCollectionParticipant.h"
     15 #include "nsWrapperCache.h"
     16 
     17 namespace mozilla::dom {
     18 
     19 class ReadableStream;
     20 class WritableStream;
     21 class TransformStream;
     22 
     23 enum class CompressionFormat : uint8_t;
     24 
     25 class CompressionStream final : public nsISupports, public nsWrapperCache {
     26 public:
     27  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     28  NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(CompressionStream)
     29 
     30 public:
     31  CompressionStream(nsISupports* aGlobal, TransformStream& aStream);
     32 
     33 protected:
     34  ~CompressionStream();
     35 
     36 public:
     37  nsISupports* GetParentObject() const { return mGlobal; }
     38 
     39  JSObject* WrapObject(JSContext* aCx,
     40                       JS::Handle<JSObject*> aGivenProto) override;
     41 
     42  // TODO: Mark as MOZ_CAN_RUN_SCRIPT when IDL constructors can be (bug 1749042)
     43  MOZ_CAN_RUN_SCRIPT_BOUNDARY static already_AddRefed<CompressionStream>
     44  Constructor(const GlobalObject& aGlobal, CompressionFormat aFormat,
     45              ErrorResult& aRv);
     46 
     47  already_AddRefed<ReadableStream> Readable() const;
     48 
     49  already_AddRefed<WritableStream> Writable() const;
     50 
     51 private:
     52  nsCOMPtr<nsISupports> mGlobal;
     53 
     54  RefPtr<TransformStream> mStream;
     55 };
     56 
     57 }  // namespace mozilla::dom
     58 
     59 #endif  // DOM_COMPRESSION_COMPRESSIONSTREAM_H_