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

Unified Diff: Source/WebCore/loader/cache/CachedImage.cpp

Issue 14210003: Simplify CachedResource::data (Closed) Base URL: svn://svn.chromium.org/blink/trunk/
Patch Set: Created 7 years, 8 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/WebCore/loader/cache/CachedImage.h ('k') | Source/WebCore/loader/cache/CachedRawResource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/loader/cache/CachedImage.cpp
===================================================================
--- Source/WebCore/loader/cache/CachedImage.cpp (revision 148397)
+++ Source/WebCore/loader/cache/CachedImage.cpp (working copy)
@@ -58,6 +58,7 @@
CachedImage::CachedImage(const ResourceRequest& resourceRequest)
: CachedResource(resourceRequest, ImageResource)
, m_image(0)
+ , m_loadingMultipartContent(false)
{
setStatus(Unknown);
setCustomAcceptHeader();
@@ -341,10 +342,15 @@
m_image.clear();
}
-void CachedImage::data(PassRefPtr<ResourceBuffer> data, bool allDataReceived)
+void CachedImage::data(PassRefPtr<ResourceBuffer> data)
{
- m_data = data;
+ CachedResource::data(data);
+ if (!m_loadingMultipartContent)
+ updateImage(false);
+}
+void CachedImage::updateImage(bool allDataReceived)
+{
if (m_data)
createImage();
@@ -371,17 +377,15 @@
// It would be nice to only redraw the decoded band of the image, but with the current design
// (decoding delayed until painting) that seems hard.
notifyObservers();
-
- if (m_image)
- setEncodedSize(m_image->data() ? m_image->data()->size() : 0);
}
-
- if (allDataReceived) {
- setLoading(false);
- checkNotify();
- }
}
+void CachedImage::finishOnePart()
+{
+ updateImage(true);
+ CachedResource::finishOnePart();
+}
+
void CachedImage::error(CachedResource::Status status)
{
clear();
@@ -393,6 +397,8 @@
{
if (!m_response.isNull())
clear();
+ if (response.isMultipart())
+ m_loadingMultipartContent = true;
CachedResource::responseReceived(response);
}
« no previous file with comments | « Source/WebCore/loader/cache/CachedImage.h ('k') | Source/WebCore/loader/cache/CachedRawResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698