| 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/Body.h" | 5 #include "modules/fetch/Body.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/V8ArrayBuffer.h" | 10 #include "bindings/core/v8/V8ArrayBuffer.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 { | 59 { |
| 60 resolver()->resolve(Blob::create(blobDataHandle)); | 60 resolver()->resolve(Blob::create(blobDataHandle)); |
| 61 } | 61 } |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 class BodyArrayBufferConsumer final : public BodyConsumerBase { | 64 class BodyArrayBufferConsumer final : public BodyConsumerBase { |
| 65 WTF_MAKE_NONCOPYABLE(BodyArrayBufferConsumer); | 65 WTF_MAKE_NONCOPYABLE(BodyArrayBufferConsumer); |
| 66 public: | 66 public: |
| 67 explicit BodyArrayBufferConsumer(ScriptPromiseResolver* resolver) : BodyCons
umerBase(resolver) {} | 67 explicit BodyArrayBufferConsumer(ScriptPromiseResolver* resolver) : BodyCons
umerBase(resolver) {} |
| 68 | 68 |
| 69 void didFetchDataLoadedArrayBuffer(DOMArrayBuffer* arrayBuffer) override | 69 void didFetchDataLoadedArrayBuffer(PassRefPtr<DOMArrayBuffer> arrayBuffer) o
verride |
| 70 { | 70 { |
| 71 resolver()->resolve(arrayBuffer); | 71 resolver()->resolve(arrayBuffer); |
| 72 } | 72 } |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 class BodyTextConsumer final : public BodyConsumerBase { | 75 class BodyTextConsumer final : public BodyConsumerBase { |
| 76 WTF_MAKE_NONCOPYABLE(BodyTextConsumer); | 76 WTF_MAKE_NONCOPYABLE(BodyTextConsumer); |
| 77 public: | 77 public: |
| 78 explicit BodyTextConsumer(ScriptPromiseResolver* resolver) : BodyConsumerBas
e(resolver) {} | 78 explicit BodyTextConsumer(ScriptPromiseResolver* resolver) : BodyConsumerBas
e(resolver) {} |
| 79 | 79 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 } | 295 } |
| 296 | 296 |
| 297 ScriptPromise Body::rejectInvalidConsumption(ScriptState* scriptState) | 297 ScriptPromise Body::rejectInvalidConsumption(ScriptState* scriptState) |
| 298 { | 298 { |
| 299 if (isBodyLocked() || bodyUsed()) | 299 if (isBodyLocked() || bodyUsed()) |
| 300 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "Already read")); | 300 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "Already read")); |
| 301 return ScriptPromise(); | 301 return ScriptPromise(); |
| 302 } | 302 } |
| 303 | 303 |
| 304 } // namespace blink | 304 } // namespace blink |
| OLD | NEW |