| 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 BodyStreamBuffer_h | 5 #ifndef BodyStreamBuffer_h |
| 6 #define BodyStreamBuffer_h | 6 #define BodyStreamBuffer_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class ScriptState; | 26 class ScriptState; |
| 27 | 27 |
| 28 class MODULES_EXPORT BodyStreamBuffer final : public UnderlyingSourceBase, publi
c UnderlyingSource, public WebDataConsumerHandle::Client { | 28 class MODULES_EXPORT BodyStreamBuffer final : public UnderlyingSourceBase, publi
c UnderlyingSource, public WebDataConsumerHandle::Client { |
| 29 WTF_MAKE_NONCOPYABLE(BodyStreamBuffer); | 29 WTF_MAKE_NONCOPYABLE(BodyStreamBuffer); |
| 30 USING_GARBAGE_COLLECTED_MIXIN(BodyStreamBuffer); | 30 USING_GARBAGE_COLLECTED_MIXIN(BodyStreamBuffer); |
| 31 public: | 31 public: |
| 32 // Needed because we have to release |m_reader| promptly. | 32 // Needed because we have to release |m_reader| promptly. |
| 33 EAGERLY_FINALIZE(); | 33 EAGERLY_FINALIZE(); |
| 34 // |handle| cannot be null and cannot be locked. | 34 // |handle| cannot be null and cannot be locked. |
| 35 BodyStreamBuffer(ScriptState*, PassOwnPtr<FetchDataConsumerHandle> /* handle
*/); | 35 BodyStreamBuffer(ScriptState*, PassOwnPtr<FetchDataConsumerHandle> /* handle
*/); |
| 36 // |ReadableStreamOperations::isReadableStream(stream)| must hold. |
| 37 BodyStreamBuffer(ScriptState*, ScriptValue stream); |
| 36 | 38 |
| 37 ScriptValue stream(); | 39 ScriptValue stream(); |
| 38 | 40 |
| 39 // Callable only when neither locked nor disturbed. | 41 // Callable only when neither locked nor disturbed. |
| 40 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Re
ader::BlobSizePolicy); | 42 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Re
ader::BlobSizePolicy); |
| 41 PassRefPtr<EncodedFormData> drainAsFormData(); | 43 PassRefPtr<EncodedFormData> drainAsFormData(); |
| 42 void startLoading(FetchDataLoader*, FetchDataLoader::Client* /* client */); | 44 void startLoading(FetchDataLoader*, FetchDataLoader::Client* /* client */); |
| 43 | 45 |
| 44 // Callable only when not locked. Returns a non-null handle. | 46 // Callable only when not locked. Returns a non-null handle. |
| 45 // There is no means to "return" the handle to the body buffer: Calling | 47 // There is no means to "return" the handle to the body buffer: Calling |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 void endLoading(); | 87 void endLoading(); |
| 86 void stopLoading(); | 88 void stopLoading(); |
| 87 | 89 |
| 88 RefPtr<ScriptState> m_scriptState; | 90 RefPtr<ScriptState> m_scriptState; |
| 89 OwnPtr<FetchDataConsumerHandle> m_handle; | 91 OwnPtr<FetchDataConsumerHandle> m_handle; |
| 90 OwnPtr<FetchDataConsumerHandle::Reader> m_reader; | 92 OwnPtr<FetchDataConsumerHandle::Reader> m_reader; |
| 91 Member<ReadableByteStream> m_stream; | 93 Member<ReadableByteStream> m_stream; |
| 92 // We need this member to keep it alive while loading. | 94 // We need this member to keep it alive while loading. |
| 93 Member<FetchDataLoader> m_loader; | 95 Member<FetchDataLoader> m_loader; |
| 94 bool m_streamNeedsMore = false; | 96 bool m_streamNeedsMore = false; |
| 97 bool m_madeFromReadableStream; |
| 95 }; | 98 }; |
| 96 | 99 |
| 97 } // namespace blink | 100 } // namespace blink |
| 98 | 101 |
| 99 #endif // BodyStreamBuffer_h | 102 #endif // BodyStreamBuffer_h |
| OLD | NEW |