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

Unified Diff: Source/WebCore/loader/ResourceLoader.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/html/ImageDocument.cpp ('k') | Source/WebCore/loader/cache/CachedCSSStyleSheet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/loader/ResourceLoader.cpp
===================================================================
--- Source/WebCore/loader/ResourceLoader.cpp (revision 148397)
+++ Source/WebCore/loader/ResourceLoader.cpp (working copy)
@@ -466,6 +466,7 @@
RefPtr<ResourceBuffer> buffer = resourceData();
if (m_loadingMultipartContent && buffer && buffer->size()) {
sendDataToResource(buffer->data(), buffer->size());
+ m_resource->finishOnePart();
clearResourceData();
// Since a subresource loader does not load multipart sections progressively, data was delivered to the loader all at once.
// After the first multipart section is complete, signal to delegates that this load is "finished"
@@ -516,11 +517,12 @@
// (2) Our client requested that the data not be buffered at the ResourceLoader level via ResourceLoaderOptions. In this case,
// ResourceLoader::resourceData() will be null. However, unlike the multipart case, we don't want to tell the CachedResource
// that all data has been received yet.
- if (m_loadingMultipartContent || !resourceData()) {
- RefPtr<ResourceBuffer> copiedData = ResourceBuffer::create(data, length);
- m_resource->data(copiedData.release(), m_loadingMultipartContent);
- } else
- m_resource->data(resourceData(), false);
+ RefPtr<ResourceBuffer> buffer;
+ if (m_loadingMultipartContent || !resourceData())
+ buffer = ResourceBuffer::create(data, length);
+ else
+ buffer = resourceData();
+ m_resource->data(buffer.release());
}
void ResourceLoader::didFinishLoading(ResourceHandle*, double finishTime)
@@ -536,7 +538,6 @@
CachedResourceHandle<CachedResource> protectResource(m_resource);
m_state = Finishing;
m_resource->setLoadFinishTime(finishTime);
- m_resource->data(resourceData(), true);
m_resource->finish();
didFinishLoadingOnePart(finishTime);
« no previous file with comments | « Source/WebCore/html/ImageDocument.cpp ('k') | Source/WebCore/loader/cache/CachedCSSStyleSheet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698