Diff
Modified: trunk/Source/WebCore/ChangeLog (94465 => 94466)
--- trunk/Source/WebCore/ChangeLog 2011-09-03 00:16:09 UTC (rev 94465)
+++ trunk/Source/WebCore/ChangeLog 2011-09-03 00:17:39 UTC (rev 94466)
@@ -1,3 +1,36 @@
+2011-09-02 Bill Budge <[email protected]>
+
+ Add a 'didDownloadData' method to ResourceLoader, SubresourceLoader,
+ SubresourceLoaderClient, DocumentThreadableLoader, ResourceHandleClient,
+ and ThreadableLoaderClient for the Chromium port only, so we can pass
+ these notifications from our ResourceHandle implementation through the
+ WebCore loader framework.
+ https://bugs.webkit.org/show_bug.cgi?id=67229
+
+ Reviewed by Darin Fisher.
+
+ No new tests. Exposes no new functionality.
+
+ * WebCore.gypi:
+ * loader/DocumentThreadableLoader.h:
+ * loader/ResourceLoader.h:
+ * loader/SubresourceLoader.h:
+ * loader/SubresourceLoaderClient.h:
+ (WebCore::SubresourceLoaderClient::didDownloadData):
+ * loader/ThreadableLoaderClient.h:
+ (WebCore::ThreadableLoaderClient::didDownloadData):
+ * loader/ThreadableLoaderClientWrapper.h:
+ (WebCore::ThreadableLoaderClientWrapper::didDownloadData):
+ * loader/chromium: Added.
+ * loader/chromium/DocumentThreadableLoaderChromium.cpp: Added.
+ (WebCore::DocumentThreadableLoader::didDownloadData):
+ * loader/chromium/ResourceLoaderChromium.cpp: Added.
+ (WebCore::ResourceLoader::didDownloadData):
+ * loader/chromium/SubresourceLoaderChromium.cpp: Added.
+ (WebCore::SubresourceLoader::didDownloadData):
+ * platform/network/ResourceHandleClient.h:
+ (WebCore::ResourceHandleClient::didDownloadData):
+
2011-09-02 Jeff Miller <[email protected]>
Assert that PlatformCALayerWinInternal::displayCallback() is only called on the main thread
Modified: trunk/Source/WebCore/WebCore.gypi (94465 => 94466)
--- trunk/Source/WebCore/WebCore.gypi 2011-09-03 00:16:09 UTC (rev 94465)
+++ trunk/Source/WebCore/WebCore.gypi 2011-09-03 00:17:39 UTC (rev 94466)
@@ -2825,6 +2825,9 @@
'loader/cache/CachedXSLStyleSheet.h',
'loader/cache/MemoryCache.cpp',
'loader/cf/ResourceLoaderCFNet.cpp',
+ 'loader/chromium/DocumentThreadableLoaderChromium.cpp',
+ 'loader/chromium/ResourceLoaderChromium.cpp',
+ 'loader/chromium/SubresourceLoaderChromium.cpp',
'loader/icon/IconController.cpp',
'loader/icon/IconDatabase.cpp',
'loader/icon/IconDatabaseBase.cpp',
Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.h (94465 => 94466)
--- trunk/Source/WebCore/loader/DocumentThreadableLoader.h 2011-09-03 00:16:09 UTC (rev 94465)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.h 2011-09-03 00:17:39 UTC (rev 94466)
@@ -84,6 +84,10 @@
virtual void didReceiveAuthenticationChallenge(SubresourceLoader*, const AuthenticationChallenge&);
+#if PLATFORM(CHROMIUM)
+ virtual void didDownloadData(SubresourceLoader*, int dataLength);
+#endif
+
void didReceiveResponse(unsigned long identifier, const ResourceResponse&);
void didFinishLoading(unsigned long identifier, double finishTime);
void makeSimpleCrossOriginAccessRequest(const ResourceRequest& request);
Modified: trunk/Source/WebCore/loader/ResourceLoader.h (94465 => 94466)
--- trunk/Source/WebCore/loader/ResourceLoader.h 2011-09-03 00:16:09 UTC (rev 94465)
+++ trunk/Source/WebCore/loader/ResourceLoader.h 2011-09-03 00:17:39 UTC (rev 94466)
@@ -129,6 +129,10 @@
// FIXME: Windows should use willCacheResponse - <https://bugs.webkit.org/show_bug.cgi?id=57257>.
virtual bool shouldCacheResponse(ResourceHandle*, CFCachedURLResponseRef);
#endif
+#if PLATFORM(CHROMIUM)
+ virtual void didDownloadData(ResourceHandle*, int);
+ virtual void didDownloadData(int);
+#endif
#if ENABLE(BLOB)
virtual AsyncFileStream* createAsyncFileStream(FileStreamClient*);
#endif
Modified: trunk/Source/WebCore/loader/SubresourceLoader.h (94465 => 94466)
--- trunk/Source/WebCore/loader/SubresourceLoader.h 2011-09-03 00:16:09 UTC (rev 94465)
+++ trunk/Source/WebCore/loader/SubresourceLoader.h 2011-09-03 00:17:39 UTC (rev 94466)
@@ -64,6 +64,9 @@
virtual bool supportsDataArray() { return true; }
virtual void didReceiveDataArray(CFArrayRef);
#endif
+#if PLATFORM(CHROMIUM)
+ virtual void didDownloadData(int);
+#endif
SubresourceLoaderClient* m_client;
bool m_loadingMultipartContent;
Modified: trunk/Source/WebCore/loader/SubresourceLoaderClient.h (94465 => 94466)
--- trunk/Source/WebCore/loader/SubresourceLoaderClient.h 2011-09-03 00:16:09 UTC (rev 94465)
+++ trunk/Source/WebCore/loader/SubresourceLoaderClient.h 2011-09-03 00:17:39 UTC (rev 94466)
@@ -52,6 +52,10 @@
virtual void didFail(SubresourceLoader*, const ResourceError&) { }
virtual void didReceiveAuthenticationChallenge(SubresourceLoader*, const AuthenticationChallenge&) { }
+
+#if PLATFORM(CHROMIUM)
+ virtual void didDownloadData(SubresourceLoader*, int /*dataLength*/) { }
+#endif
};
} // namespace WebCore
Modified: trunk/Source/WebCore/loader/ThreadableLoaderClient.h (94465 => 94466)
--- trunk/Source/WebCore/loader/ThreadableLoaderClient.h 2011-09-03 00:16:09 UTC (rev 94465)
+++ trunk/Source/WebCore/loader/ThreadableLoaderClient.h 2011-09-03 00:17:39 UTC (rev 94466)
@@ -51,6 +51,10 @@
virtual bool isDocumentThreadableLoaderClient() { return false; }
+#if PLATFORM(CHROMIUM)
+ virtual void didDownloadData(int /*dataLength*/) { }
+#endif
+
protected:
ThreadableLoaderClient() { }
virtual ~ThreadableLoaderClient() { }
Modified: trunk/Source/WebCore/loader/ThreadableLoaderClientWrapper.h (94465 => 94466)
--- trunk/Source/WebCore/loader/ThreadableLoaderClientWrapper.h 2011-09-03 00:16:09 UTC (rev 94465)
+++ trunk/Source/WebCore/loader/ThreadableLoaderClientWrapper.h 2011-09-03 00:17:39 UTC (rev 94466)
@@ -107,6 +107,14 @@
m_client->didReceiveResponse(identifier, response);
}
+#if PLATFORM(CHROMIUM)
+ void didDownloadData(int dataLength)
+ {
+ if (m_client)
+ m_client->didDownloadData(dataLength);
+ }
+#endif
+
protected:
ThreadableLoaderClientWrapper(ThreadableLoaderClient* client)
: m_client(client)
Copied: trunk/Source/WebCore/loader/chromium/DocumentThreadableLoaderChromium.cpp (from rev 94465, trunk/Source/WebCore/loader/ThreadableLoaderClient.h) (0 => 94466)
--- trunk/Source/WebCore/loader/chromium/DocumentThreadableLoaderChromium.cpp (rev 0)
+++ trunk/Source/WebCore/loader/chromium/DocumentThreadableLoaderChromium.cpp 2011-09-03 00:17:39 UTC (rev 94466)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2011, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DocumentThreadableLoader.h"
+
+#include "SubresourceLoader.h"
+#include "ThreadableLoaderClient.h"
+
+namespace WebCore {
+
+void DocumentThreadableLoader::didDownloadData(SubresourceLoader* loader, int dataLength)
+{
+ ASSERT(m_client);
+ ASSERT_UNUSED(loader, loader == m_loader);
+ ASSERT(!m_actualRequest);
+
+ m_client->didDownloadData(dataLength);
+}
+
+} // namespace WebCore
Copied: trunk/Source/WebCore/loader/chromium/ResourceLoaderChromium.cpp (from rev 94465, trunk/Source/WebCore/loader/ThreadableLoaderClient.h) (0 => 94466)
--- trunk/Source/WebCore/loader/chromium/ResourceLoaderChromium.cpp (rev 0)
+++ trunk/Source/WebCore/loader/chromium/ResourceLoaderChromium.cpp 2011-09-03 00:17:39 UTC (rev 94466)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2011, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ResourceLoader.h"
+
+#include "ApplicationCacheHost.h"
+#include "DocumentLoader.h"
+#include "Frame.h"
+
+namespace WebCore {
+
+void ResourceLoader::didDownloadData(ResourceHandle*, int length)
+{
+ didDownloadData(length);
+}
+
+void ResourceLoader::didDownloadData(int length)
+{
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ if (!m_cancelled && !fastMallocSize(documentLoader()->applicationCacheHost()))
+ CRASH();
+#endif
+ if (!m_cancelled && !fastMallocSize(documentLoader()->frame()))
+ CRASH();
+}
+
+}
Copied: trunk/Source/WebCore/loader/chromium/SubresourceLoaderChromium.cpp (from rev 94465, trunk/Source/WebCore/loader/ThreadableLoaderClient.h) (0 => 94466)
--- trunk/Source/WebCore/loader/chromium/SubresourceLoaderChromium.cpp (rev 0)
+++ trunk/Source/WebCore/loader/chromium/SubresourceLoaderChromium.cpp 2011-09-03 00:17:39 UTC (rev 94466)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2011, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SubresourceLoader.h"
+
+#include "SubresourceLoaderClient.h"
+#include <wtf/RefCountedLeakCounter.h>
+
+namespace WebCore {
+
+void SubresourceLoader::didDownloadData(int length)
+{
+ // Reference the object in this method since the additional processing can do
+ // anything including removing the last reference to this object; one example of this is 3266216.
+ RefPtr<SubresourceLoader> protect(this);
+
+ ResourceLoader::didDownloadData(length);
+
+ if (m_client)
+ m_client->didDownloadData(this, length);
+}
+
+}
Modified: trunk/Source/WebCore/platform/network/ResourceHandleClient.h (94465 => 94466)
--- trunk/Source/WebCore/platform/network/ResourceHandleClient.h 2011-09-03 00:16:09 UTC (rev 94465)
+++ trunk/Source/WebCore/platform/network/ResourceHandleClient.h 2011-09-03 00:17:39 UTC (rev 94466)
@@ -107,6 +107,9 @@
#if PLATFORM(WIN) && USE(CFNETWORK)
virtual bool shouldCacheResponse(ResourceHandle*, CFCachedURLResponseRef) { return true; }
#endif
+#if PLATFORM(CHROMIUM)
+ virtual void didDownloadData(ResourceHandle*, int /*dataLength*/) { }
+#endif
#if ENABLE(BLOB)
virtual AsyncFileStream* createAsyncFileStream(FileStreamClient*) { return 0; }
#endif
Modified: trunk/Source/WebKit/chromium/ChangeLog (94465 => 94466)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-09-03 00:16:09 UTC (rev 94465)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-09-03 00:17:39 UTC (rev 94466)
@@ -1,3 +1,20 @@
+2011-09-02 Bill Budge <[email protected]>
+
+ Add a 'didDownloadData' method to ResourceHandleInternal and pass these
+ notifications to WebURLLoaderClients.
+ https://bugs.webkit.org/show_bug.cgi?id=67229
+
+ Reviewed by Darin Fisher.
+
+ * src/AssociatedURLLoader.cpp:
+ (WebKit::AssociatedURLLoader::ClientAdapter::ClientAdapter):
+ (WebKit::AssociatedURLLoader::ClientAdapter::didDownloadData):
+ (WebKit::AssociatedURLLoader::ClientAdapter::didReceiveData):
+ (WebKit::AssociatedURLLoader::ClientAdapter::didFinishLoading):
+ * src/ResourceHandle.cpp:
+ (WebCore::ResourceHandleInternal::didDownloadData):
+ * src/ResourceHandleInternal.h:
+
2011-09-02 Peng Huang <[email protected]>
Need API for getting surrounding text from webkit in chromium
Modified: trunk/Source/WebKit/chromium/src/AssociatedURLLoader.cpp (94465 => 94466)
--- trunk/Source/WebKit/chromium/src/AssociatedURLLoader.cpp 2011-09-03 00:16:09 UTC (rev 94465)
+++ trunk/Source/WebKit/chromium/src/AssociatedURLLoader.cpp 2011-09-03 00:17:39 UTC (rev 94466)
@@ -63,6 +63,7 @@
virtual void willSendRequest(ResourceRequest& /*newRequest*/, const ResourceResponse& /*redirectResponse*/);
virtual void didReceiveResponse(unsigned long, const ResourceResponse&);
+ virtual void didDownloadData(int /*dataLength*/);
virtual void didReceiveData(const char*, int /*dataLength*/);
virtual void didReceiveCachedMetadata(const char*, int /*dataLength*/);
virtual void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/);
@@ -87,7 +88,6 @@
WebURLError m_error;
Timer<ClientAdapter> m_errorTimer;
- unsigned long m_downloadLength;
bool m_downloadToFile;
bool m_enableErrorNotifications;
bool m_didFail;
@@ -102,7 +102,6 @@
: m_loader(loader)
, m_client(client)
, m_errorTimer(this, &ClientAdapter::notifyError)
- , m_downloadLength(0)
, m_downloadToFile(downloadToFile)
, m_enableErrorNotifications(false)
, m_didFail(false)
@@ -135,13 +134,20 @@
m_client->didReceiveResponse(m_loader, wrappedResponse);
}
+void AssociatedURLLoader::ClientAdapter::didDownloadData(int dataLength)
+{
+ if (!m_client)
+ return;
+
+ m_client->didDownloadData(m_loader, dataLength);
+}
+
void AssociatedURLLoader::ClientAdapter::didReceiveData(const char* data, int dataLength)
{
if (!m_client)
return;
m_client->didReceiveData(m_loader, data, dataLength, -1);
- m_downloadLength += dataLength;
}
void AssociatedURLLoader::ClientAdapter::didReceiveCachedMetadata(const char* data, int dataLength)
@@ -157,12 +163,6 @@
if (!m_client)
return;
- if (m_downloadToFile) {
- int downloadLength = m_downloadLength <= INT_MAX ? m_downloadLength : INT_MAX;
- m_client->didDownloadData(m_loader, downloadLength);
- // While the client could have canceled, continue, since the load finished.
- }
-
m_client->didFinishLoading(m_loader, finishTime);
}
Modified: trunk/Source/WebKit/chromium/src/ResourceHandle.cpp (94465 => 94466)
--- trunk/Source/WebKit/chromium/src/ResourceHandle.cpp 2011-09-03 00:16:09 UTC (rev 94465)
+++ trunk/Source/WebKit/chromium/src/ResourceHandle.cpp 2011-09-03 00:17:39 UTC (rev 94466)
@@ -121,6 +121,15 @@
m_client->didReceiveResponse(m_owner, response.toResourceResponse());
}
+void ResourceHandleInternal::didDownloadData(WebURLLoader*, int dataLength)
+{
+ ASSERT(m_client);
+ if (m_state != ConnectionStateReceivedResponse)
+ CRASH();
+
+ m_client->didDownloadData(m_owner, dataLength);
+}
+
void ResourceHandleInternal::didReceiveData(WebURLLoader*, const char* data, int dataLength, int encodedDataLength)
{
ASSERT(m_client);
Modified: trunk/Source/WebKit/chromium/src/ResourceHandleInternal.h (94465 => 94466)
--- trunk/Source/WebKit/chromium/src/ResourceHandleInternal.h 2011-09-03 00:16:09 UTC (rev 94465)
+++ trunk/Source/WebKit/chromium/src/ResourceHandleInternal.h 2011-09-03 00:17:39 UTC (rev 94466)
@@ -56,6 +56,7 @@
virtual void willSendRequest(WebKit::WebURLLoader*, WebKit::WebURLRequest&, const WebKit::WebURLResponse&);
virtual void didSendData(WebKit::WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
virtual void didReceiveResponse(WebKit::WebURLLoader*, const WebKit::WebURLResponse&);
+ virtual void didDownloadData(WebKit::WebURLLoader*, int dataLength);
virtual void didReceiveData(WebKit::WebURLLoader*, const char* data, int dataLength, int encodedDataLength);
virtual void didReceiveCachedMetadata(WebKit::WebURLLoader*, const char* data, int dataLength);