Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h

Issue 1899163002: BodyStreamBuffer's drainAs* function should lock stream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@body-stream-buffer-test-refactoring
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698