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

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

Issue 1311923004: Rename FormData/FormDataBuilder to EncodedFormData/FormDataEncoder respectively. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update comments Created 5 years, 3 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 | Annotate | Revision Log
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"
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 ExecutionContext; 23 class ExecutionContext;
23 class FormData;
24 24
25 // A BodyStreamBuffer constructed with a null handle is said to have null body. 25 // A BodyStreamBuffer constructed with a null handle is said to have null body.
26 // One can observe if a buffer has null body by calling |hasBody| function. 26 // One can observe if a buffer has null body by calling |hasBody| function.
27 // |stream| function returns a non-null stream even when the buffer has null 27 // |stream| function returns a non-null stream even when the buffer has null
28 // body. 28 // body.
29 class MODULES_EXPORT BodyStreamBuffer final : public GarbageCollectedFinalized<B odyStreamBuffer>, public UnderlyingSource, public WebDataConsumerHandle::Client { 29 class MODULES_EXPORT BodyStreamBuffer final : public GarbageCollectedFinalized<B odyStreamBuffer>, public UnderlyingSource, public WebDataConsumerHandle::Client {
30 WTF_MAKE_NONCOPYABLE(BodyStreamBuffer); 30 WTF_MAKE_NONCOPYABLE(BodyStreamBuffer);
31 USING_GARBAGE_COLLECTED_MIXIN(BodyStreamBuffer); 31 USING_GARBAGE_COLLECTED_MIXIN(BodyStreamBuffer);
32 public: 32 public:
33 BodyStreamBuffer() : BodyStreamBuffer(nullptr) {} 33 BodyStreamBuffer() : BodyStreamBuffer(nullptr) {}
34 // |handle| can be null, but cannot be locked. 34 // |handle| can be null, but cannot be locked.
35 explicit BodyStreamBuffer(PassOwnPtr<FetchDataConsumerHandle> /* handle */); 35 explicit BodyStreamBuffer(PassOwnPtr<FetchDataConsumerHandle> /* handle */);
36 36
37 ReadableByteStream* stream() { return m_stream; } 37 ReadableByteStream* stream() { return m_stream; }
38 38
39 // Callable only when not locked. 39 // Callable only when not locked.
40 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Re ader::BlobSizePolicy); 40 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Re ader::BlobSizePolicy);
41 PassRefPtr<FormData> drainAsFormData(); 41 PassRefPtr<EncodedFormData> drainAsFormData();
42 42
43 // Callable only when not locked. Returns a non-null handle even when 43 // Callable only when not locked. Returns a non-null handle even when
44 // having null body. 44 // having null body.
45 // Note: There is a case that calling |lock| doesn't make the buffer 45 // Note: There is a case that calling |lock| doesn't make the buffer
46 // locked. |unlock| should be called even in such cases when a user finishes 46 // locked. |unlock| should be called even in such cases when a user finishes
47 // to use the returned handle, in order to maintain hasPendingActivity(). 47 // to use the returned handle, in order to maintain hasPendingActivity().
48 PassOwnPtr<FetchDataConsumerHandle> lock(ExecutionContext*); 48 PassOwnPtr<FetchDataConsumerHandle> lock(ExecutionContext*);
49 49
50 // This function will lock |this| object. |client| cannot be null. 50 // This function will lock |this| object. |client| cannot be null.
51 void startLoading(ExecutionContext*, FetchDataLoader*, FetchDataLoader::Clie nt* /* client */); 51 void startLoading(ExecutionContext*, FetchDataLoader*, FetchDataLoader::Clie nt* /* client */);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // although we should return true for hasPendingActivity() when someone 90 // although we should return true for hasPendingActivity() when someone
91 // calls |startLoading| but the loding is not yet done. 91 // calls |startLoading| but the loding is not yet done.
92 unsigned m_lockLevel; 92 unsigned m_lockLevel;
93 const bool m_hasBody; 93 const bool m_hasBody;
94 bool m_streamNeedsMore; 94 bool m_streamNeedsMore;
95 }; 95 };
96 96
97 } // namespace blink 97 } // namespace blink
98 98
99 #endif // BodyStreamBuffer_h 99 #endif // BodyStreamBuffer_h
OLDNEW
« no previous file with comments | « Source/core/xmlhttprequest/XMLHttpRequest.cpp ('k') | Source/modules/fetch/BodyStreamBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698