| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 m_state = Streaming; | 184 m_state = Streaming; |
| 185 if (m_bodyStreamBuffer) { | 185 if (m_bodyStreamBuffer) { |
| 186 m_bodyStreamBuffer->registerObserver(this); | 186 m_bodyStreamBuffer->registerObserver(this); |
| 187 onWrite(); | 187 onWrite(); |
| 188 if (m_bodyStreamBuffer->hasError()) | 188 if (m_bodyStreamBuffer->hasError()) |
| 189 return onError(); | 189 return onError(); |
| 190 if (m_bodyStreamBuffer->isClosed()) | 190 if (m_bodyStreamBuffer->isClosed()) |
| 191 return onClose(); | 191 return onClose(); |
| 192 } else { | 192 } else { |
| 193 FileReaderLoader::ReadType readType = FileReaderLoader::ReadAsAr
rayBuffer; | 193 FileReaderLoader::ReadType readType = FileReaderLoader::ReadAsAr
rayBuffer; |
| 194 m_loader = adoptPtr(new FileReaderLoader(readType, this)); | 194 m_loader = FileReaderLoader::create(readType, this); |
| 195 m_loader->start(executionContext(), m_blobDataHandle); | 195 m_loader->start(executionContext(), m_blobDataHandle); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| 200 ScriptPromise cancelSource(ScriptState* scriptState, ScriptValue reason) ove
rride | 200 ScriptPromise cancelSource(ScriptState* scriptState, ScriptValue reason) ove
rride |
| 201 { | 201 { |
| 202 cancel(); | 202 cancel(); |
| 203 return ScriptPromise::cast(scriptState, v8::Undefined(scriptState->isola
te())); | 203 return ScriptPromise::cast(scriptState, v8::Undefined(scriptState->isola
te())); |
| 204 } | 204 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 // FIXME: Implement this. | 384 // FIXME: Implement this. |
| 385 ASSERT_NOT_REACHED(); | 385 ASSERT_NOT_REACHED(); |
| 386 break; | 386 break; |
| 387 case ResponseAsJSON: | 387 case ResponseAsJSON: |
| 388 case ResponseAsText: | 388 case ResponseAsText: |
| 389 break; | 389 break; |
| 390 default: | 390 default: |
| 391 ASSERT_NOT_REACHED(); | 391 ASSERT_NOT_REACHED(); |
| 392 } | 392 } |
| 393 | 393 |
| 394 m_loader = adoptPtr(new FileReaderLoader(readType, this)); | 394 m_loader = FileReaderLoader::create(readType, this); |
| 395 m_loader->start(m_resolver->scriptState()->executionContext(), blobHandle); | 395 m_loader->start(m_resolver->scriptState()->executionContext(), blobHandle); |
| 396 | 396 |
| 397 return; | 397 return; |
| 398 } | 398 } |
| 399 | 399 |
| 400 ScriptPromise Body::arrayBuffer(ScriptState* scriptState) | 400 ScriptPromise Body::arrayBuffer(ScriptState* scriptState) |
| 401 { | 401 { |
| 402 return readAsync(scriptState, ResponseAsArrayBuffer); | 402 return readAsync(scriptState, ResponseAsArrayBuffer); |
| 403 } | 403 } |
| 404 | 404 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 void Body::didBlobHandleReceiveError(DOMException* exception) | 588 void Body::didBlobHandleReceiveError(DOMException* exception) |
| 589 { | 589 { |
| 590 if (!m_resolver) | 590 if (!m_resolver) |
| 591 return; | 591 return; |
| 592 m_streamSource->error(); | 592 m_streamSource->error(); |
| 593 m_resolver->reject(exception); | 593 m_resolver->reject(exception); |
| 594 m_resolver.clear(); | 594 m_resolver.clear(); |
| 595 } | 595 } |
| 596 | 596 |
| 597 } // namespace blink | 597 } // namespace blink |
| OLD | NEW |