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) |