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

Unified Diff: third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h

Issue 1418813004: [Fetch API] Reflect spec changes of bodyUsed property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h
diff --git a/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h b/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h
index b85a594140a60c00034368247a0e33aa8e79c3a2..1e8771ed702db19d0ec6175654160f09b700af70 100644
--- a/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h
+++ b/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h
@@ -34,18 +34,16 @@ public:
// Callable only when not locked.
PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Reader::BlobSizePolicy);
PassRefPtr<EncodedFormData> drainAsFormData();
+ void startLoading(ExecutionContext*, FetchDataLoader*, FetchDataLoader::Client* /* client */);
// Callable only when not locked. Returns a non-null handle.
- // Note: There is a case that calling |lock| doesn't make the buffer
- // locked. |unlock| should be called even in such cases when a user finishes
- // to use the returned handle, in order to maintain hasPendingActivity().
- PassOwnPtr<FetchDataConsumerHandle> lock(ExecutionContext*);
-
- // This function will lock |this| object. |client| cannot be null.
- void startLoading(ExecutionContext*, FetchDataLoader*, FetchDataLoader::Client* /* client */);
+ // There is no means to "return" the handle to the body buffer: Calling
+ // this function locks, disturbs and closes the stream and no one will
+ // not be able to get any information from the stream and this buffer after
+ // that.
+ PassOwnPtr<FetchDataConsumerHandle> releaseHandle(ExecutionContext*);
- bool isLocked() const { return m_stream->isLocked(); }
- bool hasPendingActivity() const { return isLocked() || m_lockLevel > 0; }
+ bool hasPendingActivity() const;
// UnderlyingSource
void pullSource() override;
@@ -57,32 +55,23 @@ public:
DEFINE_INLINE_TRACE()
{
visitor->trace(m_stream);
- visitor->trace(m_streamReader);
- visitor->trace(m_loaders);
+ visitor->trace(m_loader);
UnderlyingSource::trace(visitor);
}
private:
- class LoaderHolder;
- enum EndLoadingMode {
- EndLoadingDone,
- EndLoadingErrored,
- };
+ class LoaderClient;
void close();
void error();
void processData();
- void unlock();
- void endLoading(FetchDataLoader::Client*, EndLoadingMode);
+ void endLoading();
+ void stopLoading();
OwnPtr<FetchDataConsumerHandle> m_handle;
OwnPtr<FetchDataConsumerHandle::Reader> m_reader;
Member<ReadableByteStream> m_stream;
- Member<ReadableByteStreamReader> m_streamReader;
- HeapHashSet<Member<FetchDataLoader::Client>> m_loaders;
- // We need this variable because we cannot lock closed or erroed stream
- // although we should return true for hasPendingActivity() when someone
- // calls |startLoading| but the loding is not yet done.
- unsigned m_lockLevel;
+ // We need this member to keep it alive while loading.
+ Member<FetchDataLoader> m_loader;
bool m_streamNeedsMore;
};
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/Body.cpp ('k') | third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698