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 13 matching lines...) Expand all Loading... |
24 class EncodedFormData; | 24 class EncodedFormData; |
25 class ScriptState; | 25 class ScriptState; |
26 | 26 |
27 class MODULES_EXPORT BodyStreamBuffer final : public UnderlyingSourceBase, publi
c UnderlyingSource, public WebDataConsumerHandle::Client { | 27 class MODULES_EXPORT BodyStreamBuffer final : public UnderlyingSourceBase, publi
c UnderlyingSource, public WebDataConsumerHandle::Client { |
28 WTF_MAKE_NONCOPYABLE(BodyStreamBuffer); | 28 WTF_MAKE_NONCOPYABLE(BodyStreamBuffer); |
29 USING_GARBAGE_COLLECTED_MIXIN(BodyStreamBuffer); | 29 USING_GARBAGE_COLLECTED_MIXIN(BodyStreamBuffer); |
30 public: | 30 public: |
31 // Needed because we have to release |m_reader| promptly. | 31 // Needed because we have to release |m_reader| promptly. |
32 EAGERLY_FINALIZE(); | 32 EAGERLY_FINALIZE(); |
33 // |handle| cannot be null and cannot be locked. | 33 // |handle| cannot be null and cannot be locked. |
| 34 // This function must be called with entering an appropriate V8 context. |
34 BodyStreamBuffer(ScriptState*, std::unique_ptr<FetchDataConsumerHandle> /* h
andle */); | 35 BodyStreamBuffer(ScriptState*, std::unique_ptr<FetchDataConsumerHandle> /* h
andle */); |
35 // |ReadableStreamOperations::isReadableStream(stream)| must hold. | 36 // |ReadableStreamOperations::isReadableStream(stream)| must hold. |
| 37 // This function must be called with entering an appropriate V8 context. |
36 BodyStreamBuffer(ScriptState*, ScriptValue stream); | 38 BodyStreamBuffer(ScriptState*, ScriptValue stream); |
37 | 39 |
38 ScriptValue stream(); | 40 ScriptValue stream(); |
39 | 41 |
40 // Callable only when neither locked nor disturbed. | 42 // Callable only when neither locked nor disturbed. |
41 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Re
ader::BlobSizePolicy); | 43 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Re
ader::BlobSizePolicy); |
42 PassRefPtr<EncodedFormData> drainAsFormData(); | 44 PassRefPtr<EncodedFormData> drainAsFormData(); |
43 void startLoading(FetchDataLoader*, FetchDataLoader::Client* /* client */); | 45 void startLoading(FetchDataLoader*, FetchDataLoader::Client* /* client */); |
44 void tee(BodyStreamBuffer**, BodyStreamBuffer**); | 46 void tee(BodyStreamBuffer**, BodyStreamBuffer**); |
45 | 47 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 Member<ReadableByteStream> m_stream; | 90 Member<ReadableByteStream> m_stream; |
89 // We need this member to keep it alive while loading. | 91 // We need this member to keep it alive while loading. |
90 Member<FetchDataLoader> m_loader; | 92 Member<FetchDataLoader> m_loader; |
91 bool m_streamNeedsMore = false; | 93 bool m_streamNeedsMore = false; |
92 bool m_madeFromReadableStream; | 94 bool m_madeFromReadableStream; |
93 }; | 95 }; |
94 | 96 |
95 } // namespace blink | 97 } // namespace blink |
96 | 98 |
97 #endif // BodyStreamBuffer_h | 99 #endif // BodyStreamBuffer_h |
OLD | NEW |