| 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 "bindings/core/v8/V8ThrowException.h" | 9 #include "bindings/core/v8/V8ThrowException.h" |
| 10 #include "core/dom/DOMArrayBuffer.h" | 10 #include "core/dom/DOMArrayBuffer.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 ScriptPromise BodyStreamBuffer::cancel(ScriptState* scriptState, | 208 ScriptPromise BodyStreamBuffer::cancel(ScriptState* scriptState, |
| 209 ScriptValue reason) { | 209 ScriptValue reason) { |
| 210 ASSERT(scriptState == m_scriptState.get()); | 210 ASSERT(scriptState == m_scriptState.get()); |
| 211 close(); | 211 close(); |
| 212 return ScriptPromise::castUndefined(scriptState); | 212 return ScriptPromise::castUndefined(scriptState); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void BodyStreamBuffer::onStateChange() { | 215 void BodyStreamBuffer::onStateChange() { |
| 216 if (!m_consumer || !getExecutionContext() || | 216 if (!m_consumer || !getExecutionContext() || |
| 217 getExecutionContext()->activeDOMObjectsAreStopped()) | 217 getExecutionContext()->isContextDestroyed()) |
| 218 return; | 218 return; |
| 219 | 219 |
| 220 switch (m_consumer->getPublicState()) { | 220 switch (m_consumer->getPublicState()) { |
| 221 case BytesConsumer::PublicState::ReadableOrWaiting: | 221 case BytesConsumer::PublicState::ReadableOrWaiting: |
| 222 break; | 222 break; |
| 223 case BytesConsumer::PublicState::Closed: | 223 case BytesConsumer::PublicState::Closed: |
| 224 close(); | 224 close(); |
| 225 return; | 225 return; |
| 226 case BytesConsumer::PublicState::Errored: | 226 case BytesConsumer::PublicState::Errored: |
| 227 error(); | 227 error(); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 } | 384 } |
| 385 if (isErrored) | 385 if (isErrored) |
| 386 return BytesConsumer::createErrored(BytesConsumer::Error("error")); | 386 return BytesConsumer::createErrored(BytesConsumer::Error("error")); |
| 387 | 387 |
| 388 DCHECK(consumer); | 388 DCHECK(consumer); |
| 389 consumer->clearClient(); | 389 consumer->clearClient(); |
| 390 return consumer; | 390 return consumer; |
| 391 } | 391 } |
| 392 | 392 |
| 393 } // namespace blink | 393 } // namespace blink |
| OLD | NEW |