1 // Copyright 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBTRANSPORT_WEB_TRANSPORT_STREAM_H_
6 #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBTRANSPORT_WEB_TRANSPORT_STREAM_H_
7 
8 #include "third_party/blink/renderer/platform/heap/garbage_collected.h"
9 
10 namespace blink {
11 
12 // Base class for SendStream, ReceiveStream and BidirectionalStream, used by
13 // QuicTransport to hold references to them. It is not part of the standard.
14 class WebTransportStream : public GarbageCollectedMixin {
15  public:
16   virtual ~WebTransportStream() = default;
17 
18   // Process an IncomingStreamClosed message from the network service. This is
19   // called by QuicTransport objects. May execute user JavaScript.
20   virtual void OnIncomingStreamClosed(bool fin_received) = 0;
21 
22   // Called from QuicTransport whenever the mojo connection is torn down. Should
23   // close and free data pipes. May execute user JavaScript.
24   virtual void Reset() = 0;
25 
26   // Called when the ExecutionContext is destroyed. This is used instead of
27   // ExecutionContextLifecycleObserver to ensure strict ordering for garbage
28   // collection. Must not execute JavaScript.
29   virtual void ContextDestroyed() = 0;
30 };
31 
32 }  // namespace blink
33 
34 #endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBTRANSPORT_WEB_TRANSPORT_STREAM_H_
35