| 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 c08e465ee78fe5722792924a619f9acb8341854e..8e05180d257ca2d23b93c79dc02d7c8e7437bd6d 100644
|
| --- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp
|
| +++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
|
| @@ -117,7 +117,7 @@ void ImageResource::markClientsAndObserversFinished()
|
|
|
| void ImageResource::didAddClient(ResourceClient* client)
|
| {
|
| - DCHECK(!m_data || m_image);
|
| + DCHECK((m_multipartParser && isLoading()) || !m_data || m_image);
|
| Resource::didAddClient(client);
|
| }
|
|
|
| @@ -130,7 +130,15 @@ void ImageResource::addObserver(ImageResourceObserver* observer)
|
| if (isCacheValidator())
|
| return;
|
|
|
| - DCHECK(!m_data || m_image);
|
| + // When the response is not multipart, if |m_data| exists, |m_image| must
|
| + // be created. This is assured that |updateImage()| is called when
|
| + // |appendData()| is called.
|
| + //
|
| + // On the other hand, when the response is multipart, |updateImage()| is
|
| + // not called in |appendData()|, which means |m_image| might not be created
|
| + // even when |m_data| exists. This is intentional since creating a |m_image|
|
| + // on receiving data might destroy an existing image in a previous part.
|
| + DCHECK((m_multipartParser && isLoading()) || !m_data || m_image);
|
|
|
| if (m_image && !m_image->isNull()) {
|
| observer->imageChanged(this);
|
|
|