| 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
|
|
|