2006-10-14 David Carson <dacarson@gmail.com>
authorbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Oct 2006 09:42:25 +0000 (09:42 +0000)
committerbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Oct 2006 09:42:25 +0000 (09:42 +0000)
        Reviewed by Maciej.

        Fix: http://bugs.webkit.org/show_bug.cgi?id=11257
        Removed Mac platform dependance, changed WebCore functions to
        use PlatformResponse/PlatformData rather than NSURLResponse/
        NSData.

        * loader/CachedCSSStyleSheet.cpp:
        (WebCore::CachedCSSStyleSheet::checkNotify):
        * loader/CachedImage.cpp:
        (WebCore::CachedImage::createImage):
        * loader/CachedResource.cpp:
        (WebCore::CachedResource::~CachedResource):
        * loader/CachedResource.h:
        (WebCore::CachedResource::CachedResource):
        (WebCore::CachedResource::response):
        (WebCore::CachedResource::allData):
        * loader/LoaderFunctions.h:
        * loader/loader.cpp:
        (WebCore::Loader::receivedResponse):
        * loader/mac/LoaderFunctionsMac.mm:
        (WebCore::ResponseMIMEType):
        (WebCore::ResponseIsMultipart):
        (WebCore::CacheObjectExpiresTime):
        (WebCore::CachedResource::setResponse):
        (WebCore::CachedResource::setAllData):
        * platform/qt/TemporaryLinkStubs.cpp:
        (WebCore::CacheObjectExpiresTime):
        (WebCore::ResponseIsMultipart):
        (WebCore::ResponseMIMEType):
        (WebCore::CachedResource::setResponse):
        (WebCore::CachedResource::setAllData):
        * platform/win/TemporaryLinkStubs.cpp:
        (WebCore::CacheObjectExpiresTime):
        (WebCore::ResponseIsMultipart):
        (WebCore::ResponseMIMEType):
        (WebCore::CachedResource::setResponse):
        (WebCore::CachedResource::setAllData):

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

WebCore/ChangeLog
WebCore/loader/CachedCSSStyleSheet.cpp
WebCore/loader/CachedImage.cpp
WebCore/loader/CachedResource.cpp
WebCore/loader/CachedResource.h
WebCore/loader/LoaderFunctions.h
WebCore/loader/loader.cpp
WebCore/loader/mac/LoaderFunctionsMac.mm
WebCore/platform/qt/TemporaryLinkStubs.cpp
WebCore/platform/win/TemporaryLinkStubs.cpp

index 9909ebf5823caa89ae204d7fd735607f901cba40..4be18e2667f512ebc0f2f870be207d6ac432f784 100644 (file)
@@ -1,3 +1,44 @@
+2006-10-14  David Carson  <dacarson@gmail.com>
+
+        Reviewed by Maciej.
+
+        Fix: http://bugs.webkit.org/show_bug.cgi?id=11257
+        Removed Mac platform dependance, changed WebCore functions to
+        use PlatformResponse/PlatformData rather than NSURLResponse/
+        NSData. 
+
+        * loader/CachedCSSStyleSheet.cpp:
+        (WebCore::CachedCSSStyleSheet::checkNotify):
+        * loader/CachedImage.cpp:
+        (WebCore::CachedImage::createImage):
+        * loader/CachedResource.cpp:
+        (WebCore::CachedResource::~CachedResource):
+        * loader/CachedResource.h:
+        (WebCore::CachedResource::CachedResource):
+        (WebCore::CachedResource::response):
+        (WebCore::CachedResource::allData):
+        * loader/LoaderFunctions.h:
+        * loader/loader.cpp:
+        (WebCore::Loader::receivedResponse):
+        * loader/mac/LoaderFunctionsMac.mm:
+        (WebCore::ResponseMIMEType):
+        (WebCore::ResponseIsMultipart):
+        (WebCore::CacheObjectExpiresTime):
+        (WebCore::CachedResource::setResponse):
+        (WebCore::CachedResource::setAllData):
+        * platform/qt/TemporaryLinkStubs.cpp:
+        (WebCore::CacheObjectExpiresTime):
+        (WebCore::ResponseIsMultipart):
+        (WebCore::ResponseMIMEType):
+        (WebCore::CachedResource::setResponse):
+        (WebCore::CachedResource::setAllData):
+        * platform/win/TemporaryLinkStubs.cpp:
+        (WebCore::CacheObjectExpiresTime):
+        (WebCore::ResponseIsMultipart):
+        (WebCore::ResponseMIMEType):
+        (WebCore::CachedResource::setResponse):
+        (WebCore::CachedResource::setAllData):
+
 2006-10-14  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
 
         Reviewed by Maciej.
index 9365514f7554596538757a7b6e1f09901225ff55..3860f370b8a50f5714a559fb6e8432147c69462f 100644 (file)
@@ -95,11 +95,9 @@ void CachedCSSStyleSheet::checkNotify()
 
     CachedResourceClientWalker w(m_clients);
     while (CachedResourceClient *c = w.next()) {
-#if __APPLE__
         if (m_response && !IsResponseURLEqualToURL(m_response, m_url))
             c->setCSSStyleSheet(ResponseURL(m_response), m_decoder->encoding().name(), m_sheet);
         else
-#endif
             c->setCSSStyleSheet(m_url, m_decoder->encoding().name(), m_sheet);
     }
 }
index b7529523496d9f185c80180994f2c8b90f36f741..66f39b92c5f1a5f85265df9141f75f611c7dee18 100644 (file)
@@ -115,11 +115,7 @@ inline void CachedImage::createImage()
 {
     // Create the image if it doesn't yet exist.
     if (!m_image)
-#if __APPLE__
         m_image = new Image(this, ResponseMIMEType(m_response) == "application/pdf");
-#else
-        m_image = new Image(this, false);
-#endif
 }
 
 Vector<char>& CachedImage::bufferData(const char* bytes, int addedSize, Request* request)
index 45f520ae0723e9af035c4b25c47f005324b95b21..24f2ea85a665eccb4d45dd85b4aedf87edfc4dee 100644 (file)
@@ -42,10 +42,8 @@ CachedResource::~CachedResource()
         abort();
     Cache::removeFromLRUList(this);
     m_deleted = true;
-#if __APPLE__
     setResponse(0);
     setAllData(0);
-#endif
 }
 
 Vector<char>& CachedResource::bufferData(const char* bytes, int addedSize, Request* request)
index a9b70ad2a1d5e8b09a1a33d77f99643edf0c45f8..9590b6a17d3e994701a2005245e08202d15acb82 100644 (file)
 
 #include "CachePolicy.h"
 #include "PlatformString.h"
+#include "ResourceLoaderClient.h" // defines PlatformResponse and PlatformData
 #include <wtf/HashSet.h>
 #include <wtf/Vector.h>
 #include <time.h>
 
-#ifdef __OBJC__
-@class NSData;
-@class NSURLResponse;
-#else
-class NSData;
-class NSURLResponse;
-#endif
-
 namespace WebCore {
     class CachedResourceClient;
     class Request;
@@ -86,10 +79,8 @@ namespace WebCore {
             m_free = false;
             m_cachePolicy = cachePolicy;
             m_request = 0;
-#if __APPLE__
             m_response = 0;
             m_allData = 0;
-#endif
             m_expireDate = expireDate;
             m_deleted = false;
             m_expireDateChanged = false;
@@ -143,12 +134,10 @@ namespace WebCore {
 
         void setRequest(Request*);
 
-#if __APPLE__
-        NSURLResponse* response() const { return m_response; }
-        void setResponse(NSURLResponse*);
-        NSData* allData() const { return m_allData; }
-        void setAllData(NSData*);
-#endif
+        PlatformResponse response() const { return m_response; }
+        void setResponse(PlatformResponse);
+        PlatformData allData() const { return m_allData; }
+        void setAllData(PlatformData);
 
         bool canDelete() const { return m_clients.isEmpty() && !m_request; }
 
@@ -172,10 +161,8 @@ namespace WebCore {
         String m_accept;
         Request* m_request;
 
-#if __APPLE__
-        NSURLResponse *m_response;
-        NSData *m_allData;
-#endif
+        PlatformResponse m_response;
+        PlatformData m_allData;
 
         Type m_type;
         Status m_status;
index 2407916f50ecef17b31d0f58b62d759a0762d9a0..891063afa558d953f5879be50959b0cd59960b7a 100644 (file)
  */
 
 #include <wtf/Vector.h>
+#include "ResourceLoaderClient.h"  // Defines PlatformResponse
 
 #ifdef __OBJC__
 @class NSDictionary;
 @class NSString;
-@class NSURLResponse;
 
 @interface NSDictionary (WebCore_Extras)
 + (id)_webcore_dictionaryWithHeaderString:(NSString *)string;
@@ -37,7 +37,6 @@
 #else
 class NSDictionary;
 class NSString;
-class NSURLResponse;
 #endif
 
 namespace WebCore {
@@ -45,22 +44,20 @@ namespace WebCore {
 class CachedResource;
 class DeprecatedString;
 class DocLoader;
-class KURL;
 class Loader;
 class Request;
 class String;
-class ResourceLoader;
 
 Vector<char> ServeSynchronousRequest(Loader*, DocLoader*, ResourceLoader*, KURL& finalURL, DeprecatedString& headers);
 
 void CheckCacheObjectStatus(DocLoader*, CachedResource*);
 bool CheckIfReloading(DocLoader*);
-bool IsResponseURLEqualToURL(NSURLResponse*, const String& URL);
-DeprecatedString ResponseURL(NSURLResponse*);
-DeprecatedString ResponseMIMEType(NSURLResponse*);
-bool ResponseIsMultipart(NSURLResponse*);
+bool IsResponseURLEqualToURL(PlatformResponse , const String& URL);
+DeprecatedString ResponseURL(PlatformResponse);
+DeprecatedString ResponseMIMEType(PlatformResponse);
+bool ResponseIsMultipart(PlatformResponse);
 int NumberOfPendingOrLoadingRequests(DocLoader*);
-time_t CacheObjectExpiresTime(DocLoader*, NSURLResponse*);
+time_t CacheObjectExpiresTime(DocLoader*, PlatformResponse);
 NSString* HeaderStringFromDictionary(NSDictionary* headers, int statusCode);
 
 }
index b9628870e86219f1aabecc61c4473260ac836d6a..4b2a3267362bca3c7617ff6271b8f081c442b82b 100644 (file)
@@ -121,7 +121,6 @@ void Loader::receivedAllData(ResourceLoader* job, PlatformData allData)
 
 void Loader::receivedResponse(ResourceLoader* job, PlatformResponse response)
 {
-#ifdef __APPLE__
     Request* req = m_requestsLoading.get(job);
     ASSERT(req);
     ASSERT(response);
@@ -142,7 +141,6 @@ void Loader::receivedResponse(ResourceLoader* job, PlatformResponse response)
         if (!req->cachedObject()->isImage())
             job->cancel();
     }
-#endif
 }
 
 void Loader::receivedData(ResourceLoader* job, const char* data, int size)
index 0f168fd801627b924b6936cca8de2fa5d00d4e66..b435f570c8b97d7db568e81ebe471b9962167513 100644 (file)
@@ -216,7 +216,7 @@ void CheckCacheObjectStatus(DocLoader *loader, CachedResource *cachedObject)
     }
 }
 
-bool IsResponseURLEqualToURL(NSURLResponse *response, const String& m_url)
+bool IsResponseURLEqualToURL(PlatformResponse response, const String& m_url)
 {
     NSURL *responseURL = [(NSURLResponse *)response URL];
     NSString *urlString = [responseURL absoluteString];
@@ -230,7 +230,7 @@ bool IsResponseURLEqualToURL(NSURLResponse *response, const String& m_url)
     return !memcmp(buffer.data(), m_url.characters(), length * sizeof(UChar));
 }
 
-DeprecatedString ResponseURL(NSURLResponse *response)
+DeprecatedString ResponseURL(PlatformResponse response)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
@@ -246,7 +246,7 @@ DeprecatedString ResponseURL(NSURLResponse *response)
     return NULL;
 }
 
-DeprecatedString ResponseMIMEType(NSURLResponse *response)
+DeprecatedString ResponseMIMEType(PlatformResponse response)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     return DeprecatedString::fromNSString([(NSURLResponse *)response MIMEType]);
@@ -255,7 +255,7 @@ DeprecatedString ResponseMIMEType(NSURLResponse *response)
     return DeprecatedString();
 }
 
-bool ResponseIsMultipart(NSURLResponse *response)
+bool ResponseIsMultipart(PlatformResponse response)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     return [[response MIMEType] isEqualToString:@"multipart/x-mixed-replace"];
@@ -264,7 +264,7 @@ bool ResponseIsMultipart(NSURLResponse *response)
     return false;
 }
 
-time_t CacheObjectExpiresTime(DocLoader *docLoader, NSURLResponse *response)
+time_t CacheObjectExpiresTime(DocLoader *docLoader, PlatformResponse response)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     
@@ -279,7 +279,7 @@ time_t CacheObjectExpiresTime(DocLoader *docLoader, NSURLResponse *response)
     return 0;
 }
 
-void CachedResource::setResponse(NSURLResponse *response)
+void CachedResource::setResponse(PlatformResponse response)
 {
     HardRetain(response);
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -289,7 +289,7 @@ void CachedResource::setResponse(NSURLResponse *response)
     m_response = response;
 }
 
-void CachedResource::setAllData(NSData *allData)
+void CachedResource::setAllData(PlatformData allData)
 {
     HardRetain(allData);
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
index 8719b35c76aa59c6ca5588e7256cdd954ef59113..0e295562b777f311678a57ac093ffa3afad00e25 100644 (file)
@@ -148,6 +148,13 @@ bool IconDatabase::setIconURLForPageURL(const String& iconURL, const String& pag
 void CheckCacheObjectStatus(DocLoader*, CachedResource*) { }
 bool CheckIfReloading(WebCore::DocLoader*) { return false; }
 Vector<char> ServeSynchronousRequest(Loader*, DocLoader*, ResourceLoader*, KURL&, DeprecatedString&) { notImplemented(); return Vector<char>(); }
+time_t CacheObjectExpiresTime(DocLoader*, PlatformResponse*) { return 0; }
+bool ResponseIsMultipart(PlatformResponse*) { return false; }
+DeprecatedString ResponseMIMEType(PlatformResponse) { return DeprecatedString(); }
+bool IsResponseURLEqualToURL(PlatformResponse , const String& URL) { return false; }
+DeprecatedString ResponseURL(PlatformResponse) { return DeprecatedString(); }
+CachedResource::setResponse(PlatformResponse) { notImplemented(); }
+CachedResource::setAllData(PlatformData) { notImplemented(); }
 }
 
 bool WebCore::historyContains(DeprecatedString const&) { return false; }
index de57b78a3a00443a51cd515419f089ce0f365e6d..8a9533975747cfa3d076d53ed445a0f27514786e 100644 (file)
@@ -255,6 +255,13 @@ namespace WebCore {
 
 bool CheckIfReloading(WebCore::DocLoader*) { return false; }
 void CheckCacheObjectStatus(DocLoader*, CachedResource*) { }
+time_t CacheObjectExpiresTime(DocLoader*, PlatformResponse*) { return 0; }
+bool ResponseIsMultipart(PlatformResponse*) { return false; }
+DeprecatedString ResponseMIMEType(PlatformResponse) { return DeprecatedString(); }
+bool IsResponseURLEqualToURL(PlatformResponse , const String& URL) { return false; }
+DeprecatedString ResponseURL(PlatformResponse) { return DeprecatedString(); }
+CachedResource::setResponse(PlatformResponse) { notImplemented(); }
+CachedResource::setAllData(PlatformData) { notImplemented(); }
 
 }