OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 #include "core/streams/ReadableStream.h" | 6 #include "core/streams/ReadableStream.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/ScriptFunction.h" | 9 #include "bindings/core/v8/ScriptFunction.h" |
10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 86 } |
87 | 87 |
88 void ReadableStream::readInternalPostAction() | 88 void ReadableStream::readInternalPostAction() |
89 { | 89 { |
90 ASSERT(m_state == Readable); | 90 ASSERT(m_state == Readable); |
91 if (isQueueEmpty() && m_isDraining) | 91 if (isQueueEmpty() && m_isDraining) |
92 closeInternal(); | 92 closeInternal(); |
93 callPullIfNeeded(); | 93 callPullIfNeeded(); |
94 } | 94 } |
95 | 95 |
| 96 ScriptPromise ReadableStream::cancel(ScriptState* scriptState) |
| 97 { |
| 98 return cancel(scriptState, ScriptValue(scriptState, v8::Undefined(scriptStat
e->isolate()))); |
| 99 } |
| 100 |
96 ScriptPromise ReadableStream::cancel(ScriptState* scriptState, ScriptValue reaso
n) | 101 ScriptPromise ReadableStream::cancel(ScriptState* scriptState, ScriptValue reaso
n) |
97 { | 102 { |
98 if (m_reader) | 103 if (m_reader) |
99 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "this stream is locked to a ReadableStreamReader")); | 104 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "this stream is locked to a ReadableStreamReader")); |
100 if (m_state == Closed) | 105 if (m_state == Closed) |
101 return ScriptPromise::cast(scriptState, v8::Undefined(scriptState->isola
te())); | 106 return ScriptPromise::cast(scriptState, v8::Undefined(scriptState->isola
te())); |
102 if (m_state == Errored) | 107 if (m_state == Errored) |
103 return ScriptPromise::rejectWithDOMException(scriptState, m_exception); | 108 return ScriptPromise::rejectWithDOMException(scriptState, m_exception); |
104 | 109 |
105 return cancelInternal(scriptState, reason); | 110 return cancelInternal(scriptState, reason); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 186 |
182 DEFINE_TRACE(ReadableStream) | 187 DEFINE_TRACE(ReadableStream) |
183 { | 188 { |
184 visitor->trace(m_source); | 189 visitor->trace(m_source); |
185 visitor->trace(m_exception); | 190 visitor->trace(m_exception); |
186 visitor->trace(m_reader); | 191 visitor->trace(m_reader); |
187 ActiveDOMObject::trace(visitor); | 192 ActiveDOMObject::trace(visitor); |
188 } | 193 } |
189 | 194 |
190 } // namespace blink | 195 } // namespace blink |
OLD | NEW |