2011-02-16 Bill Budge <bbudge@chromium.org>

        Reviewed by David Levin.

        Need didReceiveCachedMetadata, and finishTime for didFinishLoading exposed in ThreadableLoaderClient
        https://bugs.webkit.org/show_bug.cgi?id=54313

        No tests needed, exposes no new functionality

        * fileapi/FileReaderLoader.cpp:
        (WebCore::FileReaderLoader::didFinishLoading):
        * fileapi/FileReaderLoader.h:
        * loader/DocumentThreadableLoader.cpp:
        (WebCore::DocumentThreadableLoader::setDefersLoading):
        (WebCore::DocumentThreadableLoader::didReceiveCachedMetadata):
        (WebCore::DocumentThreadableLoader::didFinishLoading):
        (WebCore::DocumentThreadableLoader::loadRequest):
        * loader/DocumentThreadableLoader.h:
        * loader/ThreadableLoaderClient.h:
        (WebCore::ThreadableLoaderClient::didReceiveData):
        (WebCore::ThreadableLoaderClient::didReceiveCachedMetadata):
        (WebCore::ThreadableLoaderClient::didFinishLoading):
        * loader/ThreadableLoaderClientWrapper.h:
        (WebCore::ThreadableLoaderClientWrapper::didReceiveData):
        (WebCore::ThreadableLoaderClientWrapper::didReceiveCachedMetadata):
        (WebCore::ThreadableLoaderClientWrapper::didFinishLoading):
        * loader/WorkerThreadableLoader.cpp:
        (WebCore::workerContextDidReceiveCachedMetadata):
        (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveCachedMetadata):
        (WebCore::workerContextDidFinishLoading):
        (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
        * loader/WorkerThreadableLoader.h:
        * notifications/Notification.cpp:
        (WebCore::Notification::didFinishLoading):
        * notifications/Notification.h:
        * page/EventSource.cpp:
        (WebCore::EventSource::didFinishLoading):
        * page/EventSource.h:
        * workers/WorkerScriptLoader.cpp:
        (WebCore::WorkerScriptLoader::didFinishLoading):
        * workers/WorkerScriptLoader.h:
        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::didFinishLoading):
        * xml/XMLHttpRequest.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@78782 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ff66b0ec
2011-02-16 Bill Budge <bbudge@chromium.org>
Reviewed by David Levin.
Need didReceiveCachedMetadata, and finishTime for didFinishLoading exposed in ThreadableLoaderClient
https://bugs.webkit.org/show_bug.cgi?id=54313
No tests needed, exposes no new functionality
* fileapi/FileReaderLoader.cpp:
(WebCore::FileReaderLoader::didFinishLoading):
* fileapi/FileReaderLoader.h:
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::setDefersLoading):
(WebCore::DocumentThreadableLoader::didReceiveCachedMetadata):
(WebCore::DocumentThreadableLoader::didFinishLoading):
(WebCore::DocumentThreadableLoader::loadRequest):
* loader/DocumentThreadableLoader.h:
* loader/ThreadableLoaderClient.h:
(WebCore::ThreadableLoaderClient::didReceiveData):
(WebCore::ThreadableLoaderClient::didReceiveCachedMetadata):
(WebCore::ThreadableLoaderClient::didFinishLoading):
* loader/ThreadableLoaderClientWrapper.h:
(WebCore::ThreadableLoaderClientWrapper::didReceiveData):
(WebCore::ThreadableLoaderClientWrapper::didReceiveCachedMetadata):
(WebCore::ThreadableLoaderClientWrapper::didFinishLoading):
* loader/WorkerThreadableLoader.cpp:
(WebCore::workerContextDidReceiveCachedMetadata):
(WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveCachedMetadata):
(WebCore::workerContextDidFinishLoading):
(WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
* loader/WorkerThreadableLoader.h:
* notifications/Notification.cpp:
(WebCore::Notification::didFinishLoading):
* notifications/Notification.h:
* page/EventSource.cpp:
(WebCore::EventSource::didFinishLoading):
* page/EventSource.h:
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::didFinishLoading):
* workers/WorkerScriptLoader.h:
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::didFinishLoading):
* xml/XMLHttpRequest.h:
2011-02-16 Jeremy Orlow <jorlow@chromium.org>
Fix uninitialized memory error.
......
......@@ -176,7 +176,7 @@ void FileReaderLoader::didReceiveData(const char* data, int lengthReceived)
m_client->didReceiveData();
}
void FileReaderLoader::didFinishLoading(unsigned long)
void FileReaderLoader::didFinishLoading(unsigned long, double)
{
cleanup();
if (m_client)
......
......@@ -68,7 +68,7 @@ public:
// ThreadableLoaderClient
virtual void didReceiveResponse(const ResourceResponse&);
virtual void didReceiveData(const char*, int);
virtual void didFinishLoading(unsigned long identifier);
virtual void didFinishLoading(unsigned long, double);
virtual void didFail(const ResourceError&);
String stringResult();
......
......@@ -166,6 +166,12 @@ void DocumentThreadableLoader::cancel()
m_client = 0;
}
void DocumentThreadableLoader::setDefersLoading(bool value)
{
if (m_loader)
m_loader->setDefersLoading(value);
}
void DocumentThreadableLoader::willSendRequest(SubresourceLoader* loader, ResourceRequest& request, const ResourceResponse&)
{
ASSERT(m_client);
......@@ -231,21 +237,31 @@ void DocumentThreadableLoader::didReceiveData(SubresourceLoader* loader, const c
m_client->didReceiveData(data, lengthReceived);
}
void DocumentThreadableLoader::didFinishLoading(SubresourceLoader* loader, double)
void DocumentThreadableLoader::didReceiveCachedMetadata(SubresourceLoader* loader, const char* data, int lengthReceived)
{
ASSERT(m_client);
ASSERT_UNUSED(loader, loader == m_loader);
// Ignore response body of preflight requests.
if (!m_actualRequest)
m_client->didReceiveCachedMetadata(data, lengthReceived);
}
void DocumentThreadableLoader::didFinishLoading(SubresourceLoader* loader, double finishTime)
{
ASSERT(loader == m_loader);
ASSERT(m_client);
didFinishLoading(loader->identifier());
didFinishLoading(loader->identifier(), finishTime);
}
void DocumentThreadableLoader::didFinishLoading(unsigned long identifier)
void DocumentThreadableLoader::didFinishLoading(unsigned long identifier, double finishTime)
{
if (m_actualRequest) {
ASSERT(!m_sameOriginRequest);
ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl);
preflightSuccess();
} else
m_client->didFinishLoading(identifier);
m_client->didFinishLoading(identifier, finishTime);
}
void DocumentThreadableLoader::didFail(SubresourceLoader* loader, const ResourceError& error)
......@@ -359,7 +375,7 @@ void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, Secur
int len = static_cast<int>(data.size());
didReceiveData(0, bytes, len);
didFinishLoading(identifier);
didFinishLoading(identifier, 0.0);
}
bool DocumentThreadableLoader::isAllowedRedirect(const KURL& url)
......
......@@ -54,6 +54,7 @@ namespace WebCore {
virtual ~DocumentThreadableLoader();
virtual void cancel();
virtual void setDefersLoading(bool);
using RefCounted<DocumentThreadableLoader>::ref;
using RefCounted<DocumentThreadableLoader>::deref;
......@@ -75,6 +76,7 @@ namespace WebCore {
virtual void didReceiveResponse(SubresourceLoader*, const ResourceResponse&);
virtual void didReceiveData(SubresourceLoader*, const char*, int lengthReceived);
virtual void didReceiveCachedMetadata(SubresourceLoader*, const char*, int lengthReceived);
virtual void didFinishLoading(SubresourceLoader*, double);
virtual void didFail(SubresourceLoader*, const ResourceError&);
......@@ -82,7 +84,7 @@ namespace WebCore {
virtual void didReceiveAuthenticationChallenge(SubresourceLoader*, const AuthenticationChallenge&);
virtual void receivedCancellation(SubresourceLoader*, const AuthenticationChallenge&);
void didFinishLoading(unsigned long identifier);
void didFinishLoading(unsigned long identifier, double finishTime);
void makeSimpleCrossOriginAccessRequest(const ResourceRequest& request);
void makeCrossOriginAccessRequestWithPreflight(const ResourceRequest& request);
void preflightSuccess();
......
......@@ -43,8 +43,9 @@ namespace WebCore {
virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { }
virtual void didReceiveResponse(const ResourceResponse&) { }
virtual void didReceiveData(const char*, int /*lengthReceived*/) { }
virtual void didFinishLoading(unsigned long /*identifier*/) { }
virtual void didReceiveData(const char*, int /*dataLength*/) { }
virtual void didReceiveCachedMetadata(const char*, int /*dataLength*/) { }
virtual void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/) { }
virtual void didFail(const ResourceError&) { }
virtual void didFailRedirectCheck() { }
......
......@@ -68,17 +68,23 @@ namespace WebCore {
m_client->didReceiveResponse(response);
}
void didReceiveData(const char* data, int lengthReceived)
void didReceiveData(const char* data, int dataLength)
{
if (m_client)
m_client->didReceiveData(data, lengthReceived);
m_client->didReceiveData(data, dataLength);
}
void didFinishLoading(unsigned long identifier)
void didReceiveCachedMetadata(const char* data, int dataLength)
{
if (m_client)
m_client->didReceiveCachedMetadata(data, dataLength);
}
void didFinishLoading(unsigned long identifier, double finishTime)
{
m_done = true;
if (m_client)
m_client->didFinishLoading(identifier);
m_client->didFinishLoading(identifier, finishTime);
}
void didFail(const ResourceError& error)
......
......@@ -198,15 +198,28 @@ void WorkerThreadableLoader::MainThreadBridge::didReceiveData(const char* data,
m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidReceiveData, m_workerClientWrapper, vector.release()), m_taskMode);
}
static void workerContextDidFinishLoading(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, unsigned long identifier)
static void workerContextDidReceiveCachedMetadata(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<Vector<char> > vectorData)
{
ASSERT_UNUSED(context, context->isWorkerContext());
workerClientWrapper->didFinishLoading(identifier);
workerClientWrapper->didReceiveCachedMetadata(vectorData->data(), vectorData->size());
}
void WorkerThreadableLoader::MainThreadBridge::didFinishLoading(unsigned long identifier)
void WorkerThreadableLoader::MainThreadBridge::didReceiveCachedMetadata(const char* data, int lengthReceived)
{
m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidFinishLoading, m_workerClientWrapper, identifier), m_taskMode);
OwnPtr<Vector<char> > vector = adoptPtr(new Vector<char>(lengthReceived)); // needs to be an OwnPtr for usage with createCallbackTask.
memcpy(vector->data(), data, lengthReceived);
m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidReceiveCachedMetadata, m_workerClientWrapper, vector.release()), m_taskMode);
}
static void workerContextDidFinishLoading(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, unsigned long identifier, double finishTime)
{
ASSERT_UNUSED(context, context->isWorkerContext());
workerClientWrapper->didFinishLoading(identifier, finishTime);
}
void WorkerThreadableLoader::MainThreadBridge::didFinishLoading(unsigned long identifier, double finishTime)
{
m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidFinishLoading, m_workerClientWrapper, identifier, finishTime), m_taskMode);
}
static void workerContextDidFail(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, const ResourceError& error)
......
......@@ -114,8 +114,9 @@ namespace WebCore {
static void mainThreadCancel(ScriptExecutionContext*, MainThreadBridge*);
virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
virtual void didReceiveResponse(const ResourceResponse&);
virtual void didReceiveData(const char*, int lengthReceived);
virtual void didFinishLoading(unsigned long identifier);
virtual void didReceiveData(const char*, int dataLength);
virtual void didReceiveCachedMetadata(const char*, int dataLength);
virtual void didFinishLoading(unsigned long identifier, double finishTime);
virtual void didFail(const ResourceError&);
virtual void didFailRedirectCheck();
virtual void didReceiveAuthenticationCancellation(const ResourceResponse&);
......
......@@ -195,7 +195,7 @@ void Notification::didReceiveData(const char* data, int lengthReceived)
m_iconData->append(data, lengthReceived);
}
void Notification::didFinishLoading(unsigned long)
void Notification::didFinishLoading(unsigned long, double)
{
finishLoading();
}
......
......@@ -106,7 +106,7 @@ namespace WebCore {
virtual void didReceiveResponse(const ResourceResponse&);
virtual void didReceiveData(const char* data, int lengthReceived);
virtual void didFinishLoading(unsigned long identifier);
virtual void didFinishLoading(unsigned long identifier, double finishTime);
virtual void didFail(const ResourceError&);
virtual void didFailRedirectCheck();
virtual void didReceiveAuthenticationCancellation(const ResourceResponse&);
......
......@@ -196,7 +196,7 @@ void EventSource::didReceiveData(const char* data, int length)
parseEventStream();
}
void EventSource::didFinishLoading(unsigned long)
void EventSource::didFinishLoading(unsigned long, double)
{
if (m_receiveBuf.size() > 0 || m_data.size() > 0) {
append(m_receiveBuf, "\n\n");
......
......@@ -91,8 +91,8 @@ namespace WebCore {
virtual EventTargetData* ensureEventTargetData();
virtual void didReceiveResponse(const ResourceResponse&);
virtual void didReceiveData(const char* data, int length);
virtual void didFinishLoading(unsigned long);
virtual void didReceiveData(const char*, int);
virtual void didFinishLoading(unsigned long, double);
virtual void didFail(const ResourceError&);
virtual void didFailRedirectCheck();
......
......@@ -134,7 +134,7 @@ void WorkerScriptLoader::didReceiveData(const char* data, int len)
m_script += m_decoder->decode(data, len);
}
void WorkerScriptLoader::didFinishLoading(unsigned long identifier)
void WorkerScriptLoader::didFinishLoading(unsigned long identifier, double)
{
if (m_failed)
return;
......
......@@ -59,7 +59,7 @@ namespace WebCore {
virtual void didReceiveResponse(const ResourceResponse&);
virtual void didReceiveData(const char* data, int lengthReceived);
virtual void didFinishLoading(unsigned long identifier);
virtual void didFinishLoading(unsigned long identifier, double);
virtual void didFail(const ResourceError&);
virtual void didFailRedirectCheck();
virtual void didReceiveAuthenticationCancellation(const ResourceResponse&);
......
......@@ -987,7 +987,7 @@ void XMLHttpRequest::didFailRedirectCheck()
networkError();
}
void XMLHttpRequest::didFinishLoading(unsigned long identifier)
void XMLHttpRequest::didFinishLoading(unsigned long identifier, double)
{
if (m_error)
return;
......@@ -999,7 +999,7 @@ void XMLHttpRequest::didFinishLoading(unsigned long identifier)
m_responseBuilder.append(m_decoder->flush());
m_responseBuilder.shrinkToFit();
#if ENABLE(XHR_RESPONSE_BLOB)
// FIXME: Set m_responseBlob to something here in the ResponseTypeBlob case.
#endif
......
......@@ -154,7 +154,7 @@ private:
virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
virtual void didReceiveResponse(const ResourceResponse&);
virtual void didReceiveData(const char* data, int lengthReceived);
virtual void didFinishLoading(unsigned long identifier);
virtual void didFinishLoading(unsigned long identifier, double finishTime);
virtual void didFail(const ResourceError&);
virtual void didFailRedirectCheck();
virtual void didReceiveAuthenticationCancellation(const ResourceResponse&);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment