| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 | 63 |
| 64 DEFINE_INLINE_TRACE() { | 64 DEFINE_INLINE_TRACE() { |
| 65 visitor->trace(m_buffer); | 65 visitor->trace(m_buffer); |
| 66 visitor->trace(m_client); | 66 visitor->trace(m_client); |
| 67 ContextLifecycleObserver::trace(visitor); | 67 ContextLifecycleObserver::trace(visitor); |
| 68 FetchDataLoader::Client::trace(visitor); | 68 FetchDataLoader::Client::trace(visitor); |
| 69 } | 69 } |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 void contextDestroyed() override { m_buffer->stopLoading(); } | 72 void contextDestroyed(ExecutionContext*) override { m_buffer->stopLoading(); } |
| 73 | 73 |
| 74 Member<BodyStreamBuffer> m_buffer; | 74 Member<BodyStreamBuffer> m_buffer; |
| 75 Member<FetchDataLoader::Client> m_client; | 75 Member<FetchDataLoader::Client> m_client; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, | 78 BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, |
| 79 BytesConsumer* consumer) | 79 BytesConsumer* consumer) |
| 80 : UnderlyingSourceBase(scriptState), | 80 : UnderlyingSourceBase(scriptState), |
| 81 m_scriptState(scriptState), | 81 m_scriptState(scriptState), |
| 82 m_consumer(consumer), | 82 m_consumer(consumer), |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 } | 229 } |
| 230 processData(); | 230 processData(); |
| 231 } | 231 } |
| 232 | 232 |
| 233 bool BodyStreamBuffer::hasPendingActivity() const { | 233 bool BodyStreamBuffer::hasPendingActivity() const { |
| 234 if (m_loader) | 234 if (m_loader) |
| 235 return true; | 235 return true; |
| 236 return UnderlyingSourceBase::hasPendingActivity(); | 236 return UnderlyingSourceBase::hasPendingActivity(); |
| 237 } | 237 } |
| 238 | 238 |
| 239 void BodyStreamBuffer::contextDestroyed() { | 239 void BodyStreamBuffer::contextDestroyed(ExecutionContext* destroyedContext) { |
| 240 cancelConsumer(); | 240 cancelConsumer(); |
| 241 UnderlyingSourceBase::contextDestroyed(); | 241 UnderlyingSourceBase::contextDestroyed(destroyedContext); |
| 242 } | 242 } |
| 243 | 243 |
| 244 bool BodyStreamBuffer::isStreamReadable() { | 244 bool BodyStreamBuffer::isStreamReadable() { |
| 245 ScriptState::Scope scope(m_scriptState.get()); | 245 ScriptState::Scope scope(m_scriptState.get()); |
| 246 return ReadableStreamOperations::isReadable(m_scriptState.get(), stream()); | 246 return ReadableStreamOperations::isReadable(m_scriptState.get(), stream()); |
| 247 } | 247 } |
| 248 | 248 |
| 249 bool BodyStreamBuffer::isStreamClosed() { | 249 bool BodyStreamBuffer::isStreamClosed() { |
| 250 ScriptState::Scope scope(m_scriptState.get()); | 250 ScriptState::Scope scope(m_scriptState.get()); |
| 251 return ReadableStreamOperations::isClosed(m_scriptState.get(), stream()); | 251 return ReadableStreamOperations::isClosed(m_scriptState.get(), stream()); |
| (...skipping 132 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 |