Chromium Code Reviews| 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 USING_PRE_FINALIZER(BodyStreamBuffer, stop); | |
|
sof
2016/02/19 06:17:11
This prefinalizer (and its registration) is correc
yhirano
2016/02/19 06:36:22
Sorry I don't understand EAGERLY_FINALIZE: Can you
| |
| 28 public: | 29 public: |
| 29 // |handle| cannot be null and cannot be locked. | 30 // |handle| cannot be null and cannot be locked. |
| 30 explicit BodyStreamBuffer(PassOwnPtr<FetchDataConsumerHandle> /* handle */); | 31 explicit BodyStreamBuffer(PassOwnPtr<FetchDataConsumerHandle> /* handle */); |
| 31 | 32 |
| 32 ReadableByteStream* stream() { return m_stream; } | 33 ReadableByteStream* stream() { return m_stream; } |
| 33 | 34 |
| 34 // Callable only when not locked. | 35 // Callable only when not locked. |
| 35 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Re ader::BlobSizePolicy); | 36 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Re ader::BlobSizePolicy); |
| 36 PassRefPtr<EncodedFormData> drainAsFormData(); | 37 PassRefPtr<EncodedFormData> drainAsFormData(); |
| 37 void startLoading(ExecutionContext*, FetchDataLoader*, FetchDataLoader::Clie nt* /* client */); | 38 void startLoading(ExecutionContext*, FetchDataLoader*, FetchDataLoader::Clie nt* /* client */); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 63 private: | 64 private: |
| 64 class LoaderClient; | 65 class LoaderClient; |
| 65 void close(); | 66 void close(); |
| 66 void error(); | 67 void error(); |
| 67 void processData(); | 68 void processData(); |
| 68 void endLoading(); | 69 void endLoading(); |
| 69 void stopLoading(); | 70 void stopLoading(); |
| 70 | 71 |
| 71 OwnPtr<FetchDataConsumerHandle> m_handle; | 72 OwnPtr<FetchDataConsumerHandle> m_handle; |
| 72 OwnPtr<FetchDataConsumerHandle::Reader> m_reader; | 73 OwnPtr<FetchDataConsumerHandle::Reader> m_reader; |
| 73 Member<ReadableByteStream> m_stream; | 74 const Member<ReadableByteStream> m_stream; |
|
sof
2016/02/19 06:17:11
( what's the concern? )
yhirano
2016/02/19 17:32:22
Done.
| |
| 74 // We need this member to keep it alive while loading. | 75 // We need this member to keep it alive while loading. |
| 75 Member<FetchDataLoader> m_loader; | 76 Member<FetchDataLoader> m_loader; |
| 76 bool m_streamNeedsMore; | 77 bool m_streamNeedsMore; |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 } // namespace blink | 80 } // namespace blink |
| 80 | 81 |
| 81 #endif // BodyStreamBuffer_h | 82 #endif // BodyStreamBuffer_h |
| OLD | NEW |