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

Unified Diff: Source/modules/fetch/FetchDataConsumerHandle.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/FetchDataConsumerHandle.h
diff --git a/Source/modules/fetch/FetchDataConsumerHandle.h b/Source/modules/fetch/FetchDataConsumerHandle.h
index 6f811ab5398541ab309f4cf903f72641f99b1fe8..d5da177d7e9283753fadb13a5e09d114fe88409b 100644
--- a/Source/modules/fetch/FetchDataConsumerHandle.h
+++ b/Source/modules/fetch/FetchDataConsumerHandle.h
@@ -7,6 +7,7 @@
#include "modules/ModulesExport.h"
#include "platform/blob/BlobData.h"
+#include "platform/network/FormData.h"
#include "public/platform/WebDataConsumerHandle.h"
#include "wtf/Forward.h"
#include "wtf/PassRefPtr.h"
@@ -30,16 +31,31 @@ public:
AllowBlobWithInvalidSize
};
+ // The following "draining" functions drain and return the data. They
+ // can return null when it is impossible to drain, and in such cases the
+ // operation is no-op.
+ // When they return a non-null value, the data will be drained and
+ // subsequent calls of read() / beginRead() will return |Done|.
+ // Moreover subsequent calls of draining functions will return null.
+ //
+ // A draining function will return null when any data was read, i.e.
+ // read() / bedingRead() was called or any draining functions returned
+ // a non-null value. There is one exception: when read() is called
+ // with zero |size| and its return value is Ok or ShouldWait, no data
+ // is regarded as read.
+
// Drains the data as a BlobDataHandle.
- // If this function returns non-null BlobDataHandle:
- // - The bytes that will be read from the returned BlobDataHandle
- // must be idential to the bytes that would be read through
- // WebDataConsumerHandle::Reader APIs without calling this function.
- // - Subsequent calls to read() / beginRead() return |Done|.
- // This function can return |nullptr|, and in such cases this
- // function is no-op.
- // This function returns |nullptr| when called during two-phase read.
+ // The returned non-null blob handle contains bytes that would be read
+ // through WebDataConsumerHandle::Reader APIs without calling this
+ // function.
+ // When |policy| is DisallowBlobWithInvalidSize, this function doesn't
+ // return a non-null blob handle with unspecified size.
virtual PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(BlobSizePolicy = DisallowBlobWithInvalidSize) { return nullptr; }
+
+ // Drains the data as a FormData.
+ // This function returns a non-null form data when the handle is made
+ // from a FormData-convertible value.
+ virtual PassRefPtr<FormData> drainAsFormData() { return nullptr; }
};
// TODO(yhirano): obtainReader() is currently non-virtual override, and
« no previous file with comments | « Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp ('k') | Source/modules/fetch/FetchFormDataConsumerHandle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698