| 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 "modules/fetch/BodyStreamBuffer.h" | 5 #include "modules/fetch/BodyStreamBuffer.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "bindings/core/v8/V8HiddenValue.h" | 8 #include "bindings/core/v8/V8HiddenValue.h" |
| 9 #include "core/dom/DOMArrayBuffer.h" | 9 #include "core/dom/DOMArrayBuffer.h" |
| 10 #include "core/dom/DOMTypedArray.h" | 10 #include "core/dom/DOMTypedArray.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 205 } |
| 206 | 206 |
| 207 ScriptPromise BodyStreamBuffer::cancel(ScriptState* scriptState, | 207 ScriptPromise BodyStreamBuffer::cancel(ScriptState* scriptState, |
| 208 ScriptValue reason) { | 208 ScriptValue reason) { |
| 209 ASSERT(scriptState == m_scriptState.get()); | 209 ASSERT(scriptState == m_scriptState.get()); |
| 210 close(); | 210 close(); |
| 211 return ScriptPromise::castUndefined(scriptState); | 211 return ScriptPromise::castUndefined(scriptState); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void BodyStreamBuffer::onStateChange() { | 214 void BodyStreamBuffer::onStateChange() { |
| 215 if (!m_consumer || !getExecutionContext() || | 215 if (!m_consumer || !getExecutionContext()) |
| 216 getExecutionContext()->activeDOMObjectsAreStopped()) | |
| 217 return; | 216 return; |
| 218 | 217 |
| 219 switch (m_consumer->getPublicState()) { | 218 switch (m_consumer->getPublicState()) { |
| 220 case BytesConsumer::PublicState::ReadableOrWaiting: | 219 case BytesConsumer::PublicState::ReadableOrWaiting: |
| 221 break; | 220 break; |
| 222 case BytesConsumer::PublicState::Closed: | 221 case BytesConsumer::PublicState::Closed: |
| 223 close(); | 222 close(); |
| 224 return; | 223 return; |
| 225 case BytesConsumer::PublicState::Errored: | 224 case BytesConsumer::PublicState::Errored: |
| 226 error(); | 225 error(); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 } | 378 } |
| 380 if (isErrored) | 379 if (isErrored) |
| 381 return BytesConsumer::createErrored(BytesConsumer::Error("error")); | 380 return BytesConsumer::createErrored(BytesConsumer::Error("error")); |
| 382 | 381 |
| 383 DCHECK(consumer); | 382 DCHECK(consumer); |
| 384 consumer->clearClient(); | 383 consumer->clearClient(); |
| 385 return consumer; | 384 return consumer; |
| 386 } | 385 } |
| 387 | 386 |
| 388 } // namespace blink | 387 } // namespace blink |
| OLD | NEW |