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 "modules/fetch/Body.h" | 6 #include "modules/fetch/Body.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 visitor->trace(m_stream); | 134 visitor->trace(m_stream); |
135 BodyStreamBuffer::Observer::trace(visitor); | 135 BodyStreamBuffer::Observer::trace(visitor); |
136 UnderlyingSource::trace(visitor); | 136 UnderlyingSource::trace(visitor); |
137 } | 137 } |
138 | 138 |
139 private: | 139 private: |
140 // UnderlyingSource functions. | 140 // UnderlyingSource functions. |
141 void pullSource() override { } | 141 void pullSource() override { } |
142 ScriptPromise cancelSource(ScriptState* scriptState, ScriptValue reason) ove rride | 142 ScriptPromise cancelSource(ScriptState* scriptState, ScriptValue reason) ove rride |
143 { | 143 { |
144 return ScriptPromise(); | 144 close(); |
145 m_bodyStreamBuffer->unregisterObserver(); | |
146 return ScriptPromise::cast(scriptState, v8::Undefined(scriptState->isola te())); | |
tyoshino (SeeGerritForStatus)
2015/03/23 03:57:21
which call terminates the fetch?
yhirano
2015/03/23 05:47:32
You're right, and I found implementing the cancell
| |
145 } | 147 } |
146 | 148 |
147 // BodyStreamBuffer::Observer functions. | 149 // BodyStreamBuffer::Observer functions. |
148 void onWrite() override | 150 void onWrite() override |
149 { | 151 { |
150 ASSERT(m_state == Streaming); | 152 ASSERT(m_state == Streaming); |
151 while (RefPtr<DOMArrayBuffer> buf = m_bodyStreamBuffer->read()) { | 153 while (RefPtr<DOMArrayBuffer> buf = m_bodyStreamBuffer->read()) { |
152 write(buf); | 154 write(buf); |
153 } | 155 } |
154 } | 156 } |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
483 | 485 |
484 void Body::didBlobHandleReceiveError(PassRefPtrWillBeRawPtr<DOMException> except ion) | 486 void Body::didBlobHandleReceiveError(PassRefPtrWillBeRawPtr<DOMException> except ion) |
485 { | 487 { |
486 if (!m_resolver) | 488 if (!m_resolver) |
487 return; | 489 return; |
488 m_resolver->reject(exception); | 490 m_resolver->reject(exception); |
489 m_resolver.clear(); | 491 m_resolver.clear(); |
490 } | 492 } |
491 | 493 |
492 } // namespace blink | 494 } // namespace blink |
OLD | NEW |