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" |
11 #include "core/streams/UnderlyingSource.h" | 11 #include "core/streams/UnderlyingSource.h" |
12 #include "modules/ModulesExport.h" | 12 #include "modules/ModulesExport.h" |
13 #include "modules/fetch/FetchDataConsumerHandle.h" | 13 #include "modules/fetch/FetchDataConsumerHandle.h" |
14 #include "modules/fetch/FetchDataLoader.h" | 14 #include "modules/fetch/FetchDataLoader.h" |
15 #include "platform/heap/Handle.h" | 15 #include "platform/heap/Handle.h" |
16 #include "public/platform/WebDataConsumerHandle.h" | 16 #include "public/platform/WebDataConsumerHandle.h" |
17 #include "wtf/OwnPtr.h" | 17 #include "wtf/OwnPtr.h" |
18 #include "wtf/PassOwnPtr.h" | 18 #include "wtf/PassOwnPtr.h" |
19 | 19 |
20 namespace blink { | 20 namespace blink { |
21 | 21 |
22 class EncodedFormData; | 22 class EncodedFormData; |
23 class ExecutionContext; | 23 class ExecutionContext; |
24 | 24 |
25 class MODULES_EXPORT BodyStreamBuffer final : public GarbageCollectedFinalized<B
odyStreamBuffer>, public UnderlyingSource, public WebDataConsumerHandle::Client
{ | 25 class MODULES_EXPORT BodyStreamBuffer final : public GarbageCollectedFinalized<B
odyStreamBuffer>, public UnderlyingSource, public WebDataConsumerHandle::Client
{ |
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. |
| 29 EAGERLY_FINALIZE(); |
28 public: | 30 public: |
29 // |handle| cannot be null and cannot be locked. | 31 // |handle| cannot be null and cannot be locked. |
30 explicit BodyStreamBuffer(PassOwnPtr<FetchDataConsumerHandle> /* handle */); | 32 explicit BodyStreamBuffer(PassOwnPtr<FetchDataConsumerHandle> /* handle */); |
31 | 33 |
32 ReadableByteStream* stream() { return m_stream; } | 34 ReadableByteStream* stream() { return m_stream; } |
33 | 35 |
34 // Callable only when not locked. | 36 // Callable only when not locked. |
35 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Re
ader::BlobSizePolicy); | 37 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Re
ader::BlobSizePolicy); |
36 PassRefPtr<EncodedFormData> drainAsFormData(); | 38 PassRefPtr<EncodedFormData> drainAsFormData(); |
37 void startLoading(ExecutionContext*, FetchDataLoader*, FetchDataLoader::Clie
nt* /* client */); | 39 void startLoading(ExecutionContext*, FetchDataLoader*, FetchDataLoader::Clie
nt* /* client */); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 OwnPtr<FetchDataConsumerHandle::Reader> m_reader; | 74 OwnPtr<FetchDataConsumerHandle::Reader> m_reader; |
73 Member<ReadableByteStream> m_stream; | 75 Member<ReadableByteStream> m_stream; |
74 // We need this member to keep it alive while loading. | 76 // We need this member to keep it alive while loading. |
75 Member<FetchDataLoader> m_loader; | 77 Member<FetchDataLoader> m_loader; |
76 bool m_streamNeedsMore; | 78 bool m_streamNeedsMore; |
77 }; | 79 }; |
78 | 80 |
79 } // namespace blink | 81 } // namespace blink |
80 | 82 |
81 #endif // BodyStreamBuffer_h | 83 #endif // BodyStreamBuffer_h |
OLD | NEW |