| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/streams/ReadableStreamReader.h" | 5 #include "core/streams/ReadableStreamReader.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "bindings/core/v8/ToV8.h" | 9 #include "bindings/core/v8/ToV8.h" |
| 10 #include "bindings/core/v8/V8IteratorResultValue.h" | 10 #include "bindings/core/v8/V8IteratorResultValue.h" |
| 11 #include "core/dom/DOMException.h" | 11 #include "core/dom/DOMException.h" |
| 12 #include "core/dom/ExceptionCode.h" | 12 #include "core/dom/ExceptionCode.h" |
| 13 #include "core/streams/ReadableStream.h" | 13 #include "core/streams/ReadableStream.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 ReadableStreamReader::ReadableStreamReader(ExecutionContext* executionContext, R
eadableStream* stream) | 17 ReadableStreamReader::ReadableStreamReader(ExecutionContext* executionContext, R
eadableStream* stream) |
| 18 : ActiveDOMObject(executionContext) | 18 : ActiveScriptWrappable(this) |
| 19 , ActiveDOMObject(executionContext) |
| 19 , m_stream(stream) | 20 , m_stream(stream) |
| 20 , m_closed(new ClosedPromise(executionContext, this, ClosedPromise::Closed)) | 21 , m_closed(new ClosedPromise(executionContext, this, ClosedPromise::Closed)) |
| 21 { | 22 { |
| 22 suspendIfNeeded(); | 23 suspendIfNeeded(); |
| 23 ASSERT(m_stream->isLockedTo(nullptr)); | 24 ASSERT(m_stream->isLockedTo(nullptr)); |
| 24 m_stream->setReader(this); | 25 m_stream->setReader(this); |
| 25 | 26 |
| 26 if (m_stream->stateInternal() == ReadableStream::Closed) | 27 if (m_stream->stateInternal() == ReadableStream::Closed) |
| 27 m_closed->resolve(ToV8UndefinedGenerator()); | 28 m_closed->resolve(ToV8UndefinedGenerator()); |
| 28 if (m_stream->stateInternal() == ReadableStream::Errored) | 29 if (m_stream->stateInternal() == ReadableStream::Errored) |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 121 } |
| 121 | 122 |
| 122 DEFINE_TRACE(ReadableStreamReader) | 123 DEFINE_TRACE(ReadableStreamReader) |
| 123 { | 124 { |
| 124 visitor->trace(m_stream); | 125 visitor->trace(m_stream); |
| 125 visitor->trace(m_closed); | 126 visitor->trace(m_closed); |
| 126 ActiveDOMObject::trace(visitor); | 127 ActiveDOMObject::trace(visitor); |
| 127 } | 128 } |
| 128 | 129 |
| 129 } // namespace blink | 130 } // namespace blink |
| OLD | NEW |