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

Unified Diff: third_party/WebKit/Source/modules/fetch/Body.h

Issue 1418813004: [Fetch API] Reflect spec changes of bodyUsed property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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: third_party/WebKit/Source/modules/fetch/Body.h
diff --git a/third_party/WebKit/Source/modules/fetch/Body.h b/third_party/WebKit/Source/modules/fetch/Body.h
index 1577ecd3f494cf2dd28145773a362a8d84f22b44..c13da67bedcfedf0a9b5a8264ba437b62596405c 100644
--- a/third_party/WebKit/Source/modules/fetch/Body.h
+++ b/third_party/WebKit/Source/modules/fetch/Body.h
@@ -19,6 +19,13 @@ class ExecutionContext;
class ReadableByteStream;
class ScriptState;
+// This class represents Body mix-in defined in the fetch spec
+// https://fetch.spec.whatwg.org/#body-mixin.
+//
+// Note: This class has body stream and its predicate whereas in the current
+// spec only Response has it and Request has a byte stream defined in the
+// Encoding spec. The spec should be fixed shortly to be aligned with this
+// implementation.
class MODULES_EXPORT Body
: public GarbageCollectedFinalized<Body>
, public ScriptWrappable
@@ -35,12 +42,12 @@ public:
ScriptPromise formData(ScriptState*);
ScriptPromise json(ScriptState*);
ScriptPromise text(ScriptState*);
- ReadableByteStream* body();
+ ReadableByteStream* bodyWithUseCounter();
virtual BodyStreamBuffer* bodyBuffer() = 0;
virtual const BodyStreamBuffer* bodyBuffer() const = 0;
- bool bodyUsed();
- void setBodyPassed() { m_bodyPassed = true; }
+ virtual bool bodyUsed();
+ bool isBodyLocked();
// ActiveDOMObject override.
bool hasPendingActivity() const override;
@@ -55,15 +62,15 @@ public:
bool opaque() const { return m_opaque; }
private:
+ ReadableByteStream* body();
virtual String mimeType() const = 0;
- // Body consumption algorithms will reject with a TypeError in a number of error
- // conditions. This method wraps those up into one call which returns an empty
- // ScriptPromise if the consumption may proceed, and a ScriptPromise rejected with
- // a TypeError if it ought to be blocked.
+ // Body consumption algorithms will reject with a TypeError in a number of
+ // error conditions. This method wraps those up into one call which returns
+ // an empty ScriptPromise if the consumption may proceed, and a
+ // ScriptPromise rejected with a TypeError if it ought to be blocked.
ScriptPromise rejectInvalidConsumption(ScriptState*);
- bool m_bodyPassed;
bool m_opaque;
};
« no previous file with comments | « third_party/WebKit/Source/modules/cachestorage/Cache.cpp ('k') | third_party/WebKit/Source/modules/fetch/Body.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698