| Index: Source/core/streams/ReadableStream.h
|
| diff --git a/Source/core/streams/ReadableStream.h b/Source/core/streams/ReadableStream.h
|
| index 28deb583ab43af3d2ba1556aa53298a3328d3445..36ca2b9267d83db05da82ff46affe4b5df877d8a 100644
|
| --- a/Source/core/streams/ReadableStream.h
|
| +++ b/Source/core/streams/ReadableStream.h
|
| @@ -21,6 +21,7 @@ namespace blink {
|
|
|
| class DOMException;
|
| class ExceptionState;
|
| +class ExclusiveStreamReader;
|
| class UnderlyingSource;
|
|
|
| class ReadableStream : public GarbageCollectedFinalized<ReadableStream>, public ScriptWrappable, public ActiveDOMObject {
|
| @@ -43,31 +44,49 @@ public:
|
| bool isStarted() const { return m_isStarted; }
|
| bool isDraining() const { return m_isDraining; }
|
| bool isPulling() const { return m_isPulling; }
|
| - State state() const { return m_state; }
|
| - String stateString() const;
|
| + State stateInternal() const { return m_state; }
|
| + DOMException* storedException() { return m_exception.get(); }
|
|
|
| - virtual ScriptValue read(ScriptState*, ExceptionState&) = 0;
|
| + // |stateString|, |read| and |ready| are affected by an exclusive lock. Use
|
| + // |stateInternal|, |readInternal| and |readyInternal| if you want to avoid
|
| + // that.
|
| + String stateString() const;
|
| + ScriptValue read(ScriptState*, ExceptionState&);
|
| ScriptPromise ready(ScriptState*);
|
| ScriptPromise cancel(ScriptState*, ScriptValue reason);
|
| ScriptPromise closed(ScriptState*);
|
|
|
| + virtual ScriptValue readInternal(ScriptState*, ExceptionState&) = 0;
|
| + ScriptPromise readyInternal(ScriptState*);
|
| +
|
| void close();
|
| void error(PassRefPtrWillBeRawPtr<DOMException>);
|
|
|
| void didSourceStart();
|
|
|
| + // This function is not a getter. It creates an ExclusiveStreamReader and
|
| + // returns it.
|
| + ExclusiveStreamReader* getReader(ExceptionState&);
|
| + // Only ExclusiveStreamReader methods should call this function.
|
| + void setReader(ExclusiveStreamReader*);
|
| + bool isLockedTo(const ExclusiveStreamReader* reader) const { return m_reader == reader; }
|
| +
|
| bool hasPendingActivity() const override;
|
| - virtual void trace(Visitor*) override;
|
| + void stop() override;
|
| + void trace(Visitor*) override;
|
| +
|
| + // Returns the string representation of the given State.
|
| + static String stateToString(State);
|
|
|
| protected:
|
| bool enqueuePreliminaryCheck();
|
| bool enqueuePostAction();
|
| - void readPreliminaryCheck(ExceptionState&);
|
| - void readPostAction();
|
| + void readInternalPreliminaryCheck(ExceptionState&);
|
| + void readInternalPostAction();
|
|
|
| private:
|
| - typedef ScriptPromiseProperty<Member<ReadableStream>, ToV8UndefinedGenerator, RefPtrWillBeMember<DOMException> > WaitPromise;
|
| - typedef ScriptPromiseProperty<Member<ReadableStream>, ToV8UndefinedGenerator, RefPtrWillBeMember<DOMException> > ClosedPromise;
|
| + using WaitPromise = ScriptPromiseProperty<Member<ReadableStream>, ToV8UndefinedGenerator, RefPtrWillBeMember<DOMException>>;
|
| + using ClosedPromise = ScriptPromiseProperty<Member<ReadableStream>, ToV8UndefinedGenerator, RefPtrWillBeMember<DOMException>>;
|
|
|
| virtual bool isQueueEmpty() const = 0;
|
| virtual void clearQueue() = 0;
|
| @@ -84,7 +103,9 @@ private:
|
|
|
| Member<WaitPromise> m_ready;
|
| Member<ClosedPromise> m_closed;
|
| +
|
| RefPtrWillBeMember<DOMException> m_exception;
|
| + Member<ExclusiveStreamReader> m_reader;
|
| };
|
|
|
| } // namespace blink
|
|
|