| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef FetchFormDataConsumerHandle_h | |
| 6 #define FetchFormDataConsumerHandle_h | |
| 7 | |
| 8 #include "core/dom/DOMArrayBuffer.h" | |
| 9 #include "core/dom/DOMArrayBufferView.h" | |
| 10 #include "modules/ModulesExport.h" | |
| 11 #include "modules/fetch/FetchBlobDataConsumerHandle.h" | |
| 12 #include "modules/fetch/FetchDataConsumerHandle.h" | |
| 13 #include "platform/blob/BlobData.h" | |
| 14 #include "platform/network/EncodedFormData.h" | |
| 15 #include "wtf/Forward.h" | |
| 16 #include "wtf/PassRefPtr.h" | |
| 17 #include "wtf/RefPtr.h" | |
| 18 #include "wtf/ThreadSafeRefCounted.h" | |
| 19 #include <memory> | |
| 20 | |
| 21 namespace blink { | |
| 22 | |
| 23 class ExecutionContext; | |
| 24 | |
| 25 // FetchFormDataConsumerHandle is a handle made from an EncodedFormData. It | |
| 26 // provides drainAsFormData in the associated Reader. | |
| 27 class MODULES_EXPORT FetchFormDataConsumerHandle final : public FetchDataConsume
rHandle { | |
| 28 WTF_MAKE_NONCOPYABLE(FetchFormDataConsumerHandle); | |
| 29 public: | |
| 30 static std::unique_ptr<FetchDataConsumerHandle> create(const String& body); | |
| 31 static std::unique_ptr<FetchDataConsumerHandle> create(DOMArrayBuffer* body)
; | |
| 32 static std::unique_ptr<FetchDataConsumerHandle> create(DOMArrayBufferView* b
ody); | |
| 33 static std::unique_ptr<FetchDataConsumerHandle> create(const void* data, siz
e_t); | |
| 34 static std::unique_ptr<FetchDataConsumerHandle> create(ExecutionContext*, Pa
ssRefPtr<EncodedFormData> body); | |
| 35 // Use FetchBlobDataConsumerHandle for blobs. | |
| 36 | |
| 37 ~FetchFormDataConsumerHandle() override; | |
| 38 | |
| 39 static std::unique_ptr<FetchDataConsumerHandle> createForTest( | |
| 40 ExecutionContext*, | |
| 41 PassRefPtr<EncodedFormData> body, | |
| 42 FetchBlobDataConsumerHandle::LoaderFactory*); | |
| 43 | |
| 44 private: | |
| 45 class Context; | |
| 46 class SimpleContext; | |
| 47 class ComplexContext; | |
| 48 class ReaderImpl; | |
| 49 | |
| 50 explicit FetchFormDataConsumerHandle(const String& body); | |
| 51 FetchFormDataConsumerHandle(const void*, size_t); | |
| 52 FetchFormDataConsumerHandle(ExecutionContext*, PassRefPtr<EncodedFormData> b
ody, FetchBlobDataConsumerHandle::LoaderFactory* = nullptr); | |
| 53 | |
| 54 std::unique_ptr<Reader> obtainFetchDataReader(Client*) override; | |
| 55 | |
| 56 const char* debugName() const override { return "FetchFormDataConsumerHandle
"; } | |
| 57 | |
| 58 RefPtr<Context> m_context; | |
| 59 }; | |
| 60 | |
| 61 } // namespace blink | |
| 62 | |
| 63 #endif // FetchFormDataConsumerHandle_h | |
| OLD | NEW |