| 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/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "bindings/core/v8/V8ArrayBuffer.h" | 9 #include "bindings/core/v8/V8ArrayBuffer.h" |
| 10 #include "bindings/core/v8/V8ThrowException.h" | 10 #include "bindings/core/v8/V8ThrowException.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 Member<ScriptPromiseResolver> m_resolver; | 45 Member<ScriptPromiseResolver> m_resolver; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 class BodyBlobConsumer final : public BodyConsumerBase { | 48 class BodyBlobConsumer final : public BodyConsumerBase { |
| 49 WTF_MAKE_NONCOPYABLE(BodyBlobConsumer); | 49 WTF_MAKE_NONCOPYABLE(BodyBlobConsumer); |
| 50 public: | 50 public: |
| 51 explicit BodyBlobConsumer(ScriptPromiseResolver* resolver) : BodyConsumerBas
e(resolver) {} | 51 explicit BodyBlobConsumer(ScriptPromiseResolver* resolver) : BodyConsumerBas
e(resolver) {} |
| 52 | 52 |
| 53 void didFetchDataLoadedBlobHandle(PassRefPtr<BlobDataHandle> blobDataHandle)
override | 53 void didFetchDataLoadedBlobHandle(PassRefPtr<BlobDataHandle> blobDataHandle)
override |
| 54 { | 54 { |
| 55 resolver()->resolve(Blob::create(blobDataHandle)); | 55 resolver()->resolve(Blob::create(std::move(blobDataHandle))); |
| 56 } | 56 } |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 class BodyArrayBufferConsumer final : public BodyConsumerBase { | 59 class BodyArrayBufferConsumer final : public BodyConsumerBase { |
| 60 WTF_MAKE_NONCOPYABLE(BodyArrayBufferConsumer); | 60 WTF_MAKE_NONCOPYABLE(BodyArrayBufferConsumer); |
| 61 public: | 61 public: |
| 62 explicit BodyArrayBufferConsumer(ScriptPromiseResolver* resolver) : BodyCons
umerBase(resolver) {} | 62 explicit BodyArrayBufferConsumer(ScriptPromiseResolver* resolver) : BodyCons
umerBase(resolver) {} |
| 63 | 63 |
| 64 void didFetchDataLoadedArrayBuffer(DOMArrayBuffer* arrayBuffer) override | 64 void didFetchDataLoadedArrayBuffer(DOMArrayBuffer* arrayBuffer) override |
| 65 { | 65 { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 Body::Body(ExecutionContext* context) : ActiveScriptWrappable(this) , ContextLif
ecycleObserver(context) {} | 221 Body::Body(ExecutionContext* context) : ActiveScriptWrappable(this) , ContextLif
ecycleObserver(context) {} |
| 222 | 222 |
| 223 ScriptPromise Body::rejectInvalidConsumption(ScriptState* scriptState) | 223 ScriptPromise Body::rejectInvalidConsumption(ScriptState* scriptState) |
| 224 { | 224 { |
| 225 if (isBodyLocked() || bodyUsed()) | 225 if (isBodyLocked() || bodyUsed()) |
| 226 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "Already read")); | 226 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "Already read")); |
| 227 return ScriptPromise(); | 227 return ScriptPromise(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 } // namespace blink | 230 } // namespace blink |
| OLD | NEW |