| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef Body_h | 5 #ifndef Body_h |
| 6 #define Body_h | 6 #define Body_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Sets |m_stream| to a newly created stream from |buffer|. | 74 // Sets |m_stream| to a newly created stream from |buffer|. |
| 75 // |buffer| can be null. | 75 // |buffer| can be null. |
| 76 // This is called when the underlying buffer is set/modified. | 76 // This is called when the underlying buffer is set/modified. |
| 77 // TODO(hiroshige): Merge FetchRequest/ResponseData::buffer() and | 77 // TODO(hiroshige): Merge FetchRequest/ResponseData::buffer() and |
| 78 // integrate Body::setBody(), Request/Response::refreshBody(), | 78 // integrate Body::setBody(), Request/Response::refreshBody(), |
| 79 // FetchRequestData::setBuffer() and | 79 // FetchRequestData::setBuffer() and |
| 80 // FetchResponseData::replaceBodyStreamBuffer(). | 80 // FetchResponseData::replaceBodyStreamBuffer(). |
| 81 void setBody(BodyStreamBuffer* /* buffer */); | 81 void setBody(BodyStreamBuffer* /* buffer */); |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 void pullSource(); | |
| 85 void readAllFromStream(); | |
| 86 ScriptPromise readAsync(ScriptState*, ResponseType); | 84 ScriptPromise readAsync(ScriptState*, ResponseType); |
| 87 void resolveWithEmptyDataSynchronously(); | 85 void resolveWithEmptyDataSynchronously(); |
| 88 void readAsyncFromDrainingBodyStreamBuffer(PassOwnPtr<DrainingBodyStreamBuff
er>, const String& mimeType); | 86 void readAsyncFromDrainingBodyStreamBuffer(PassOwnPtr<DrainingBodyStreamBuff
er>, const String& mimeType); |
| 89 void resolveJSON(const String&); | 87 void resolveJSON(const String&); |
| 90 | 88 |
| 91 void didFetchDataLoadFinishedFromDrainingStream(); | 89 void didFetchDataLoadFinishedFromDrainingStream(); |
| 92 | 90 |
| 93 // FetchDataLoader::Client functions. | 91 // FetchDataLoader::Client functions. |
| 94 void didFetchDataLoadFailed() override; | 92 void didFetchDataLoadFailed() override; |
| 95 void didFetchDataLoadedBlobHandle(PassRefPtr<BlobDataHandle>) override; | 93 void didFetchDataLoadedBlobHandle(PassRefPtr<BlobDataHandle>) override; |
| 96 void didFetchDataLoadedArrayBuffer(PassRefPtr<DOMArrayBuffer>) override; | 94 void didFetchDataLoadedArrayBuffer(PassRefPtr<DOMArrayBuffer>) override; |
| 97 void didFetchDataLoadedString(const String&) override; | 95 void didFetchDataLoadedString(const String&) override; |
| 98 | 96 |
| 99 virtual String mimeType() const = 0; | 97 virtual String mimeType() const = 0; |
| 100 | 98 |
| 101 bool m_bodyUsed; | 99 bool m_bodyUsed; |
| 102 ResponseType m_responseType; | 100 ResponseType m_responseType; |
| 103 RefPtrWillBeMember<ScriptPromiseResolver> m_resolver; | 101 RefPtrWillBeMember<ScriptPromiseResolver> m_resolver; |
| 104 Member<ReadableStreamSource> m_streamSource; | 102 Member<ReadableStreamSource> m_streamSource; |
| 105 Member<ReadableByteStream> m_stream; | 103 Member<ReadableByteStream> m_stream; |
| 106 }; | 104 }; |
| 107 | 105 |
| 108 } // namespace blink | 106 } // namespace blink |
| 109 | 107 |
| 110 #endif // Body_h | 108 #endif // Body_h |
| OLD | NEW |