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 "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
9 #include "core/streams/ReadableByteStream.h" | 9 #include "core/streams/ReadableByteStream.h" |
10 #include "core/streams/ReadableByteStreamReader.h" | 10 #include "core/streams/ReadableByteStreamReader.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 WTF_MAKE_NONCOPYABLE(BodyStreamBuffer); | 26 WTF_MAKE_NONCOPYABLE(BodyStreamBuffer); |
27 USING_GARBAGE_COLLECTED_MIXIN(BodyStreamBuffer); | 27 USING_GARBAGE_COLLECTED_MIXIN(BodyStreamBuffer); |
28 // Needed because we have to release |m_reader| promptly. | 28 // Needed because we have to release |m_reader| promptly. |
29 EAGERLY_FINALIZE(); | 29 EAGERLY_FINALIZE(); |
30 public: | 30 public: |
31 // |handle| cannot be null and cannot be locked. | 31 // |handle| cannot be null and cannot be locked. |
32 explicit BodyStreamBuffer(PassOwnPtr<FetchDataConsumerHandle> /* handle */); | 32 explicit BodyStreamBuffer(PassOwnPtr<FetchDataConsumerHandle> /* handle */); |
33 | 33 |
34 ReadableByteStream* stream() { return m_stream; } | 34 ReadableByteStream* stream() { return m_stream; } |
35 | 35 |
36 // Callable only when not locked. | 36 // Callable only when neither locked nor disturbed. |
37 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Re
ader::BlobSizePolicy); | 37 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(ExecutionContext*, FetchDat
aConsumerHandle::Reader::BlobSizePolicy); |
38 PassRefPtr<EncodedFormData> drainAsFormData(); | 38 PassRefPtr<EncodedFormData> drainAsFormData(ExecutionContext*); |
39 void startLoading(ExecutionContext*, FetchDataLoader*, FetchDataLoader::Clie
nt* /* client */); | 39 void startLoading(ExecutionContext*, FetchDataLoader*, FetchDataLoader::Clie
nt* /* client */); |
40 | 40 |
41 // Callable only when not locked. Returns a non-null handle. | 41 // Callable only when not locked. Returns a non-null handle. |
42 // There is no means to "return" the handle to the body buffer: Calling | 42 // There is no means to "return" the handle to the body buffer: Calling |
43 // this function locks, disturbs and closes the stream and no one will | 43 // this function locks, disturbs and closes the stream and no one will |
44 // not be able to get any information from the stream and this buffer after | 44 // not be able to get any information from the stream and this buffer after |
45 // that. | 45 // that. |
46 PassOwnPtr<FetchDataConsumerHandle> releaseHandle(ExecutionContext*); | 46 PassOwnPtr<FetchDataConsumerHandle> releaseHandle(ExecutionContext*); |
47 | 47 |
48 bool hasPendingActivity() const; | 48 bool hasPendingActivity() const; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 OwnPtr<FetchDataConsumerHandle::Reader> m_reader; | 80 OwnPtr<FetchDataConsumerHandle::Reader> m_reader; |
81 Member<ReadableByteStream> m_stream; | 81 Member<ReadableByteStream> m_stream; |
82 // We need this member to keep it alive while loading. | 82 // We need this member to keep it alive while loading. |
83 Member<FetchDataLoader> m_loader; | 83 Member<FetchDataLoader> m_loader; |
84 bool m_streamNeedsMore; | 84 bool m_streamNeedsMore; |
85 }; | 85 }; |
86 | 86 |
87 } // namespace blink | 87 } // namespace blink |
88 | 88 |
89 #endif // BodyStreamBuffer_h | 89 #endif // BodyStreamBuffer_h |
OLD | NEW |