summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/loader/mac/ResourceLoaderMac.mm
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-25 19:08:45 +0100
committerSteve Block <steveblock@google.com>2011-06-08 13:51:31 +0100
commit2bde8e466a4451c7319e3a072d118917957d6554 (patch)
tree28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/WebCore/loader/mac/ResourceLoaderMac.mm
parent6939c99b71d9372d14a0c74a772108052e8c48c8 (diff)
downloadexternal_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/WebCore/loader/mac/ResourceLoaderMac.mm')
-rw-r--r--Source/WebCore/loader/mac/ResourceLoaderMac.mm42
1 files changed, 42 insertions, 0 deletions
diff --git a/Source/WebCore/loader/mac/ResourceLoaderMac.mm b/Source/WebCore/loader/mac/ResourceLoaderMac.mm
index 3835517..b42f8e0 100644
--- a/Source/WebCore/loader/mac/ResourceLoaderMac.mm
+++ b/Source/WebCore/loader/mac/ResourceLoaderMac.mm
@@ -35,6 +35,10 @@
#include "FrameLoaderClient.h"
#include "ResourceHandle.h"
+#if HAVE(CFNETWORK_DATA_ARRAY_CALLBACK)
+#include "InspectorInstrumentation.h"
+#endif
+
namespace WebCore {
NSCachedURLResponse* ResourceLoader::willCacheResponse(ResourceHandle*, NSCachedURLResponse* response)
@@ -44,6 +48,44 @@ NSCachedURLResponse* ResourceLoader::willCacheResponse(ResourceHandle*, NSCached
return frameLoader()->client()->willCacheResponse(documentLoader(), identifier(), response);
}
+#if HAVE(CFNETWORK_DATA_ARRAY_CALLBACK)
+
+void ResourceLoader::didReceiveDataArray(CFArrayRef dataArray)
+{
+ // Protect this in this delegate method since the additional processing can do
+ // anything including possibly derefing this; one example of this is Radar 3266216.
+ RefPtr<ResourceLoader> protector(this);
+
+ if (!m_shouldBufferData)
+ return;
+
+ if (!m_resourceData)
+ m_resourceData = SharedBuffer::create();
+
+ CFIndex arrayCount = CFArrayGetCount(dataArray);
+ for (CFIndex i = 0; i < arrayCount; ++i) {
+ CFDataRef data = static_cast<CFDataRef>(CFArrayGetValueAtIndex(dataArray, i));
+ int dataLen = static_cast<int>(CFDataGetLength(data));
+
+ m_resourceData->append(data);
+
+ // FIXME: If we get a resource with more than 2B bytes, this code won't do the right thing.
+ // However, with today's computers and networking speeds, this won't happen in practice.
+ // Could be an issue with a giant local file.
+ if (m_sendResourceLoadCallbacks && m_frame)
+ frameLoader()->notifier()->didReceiveData(this, reinterpret_cast<const char*>(CFDataGetBytePtr(data)), dataLen, dataLen);
+ }
+}
+
+void ResourceLoader::didReceiveDataArray(ResourceHandle*, CFArrayRef dataArray)
+{
+ InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceData(m_frame.get(), identifier());
+ didReceiveDataArray(dataArray);
+ InspectorInstrumentation::didReceiveResourceData(cookie);
+}
+
+#endif
+
}
#endif // !USE(CFNETWORK)