| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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 ReadableStreamReader_h | |
| 6 #define ReadableStreamReader_h | |
| 7 | |
| 8 #include "bindings/core/v8/ActiveScriptWrappable.h" | |
| 9 #include "bindings/core/v8/ScriptPromise.h" | |
| 10 #include "bindings/core/v8/ScriptPromiseProperty.h" | |
| 11 #include "bindings/core/v8/ScriptValue.h" | |
| 12 #include "bindings/core/v8/ScriptWrappable.h" | |
| 13 #include "bindings/core/v8/ToV8.h" | |
| 14 #include "core/CoreExport.h" | |
| 15 #include "core/dom/ActiveDOMObject.h" | |
| 16 #include "core/streams/ReadableStream.h" | |
| 17 #include "platform/heap/Handle.h" | |
| 18 | |
| 19 namespace blink { | |
| 20 | |
| 21 class DOMException; | |
| 22 class ExceptionState; | |
| 23 class ExecutionContext; | |
| 24 class ScriptState; | |
| 25 | |
| 26 // ReadableStreamReader corresponds to the same-name class in the Streams spec | |
| 27 // https://streams.spec.whatwg.org/. | |
| 28 class CORE_EXPORT ReadableStreamReader final : public GarbageCollectedFinalized<
ReadableStreamReader>, public ScriptWrappable, public ActiveScriptWrappable, pub
lic ActiveDOMObject { | |
| 29 DEFINE_WRAPPERTYPEINFO(); | |
| 30 USING_GARBAGE_COLLECTED_MIXIN(ReadableStreamReader); | |
| 31 public: | |
| 32 // The stream must not be locked to any ReadableStreamReader when called. | |
| 33 ReadableStreamReader(ExecutionContext*, ReadableStream*); | |
| 34 | |
| 35 ScriptPromise closed(ScriptState*); | |
| 36 bool isActive() const; | |
| 37 ScriptPromise cancel(ScriptState*); | |
| 38 ScriptPromise cancel(ScriptState*, ScriptValue reason); | |
| 39 ScriptPromise read(ScriptState*); | |
| 40 void releaseLock(ExceptionState&); | |
| 41 void releaseLock(); | |
| 42 void close(); | |
| 43 void error(); | |
| 44 | |
| 45 bool hasPendingActivity() const final; | |
| 46 void stop() override; | |
| 47 | |
| 48 DECLARE_TRACE(); | |
| 49 | |
| 50 private: | |
| 51 using ClosedPromise = ScriptPromiseProperty<Member<ReadableStreamReader>, To
V8UndefinedGenerator, Member<DOMException>>; | |
| 52 | |
| 53 const Member<ReadableStream> m_stream; | |
| 54 Member<ClosedPromise> m_closed; | |
| 55 }; | |
| 56 | |
| 57 } // namespace blink | |
| 58 | |
| 59 #endif // ReadableStreamReader_h | |
| OLD | NEW |