2011-02-16 Bill Budge <bbudge@chromium.org>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Feb 2011 04:11:38 +0000 (04:11 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Feb 2011 04:11:38 +0000 (04:11 +0000)
        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

17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/fileapi/FileReaderLoader.cpp
Source/WebCore/fileapi/FileReaderLoader.h
Source/WebCore/loader/DocumentThreadableLoader.cpp
Source/WebCore/loader/DocumentThreadableLoader.h
Source/WebCore/loader/ThreadableLoaderClient.h
Source/WebCore/loader/ThreadableLoaderClientWrapper.h
Source/WebCore/loader/WorkerThreadableLoader.cpp
Source/WebCore/loader/WorkerThreadableLoader.h
Source/WebCore/notifications/Notification.cpp
Source/WebCore/notifications/Notification.h
Source/WebCore/page/EventSource.cpp
Source/WebCore/page/EventSource.h
Source/WebCore/workers/WorkerScriptLoader.cpp
Source/WebCore/workers/WorkerScriptLoader.h
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XMLHttpRequest.h

index 82fc102..b012014 100644 (file)
@@ -1,3 +1,48 @@
+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.
index 24904e2..07b32a6 100644 (file)
@@ -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)
index a15ee01..7e3f442 100644 (file)
@@ -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();
index e0b75a7..33c8310 100644 (file)
@@ -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)
index 1a5c1c9..94884ce 100644 (file)
@@ -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();
index cea8b0f..45cbaac 100644 (file)
@@ -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() { }
 
index d3c1a9f..664e0b3 100644 (file)
@@ -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)
index 4d18c28..6c61318 100644 (file)
@@ -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)
index 65cc637..2477f19 100644 (file)
@@ -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&);
index 4cb2f85..2facd1b 100644 (file)
@@ -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();
 }
index 73131e5..b5c6b9a 100644 (file)
@@ -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&);
index 39f15e9..08d0868 100644 (file)
@@ -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");
index 10ad6ba..3385d90 100644 (file)
@@ -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();
 
index 2224d87..9a9051a 100644 (file)
@@ -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;
index 98e21e1..4f045b5 100644 (file)
@@ -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&);
index 8cea82c..d6e6182 100644 (file)
@@ -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
index 1f078a2..0f461e1 100644 (file)
@@ -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&);