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

Unified Diff: Source/modules/fetch/FetchManager.cpp

Issue 1192913007: Change BodyStreamBuffer to be FetchDataConsumerHandle-based and enable backpressure in Fetch API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase. Created 5 years, 5 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 | « Source/modules/fetch/FetchBlobDataConsumerHandle.cpp ('k') | Source/modules/fetch/FetchRequestData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/fetch/FetchManager.cpp
diff --git a/Source/modules/fetch/FetchManager.cpp b/Source/modules/fetch/FetchManager.cpp
index 05776540befede054c7932bcbef1765372ce3a2f..70daa59c44b6f89c5ffd33bdba238fa409376219 100644
--- a/Source/modules/fetch/FetchManager.cpp
+++ b/Source/modules/fetch/FetchManager.cpp
@@ -19,6 +19,7 @@
#include "core/loader/ThreadableLoaderClient.h"
#include "modules/fetch/Body.h"
#include "modules/fetch/BodyStreamBuffer.h"
+#include "modules/fetch/DataConsumerHandleUtil.h"
#include "modules/fetch/FetchRequestData.h"
#include "modules/fetch/Response.h"
#include "modules/fetch/ResponseInit.h"
@@ -111,7 +112,7 @@ void FetchManager::Loader::didReceiveResponse(unsigned long, const ResourceRespo
break;
}
}
- FetchResponseData* responseData = FetchResponseData::createWithBuffer(BodyStreamBuffer::create(handle, "Failed to fetch"));
+ FetchResponseData* responseData = FetchResponseData::createWithBuffer(BodyStreamBuffer::create(createFetchDataConsumerHandleFromWebHandle(handle)));
responseData->setStatus(response.httpStatusCode());
responseData->setStatusMessage(response.httpStatusText());
for (auto& it : response.httpHeaderFields())
@@ -321,10 +322,11 @@ void FetchManager::Loader::performHTTPFetch(bool corsFlag, bool corsPreflightFla
}
if (m_request->method() != "GET" && m_request->method() != "HEAD") {
- RefPtr<BlobDataHandle> blobDataHandle = m_request->blobDataHandle();
- if (blobDataHandle.get()) {
+ if (BodyStreamBuffer* buffer = m_request->buffer()) {
+ RefPtr<BlobDataHandle> blobDataHandle = buffer->handle()->obtainReader(nullptr)->drainAsBlobDataHandle(FetchDataConsumerHandle::Reader::AllowBlobWithInvalidSize);
RefPtr<FormData> httpBody(FormData::create());
- httpBody->appendBlob(blobDataHandle->uuid(), blobDataHandle);
+ if (blobDataHandle)
+ httpBody->appendBlob(blobDataHandle->uuid(), blobDataHandle);
request.setHTTPBody(httpBody);
}
}
« no previous file with comments | « Source/modules/fetch/FetchBlobDataConsumerHandle.cpp ('k') | Source/modules/fetch/FetchRequestData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698