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

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

Issue 1233573002: [Fetch API] Remove DrainingBuffer. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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
« no previous file with comments | « Source/modules/cachestorage/Cache.cpp ('k') | Source/modules/fetch/Body.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/fetch/Body.h
diff --git a/Source/modules/fetch/Body.h b/Source/modules/fetch/Body.h
index 1a0663edc9e6d0693495d7bba618cfb85d12614e..1e9ee5374eb14ee5d5a8cdba5b51b8c763dc7da7 100644
--- a/Source/modules/fetch/Body.h
+++ b/Source/modules/fetch/Body.h
@@ -6,48 +6,27 @@
#define Body_h
#include "bindings/core/v8/ScriptPromise.h"
-#include "bindings/core/v8/ScriptPromiseResolver.h"
#include "bindings/core/v8/ScriptWrappable.h"
#include "core/dom/ActiveDOMObject.h"
-#include "core/dom/DOMArrayBuffer.h"
#include "modules/ModulesExport.h"
-#include "modules/fetch/FetchDataConsumerHandle.h"
-#include "modules/fetch/FetchDataLoader.h"
-#include "platform/blob/BlobData.h"
#include "platform/heap/Handle.h"
-#include "wtf/RefPtr.h"
+#include "wtf/text/WTFString.h"
namespace blink {
class BodyStreamBuffer;
-class DrainingBodyStreamBuffer;
-class BodyStreamSource;
-class DOMException;
+class ExecutionContext;
class ReadableByteStream;
class ScriptState;
class MODULES_EXPORT Body
: public GarbageCollectedFinalized<Body>
, public ScriptWrappable
- , public ActiveDOMObject
- , public FetchDataLoader::Client {
+ , public ActiveDOMObject {
+ WTF_MAKE_NONCOPYABLE(Body);
DEFINE_WRAPPERTYPEINFO();
- USING_GARBAGE_COLLECTED_MIXIN(Body);
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Body);
public:
- class ReadableStreamSource;
- enum ResponseType {
- ResponseUnknown,
- ResponseAsArrayBuffer,
- ResponseAsBlob,
- ResponseAsFormData,
- ResponseAsJSON,
- ResponseAsText
- };
- enum LockBodyOption {
- LockBodyOptionNone,
- // Setting "body passed" flag in addition to acquiring a lock.
- PassBody,
- };
explicit Body(ExecutionContext*);
~Body() override { }
@@ -57,50 +36,24 @@ public:
ScriptPromise json(ScriptState*);
ScriptPromise text(ScriptState*);
ReadableByteStream* body();
+ virtual BodyStreamBuffer* bodyBuffer() = 0;
+ virtual const BodyStreamBuffer* bodyBuffer() const = 0;
- bool bodyUsed() const;
- void lockBody(LockBodyOption = LockBodyOptionNone);
-
- // Creates a DrainingBodyStreamBuffer to access body data.
- // Returns nullptr if underlying BodyStreamBuffer is null.
- PassOwnPtr<DrainingBodyStreamBuffer> createDrainingStream();
+ bool bodyUsed();
+ void setBodyPassed() { m_bodyPassed = true; }
// ActiveDOMObject override.
bool hasPendingActivity() const override;
- DECLARE_VIRTUAL_TRACE();
-
-protected:
- // Sets |m_stream| to a newly created stream from |buffer|.
- // |buffer| can be null.
- // This is called when the underlying buffer is set/modified.
- // TODO(hiroshige): Merge FetchRequest/ResponseData::buffer() and
- // integrate Body::setBody(), Request/Response::refreshBody(),
- // FetchRequestData::setBuffer() and
- // FetchResponseData::replaceBodyStreamBuffer().
- void setBody(BodyStreamBuffer* /* buffer */);
+ DEFINE_INLINE_VIRTUAL_TRACE()
+ {
+ ActiveDOMObject::trace(visitor);
+ }
private:
- ScriptPromise readAsync(ScriptState*, ResponseType);
- void resolveWithEmptyDataSynchronously();
- void readAsyncFromDrainingBodyStreamBuffer(PassOwnPtr<DrainingBodyStreamBuffer>, const String& mimeType);
- void resolveJSON(const String&);
-
- void didFetchDataLoadFinishedFromDrainingStream();
-
- // FetchDataLoader::Client functions.
- void didFetchDataLoadFailed() override;
- void didFetchDataLoadedBlobHandle(PassRefPtr<BlobDataHandle>) override;
- void didFetchDataLoadedArrayBuffer(PassRefPtr<DOMArrayBuffer>) override;
- void didFetchDataLoadedString(const String&) override;
-
virtual String mimeType() const = 0;
- bool m_bodyUsed;
- ResponseType m_responseType;
- RefPtrWillBeMember<ScriptPromiseResolver> m_resolver;
- Member<ReadableStreamSource> m_streamSource;
- Member<ReadableByteStream> m_stream;
+ bool m_bodyPassed;
};
} // namespace blink
« no previous file with comments | « Source/modules/cachestorage/Cache.cpp ('k') | Source/modules/fetch/Body.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698