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

Unified Diff: third_party/WebKit/Source/core/fetch/ImageResource.cpp

Issue 1756953002: Stop dispatching notifyFinished for each part in a multipart response (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@multipart-cleanup-2
Patch Set: Created 4 years, 9 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
Index: third_party/WebKit/Source/core/fetch/ImageResource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.cpp b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
index caaac704bf2695a5c38c3c53dec4c1098c0ea789..8e2c9bd2964f75c130dd2e0565b70a89f7861510 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
@@ -465,19 +465,28 @@ void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect
notifyObservers(&rect);
}
-void ImageResource::onePartInMultipartReceived(const ResourceResponse& response, bool isFirstPart)
+void ImageResource::onePartInMultipartReceived(const ResourceResponse& response)
{
ASSERT(m_multipartParser);
+
m_response = response;
- if (m_data) {
- clear();
- updateImage(true);
- m_data.clear();
+ if (m_multipartParsingState == MultipartParsingState::WaitingForFirstPart) {
+ // We have nothing to do because we don't have any data.
+ m_multipartParsingState = MultipartParsingState::ParsingFirstPart;
+ return;
+ }
+ clear();
+ updateImage(true);
+ m_data.clear();
+
+ if (m_multipartParsingState == MultipartParsingState::ParsingFirstPart) {
+ m_multipartParsingState = MultipartParsingState::FinishedParsingFirstPart;
+ // Notify finished when the first part ends.
setLoading(false);
checkNotify();
+ if (m_loader)
+ m_loader->didFinishLoadingOnePart(0, WebURLLoaderClient::kUnknownEncodedDataLength);
}
- if (!isFirstPart && m_loader)
- m_loader->didFinishLoadingOnePart(0, WebURLLoaderClient::kUnknownEncodedDataLength);
}
void ImageResource::multipartDataReceived(const char* bytes, size_t size)

Powered by Google App Engine
This is Rietveld 408576698