| Index: Source/core/streams/ReadableStream.cpp
|
| diff --git a/Source/core/streams/ReadableStream.cpp b/Source/core/streams/ReadableStream.cpp
|
| index b67e0232b193c21927f4af4e4d5f6f3d144d73b1..d87c5624f9357b1eb3f6c91ded0220ba2efce902 100644
|
| --- a/Source/core/streams/ReadableStream.cpp
|
| +++ b/Source/core/streams/ReadableStream.cpp
|
| @@ -16,43 +16,39 @@
|
|
|
| namespace blink {
|
|
|
| -class ReadableStream::OnStarted : public ScriptFunction {
|
| -public:
|
| - OnStarted(v8::Isolate* isolate, ReadableStream* stream)
|
| - : ScriptFunction(isolate)
|
| - , m_stream(stream) { }
|
| - virtual ScriptValue call(ScriptValue value) OVERRIDE
|
| - {
|
| - m_stream->onStarted();
|
| - return value;
|
| - }
|
| -
|
| -private:
|
| - Persistent<ReadableStream> m_stream;
|
| -};
|
| -
|
| -ReadableStream::ReadableStream(ScriptState* scriptState, UnderlyingSource* source, ExceptionState* exceptionState)
|
| - : ContextLifecycleObserver(scriptState->executionContext())
|
| - , m_source(source)
|
| +ReadableStream::ReadableStream(ExecutionContext* executionContext, UnderlyingSource* source)
|
| + : m_source(source)
|
| , m_isStarted(false)
|
| , m_isDraining(false)
|
| , m_isPulling(false)
|
| , m_isSchedulingPull(false)
|
| , m_state(Waiting)
|
| - , m_wait(new WaitPromise(scriptState->executionContext(), this, WaitPromise::Ready))
|
| - , m_closed(new ClosedPromise(scriptState->executionContext(), this, ClosedPromise::Closed))
|
| + , m_wait(new WaitPromise(executionContext, this, WaitPromise::Ready))
|
| + , m_closed(new ClosedPromise(executionContext, this, ClosedPromise::Closed))
|
| {
|
| ScriptWrappable::init(this);
|
| -
|
| - ScriptPromise promise = source->startSource(exceptionState);
|
| - // The underlying source calls |this->error| on failure.
|
| - promise.then(adoptPtr(new OnStarted(scriptState->isolate(), this)));
|
| }
|
|
|
| ReadableStream::~ReadableStream()
|
| {
|
| }
|
|
|
| +String ReadableStream::stateString() const
|
| +{
|
| + switch (m_state) {
|
| + case Readable:
|
| + return "readable";
|
| + case Waiting:
|
| + return "waiting";
|
| + case Closed:
|
| + return "closed";
|
| + case Errored:
|
| + return "errored";
|
| + }
|
| + ASSERT(false);
|
| + return String();
|
| +}
|
| +
|
| bool ReadableStream::enqueuePreliminaryCheck(size_t chunkSize)
|
| {
|
| if (m_state == Errored || m_state == Closed || m_isDraining)
|
| @@ -88,18 +84,18 @@ void ReadableStream::close()
|
| }
|
| }
|
|
|
| -void ReadableStream::readPreliminaryCheck(ExceptionState* exceptionState)
|
| +void ReadableStream::readPreliminaryCheck(ExceptionState& exceptionState)
|
| {
|
| if (m_state == Waiting) {
|
| - exceptionState->throwTypeError("read is called while state is waiting");
|
| + exceptionState.throwTypeError("read is called while state is waiting");
|
| return;
|
| }
|
| if (m_state == Closed) {
|
| - exceptionState->throwTypeError("read is called while state is closed");
|
| + exceptionState.throwTypeError("read is called while state is closed");
|
| return;
|
| }
|
| if (m_state == Errored) {
|
| - exceptionState->throwDOMException(m_exception->code(), m_exception->message());
|
| + exceptionState.throwDOMException(m_exception->code(), m_exception->message());
|
| return;
|
| }
|
| }
|
| @@ -174,7 +170,7 @@ void ReadableStream::error(PassRefPtrWillBeRawPtr<DOMException> exception)
|
| }
|
| }
|
|
|
| -void ReadableStream::onStarted()
|
| +void ReadableStream::didSourceStart()
|
| {
|
| m_isStarted = true;
|
| if (m_isSchedulingPull)
|
|
|