Reviewed by Brady.
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Nov 2006 03:26:15 +0000 (03:26 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Nov 2006 03:26:15 +0000 (03:26 +0000)
        Get rid of PlatformResponse, the platform specific response object is stored inside of
        the ResourceResponse object now. This also gets rid of receivedResponse in ResourceHandleClient.

        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge getData:andResponse:forURL:]):
        (-[WebCoreFrameBridge getAllResourceDatas:andResponses:]):
        * loader/CachedResource.cpp:
        (WebCore::CachedResource::CachedResource):
        (WebCore::CachedResource::~CachedResource):
        * loader/CachedResource.h:
        (WebCore::CachedResource::response):
        * loader/loader.cpp:
        * loader/loader.h:
        * loader/mac/ImageDocumentMac.mm:
        (WebCore::finishImageLoad):
        * loader/mac/LoaderFunctionsMac.mm:
        (WebCore::CheckCacheObjectStatus):
        * loader/mac/SubresourceLoaderMac.mm:
        (WebCore::SubresourceLoader::didReceiveResponse):
        * platform/network/ResourceHandle.h:
        * platform/network/ResourceResponse.h:
        (WebCore::ResourceResponse::nsURLResponse):
        (WebCore::ResourceResponse::cfURLResponse):
        * platform/network/mac/ResourceHandleMac.mm:
        (WebCore::ResourceHandle::didReceiveResponse):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17937 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
WebCore/ChangeLog
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/loader/CachedResource.cpp
WebCore/loader/CachedResource.h
WebCore/loader/loader.cpp
WebCore/loader/loader.h
WebCore/loader/mac/ImageDocumentMac.mm
WebCore/loader/mac/LoaderFunctionsMac.mm
WebCore/loader/mac/SubresourceLoaderMac.mm
WebCore/platform/network/ResourceHandle.h
WebCore/platform/network/ResourceResponse.h
WebCore/platform/network/mac/ResourceHandleMac.mm

index 24d6243ef03ce74fbbb0f0a7f8e4ae3852fd8dad..d053cc275cf6ee43d58e0860a3248dda4c024516 100644 (file)
@@ -1,3 +1,33 @@
+2006-11-29  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Brady.
+
+        Get rid of PlatformResponse, the platform specific response object is stored inside of 
+        the ResourceResponse object now. This also gets rid of receivedResponse in ResourceHandleClient.
+        
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge getData:andResponse:forURL:]):
+        (-[WebCoreFrameBridge getAllResourceDatas:andResponses:]):
+        * loader/CachedResource.cpp:
+        (WebCore::CachedResource::CachedResource):
+        (WebCore::CachedResource::~CachedResource):
+        * loader/CachedResource.h:
+        (WebCore::CachedResource::response):
+        * loader/loader.cpp:
+        * loader/loader.h:
+        * loader/mac/ImageDocumentMac.mm:
+        (WebCore::finishImageLoad):
+        * loader/mac/LoaderFunctionsMac.mm:
+        (WebCore::CheckCacheObjectStatus):
+        * loader/mac/SubresourceLoaderMac.mm:
+        (WebCore::SubresourceLoader::didReceiveResponse):
+        * platform/network/ResourceHandle.h:
+        * platform/network/ResourceResponse.h:
+        (WebCore::ResourceResponse::nsURLResponse):
+        (WebCore::ResourceResponse::cfURLResponse):
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::didReceiveResponse):
+
 2006-11-29  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by sullivan
index 600f8e36ea8660507a7b139f0590a76532d7ff27..fee7d23dbb5a8ffe92b0261d131dd84e131525ee 100644 (file)
@@ -1616,7 +1616,7 @@ static NSCharacterSet *_getPostSmartSet(void)
         return NO;
 
     *data = resource->allData();
-    *response = resource->platformResponse();
+    *response = resource->response().nsURLResponse();
     return YES;
 }
 
@@ -1638,7 +1638,7 @@ static NSCharacterSet *_getPostSmartSet(void)
     HashMap<String, CachedResource*>::const_iterator end = allResources.end();
     for (HashMap<String, CachedResource*>::const_iterator it = allResources.begin(); it != end; ++it) {
         [d addObject:it->second->allData()];
-        [r addObject:it->second->platformResponse()];
+        [r addObject:it->second->response().nsURLResponse()];
     }
 
     *datas = [d autorelease];
index 15eeae806b364ab1b54ad6b3f6348ee36c40ce0d..1bb93c7c4fd8ef49f22df9a7769fb3a59c255853 100644 (file)
@@ -49,7 +49,6 @@ CachedResource::CachedResource(const String& URL, Type type, CachePolicy cachePo
     m_inCache = false;
     m_cachePolicy = cachePolicy;
     m_request = 0;
-    m_platformResponse = 0;
     m_allData = 0;
     m_expireDateChanged = false;
     m_accessCount = 0;
@@ -68,7 +67,6 @@ CachedResource::~CachedResource()
 #ifndef NDEBUG
     m_deleted = true;
 #endif
-    setPlatformResponse(0);
     setAllData(0);
 }
 
index 57c19c6a652eebd2ac81e3692a3111e5e37e3880..e0f980aec1e86a7d0f80ce42138c0247dca1f670 100644 (file)
@@ -121,13 +121,12 @@ public:
 
     void setRequest(Request*);
 
-    PlatformResponse platformResponse() const { return m_platformResponse; }
-    void setPlatformResponse(PlatformResponse);
     PlatformData allData() const { return m_allData; }
     void setAllData(PlatformData);
 
     void setResponse(const ResourceResponse& response) { m_response = response; }
-
+    const ResourceResponse& response() const { return m_response; }
+    
     bool canDelete() const { return !referenced() && !m_request; }
 
     bool isExpired() const;
@@ -157,7 +156,6 @@ protected:
 #endif
 
     ResourceResponse m_response;
-    PlatformResponse m_platformResponse;
     PlatformData m_allData;
 
     Type m_type;
index 66d658b7a20e0deba9ec70cded99910ddadf2995..e92f0adc69dbfc3c5036607bf4537886e86c7d7b 100644 (file)
@@ -136,17 +136,6 @@ void Loader::didFailWithError(ResourceHandle* handle, const ResourceError& error
     servePendingRequests();
 }
 
-void Loader::receivedResponse(ResourceHandle* handle, PlatformResponse response)
-{
-    Request* req = m_requestsLoading.get(handle);
-    ASSERT(req);
-#if !PLATFORM(WIN)
-    // FIXME: the win32 platform does not have PlatformResponse yet.
-    ASSERT(response);
-#endif
-    req->cachedResource()->setPlatformResponse(response);
-}
-
 void Loader::didReceiveResponse(ResourceHandle* handle, const ResourceResponse& response)
 {
     Request* req = m_requestsLoading.get(handle);
index 8610ffa69a1f83690ead23f6697344ae54bde503..bde04f0759954a2458141a9a6ac321ca3d053257 100644 (file)
@@ -63,7 +63,6 @@ namespace WebCore {
         ResourceHandle* jobForRequest(const String& URL) const;
 
     private:
-        virtual void receivedResponse(ResourceHandle*, PlatformResponse);
         virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&);
         virtual void didReceiveData(ResourceHandle*, const char*, int);
         virtual void receivedAllData(ResourceHandle*, PlatformData);
index 79f903851a5ca5bde22632cea2877ce9cf79992e..503fe2bc3a5e34690b90e9a63fcd09bd7895f2e3 100644 (file)
@@ -45,7 +45,6 @@ void finishImageLoad(Document* document, CachedImage* image, const void* imageDa
 
     Frame* frame = document->frame();
     NSURLResponse *response = frame->loader()->documentLoader()->response();
-    image->setPlatformResponse(response);
 
     IntSize size = image->imageSize();
     if (size.width())
index 9a6b2648b6ee547829a3bfdb9fbc3b1df60fd591..9254967dcf276e22410f3124f574ff25a61038d4 100644 (file)
@@ -129,8 +129,6 @@ void CheckCacheObjectStatus(DocLoader *loader, CachedResource *cachedResource)
         return;
     }
     
-    ASSERT(cachedResource->platformResponse());
-    
     // Notify the caller that we "loaded".
     FrameMac *frame = static_cast<FrameMac *>(loader->frame());
 
@@ -138,7 +136,7 @@ void CheckCacheObjectStatus(DocLoader *loader, CachedResource *cachedResource)
         return;
         
     NSURLRequest *request = cachedResource->getNSURLRequest();
-    NSURLResponse *response = cachedResource->platformResponse();
+    NSURLResponse *response = cachedResource->response().nsURLResponse();
     NSData *data = cachedResource->allData();
     
     // FIXME: If the WebKit client changes or cancels the request, WebCore does not respect this and continues the load.
@@ -195,16 +193,6 @@ bool ResponseIsMultipart(PlatformResponse response)
     return false;
 }
 
-void CachedResource::setPlatformResponse(PlatformResponse response)
-{
-    HardRetain(response);
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    HardRelease(m_platformResponse);
-    END_BLOCK_OBJC_EXCEPTIONS;
-
-    m_platformResponse = response;
-}
-
 void CachedResource::setAllData(PlatformData allData)
 {
     HardRetain(allData);
index 272be58068d0a4c60b919b6cf550365c1b58baa7..aab6d813eeb1e7b23c43e6226ad2ed9f1de56259 100644 (file)
@@ -125,7 +125,7 @@ void SubresourceLoader::didReceiveResponse(NSURLResponse *r)
     // anything including removing the last reference to this object; one example of this is 3266216.
     RefPtr<SubresourceLoader> protect(this);
 
-    m_handle->receivedResponse(r);
+    m_handle->didReceiveResponse(r);
     // The loader can cancel a load if it receives a multipart response for a non-image
     if (reachedTerminalState())
         return;
index c864bedd9b603117a03fd1fa80e81fd1d255003a..ec0189058778ae63dcd0360c8590735c25c9cb9b 100644 (file)
@@ -78,6 +78,7 @@ public:
 
 #if PLATFORM(MAC)
     NSURLRequest *willSendRequest(NSURLRequest *, NSURLResponse *);
+    void didReceiveResponse(NSURLResponse *);  
     void addData(NSData *);
     void finishJobAndHandle(NSData *);
     void reportError(NSError* error);
@@ -106,8 +107,6 @@ public:
     
     ResourceHandleClient* client() const;
 
-    void receivedResponse(PlatformResponse);
-
     const HTTPHeaderMap& requestHeaders() const;
     const KURL& url() const;
     const String& method() const;
index 32c86464e538e1167fb98e82a814a867270dd9f5..d06ccb5298d0e6a5ae65b397dacd0eb5d364fa2a 100644 (file)
@@ -96,10 +96,14 @@ public:
     ResourceResponse(NSURLResponse* nsResponse)
         : m_isUpToDate(false)
         , m_nsResponse(nsResponse) { }
+    
+    NSURLResponse *nsURLResponse() const { return m_nsResponse.get(); }
 #elif USE(CFNETWORK)
     ResourceResponse(CFURLResponseRef cfResponse)
         : m_isUpToDate(false)
         , m_cfResponse(cfResponse) { }
+    
+    CFURLResponseRef cfURLResponse() const { return m_cfResponse.get(); }
 #endif
     
  private:
index 7a11bcfb10c3fcb5774be451724a830dace0bc04..1b10da96f8e45d0fe96db1e2ecd5d5a3377e1dc7 100644 (file)
@@ -81,14 +81,12 @@ bool ResourceHandle::start(DocLoader* docLoader)
     return false;
 }
 
-void ResourceHandle::receivedResponse(NSURLResponse* nsResponse)
+void ResourceHandle::didReceiveResponse(NSURLResponse* nsResponse)
 {
     ASSERT(nsResponse);
 
-    if (client()) {
-        client()->receivedResponse(this, nsResponse);
-        client()->didReceiveResponse(this, nsResponse);
-    }
+    if (ResourceHandleClient* c = client())
+        c->didReceiveResponse(this, nsResponse);
 }
 
 void ResourceHandle::cancel()