tor-browser

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

WebTransportReceiveStream.h (1727B)


      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 DOM_WEBTRANSPORT_API_WEBTRANSPORTRECEIVESTREAM__H_
      8 #define DOM_WEBTRANSPORT_API_WEBTRANSPORTRECEIVESTREAM__H_
      9 
     10 #include "mozilla/dom/ReadableStream.h"
     11 
     12 namespace mozilla::ipc {
     13 class DataPipeReceiver;
     14 }
     15 
     16 namespace mozilla::dom {
     17 
     18 class WebTransport;
     19 
     20 class WebTransportReceiveStream final : public ReadableStream {
     21 public:
     22  NS_DECL_ISUPPORTS_INHERITED
     23  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(WebTransportReceiveStream,
     24                                           ReadableStream)
     25 
     26  WebTransportReceiveStream(nsIGlobalObject* aGlobal, WebTransport* aTransport);
     27 
     28  static already_AddRefed<WebTransportReceiveStream> Create(
     29      WebTransport* aWebTransport, nsIGlobalObject* aGlobal, uint64_t aStreamId,
     30      mozilla::ipc::DataPipeReceiver* receiver, ErrorResult& aRv);
     31 
     32  // WebIDL Boilerplate
     33  JSObject* WrapObject(JSContext* aCx,
     34                       JS::Handle<JSObject*> aGivenProto) override;
     35 
     36  // WebIDL Interface
     37  already_AddRefed<Promise> GetStats();
     38 
     39 private:
     40  ~WebTransportReceiveStream() override { mozilla::DropJSObjects(this); }
     41 
     42  // We must hold a reference to the WebTransport so it can't go away on
     43  // us.  This forms a cycle with WebTransport that will be broken when the
     44  // CC runs.   WebTransport::CleanUp() will destroy all the send and receive
     45  // streams, breaking the cycle.
     46  RefPtr<WebTransport> mTransport;
     47 };
     48 }  // namespace mozilla::dom
     49 
     50 #endif