Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: Source/modules/fetch/FetchFormDataConsumerHandle.h

Issue 1265413002: Introduce FetchFormDataConsumerHandle. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/fetch/FetchFormDataConsumerHandle.h
diff --git a/Source/modules/fetch/FetchFormDataConsumerHandle.h b/Source/modules/fetch/FetchFormDataConsumerHandle.h
new file mode 100644
index 0000000000000000000000000000000000000000..1ad3e1353cdb2885ed8571d7cbb33bc08158b3e3
--- /dev/null
+++ b/Source/modules/fetch/FetchFormDataConsumerHandle.h
@@ -0,0 +1,57 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef FetchFormDataConsumerHandle_h
+#define FetchFormDataConsumerHandle_h
+
+#include "modules/ModulesExport.h"
+#include "modules/fetch/FetchBlobDataConsumerHandle.h"
+#include "modules/fetch/FetchDataConsumerHandle.h"
+#include "wtf/Forward.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+
+namespace blink {
+
+class DOMArrayBuffer;
+class ExecutionContext;
+class FormData;
+
+// FetchFormDataConsumerHandle is a handle made from a FormData. It provides
+// drainAsFormData in the associated Reader.
+class MODULES_EXPORT FetchFormDataConsumerHandle final : public FetchDataConsumerHandle {
+ WTF_MAKE_NONCOPYABLE(FetchFormDataConsumerHandle);
+public:
+ static PassOwnPtr<FetchDataConsumerHandle> create(const String& body) { return adoptPtr(new FetchFormDataConsumerHandle(body)); }
+ static PassOwnPtr<FetchDataConsumerHandle> create(PassRefPtr<DOMArrayBuffer> body) { return adoptPtr(new FetchFormDataConsumerHandle(body)); }
+ static PassOwnPtr<FetchDataConsumerHandle> create(ExecutionContext* executionContext, PassRefPtr<FormData> body) { return adoptPtr(new FetchFormDataConsumerHandle(executionContext, body)); }
+ // Use FetchBlobDataConsumerHandle for blobs.
+
+ ~FetchFormDataConsumerHandle() override;
+
+ static PassOwnPtr<FetchDataConsumerHandle> createForTest(ExecutionContext* executionContext,
+ PassRefPtr<FormData> body,
+ FetchBlobDataConsumerHandle::LoaderFactory* loaderFactory)
+ {
+ return adoptPtr(new FetchFormDataConsumerHandle(executionContext, body, loaderFactory));
+ }
+
+private:
+ class Context;
+ class ReaderImpl;
+ explicit FetchFormDataConsumerHandle(const String& body);
+ explicit FetchFormDataConsumerHandle(const PassRefPtr<DOMArrayBuffer> body);
+ FetchFormDataConsumerHandle(ExecutionContext*, const PassRefPtr<FormData> body, FetchBlobDataConsumerHandle::LoaderFactory* = nullptr);
+
+ Reader* obtainReaderInternal(Client*) override;
+
+ const char* debugName() const override { return "FetchFormDataConsumerHandle"; }
+
+ RefPtr<Context> m_context;
+};
+
+} // namespace blink
+
+#endif // FetchFormDataConsumerHandle_h

Powered by Google App Engine
This is Rietveld 408576698