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

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..1368c652437fd27434e000f9808032b8f0d2b399 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
@@ -465,19 +465,27 @@ 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_numParsedPartsInMultipart;
+
m_response = response;
- if (m_data) {
- clear();
- updateImage(true);
- m_data.clear();
+ if (m_numParsedPartsInMultipart == 1) {
+ // We have nothing to do because we don't have any data.
+ return;
+ }
+ clear();
hiroshige 2016/03/15 21:38:37 nit: this CL removes |if (m_data)| check. Is this
+ updateImage(true);
+ m_data.clear();
+
+ if (m_numParsedPartsInMultipart == 2) {
+ // 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