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

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

Issue 2671213003: BodyStreamBuffer should take care the case where endRead returns Done (Closed)
Patch Set: fix Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp b/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp
index a34726928513c3855f34cc2dc174752b381b7228..55de9f5db034875e0cfcdaefd1a6284351891350 100644
--- a/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp
+++ b/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp
@@ -316,24 +316,26 @@ void BodyStreamBuffer::processData() {
result = m_consumer->endRead(available);
}
switch (result) {
- case BytesConsumer::Result::Ok: {
- DCHECK(array);
- // Clear m_streamNeedsMore in order to detect a pull call.
- m_streamNeedsMore = false;
- controller()->enqueue(array);
+ case BytesConsumer::Result::Ok:
+ case BytesConsumer::Result::Done:
+ if (array) {
+ // Clear m_streamNeedsMore in order to detect a pull call.
+ m_streamNeedsMore = false;
+ controller()->enqueue(array);
+ }
+ if (result == BytesConsumer::Result::Done) {
+ close();
+ return;
+ }
// If m_streamNeedsMore is true, it means that pull is called and
// the stream needs more data even if the desired size is not
// positive.
if (!m_streamNeedsMore)
m_streamNeedsMore = controller()->desiredSize() > 0;
break;
- }
case BytesConsumer::Result::ShouldWait:
NOTREACHED();
return;
- case BytesConsumer::Result::Done:
- close();
- return;
case BytesConsumer::Result::Error:
error();
return;
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698