2009-06-05 Antti Koivisto <antti@apple.com>
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Jun 2009 07:36:17 +0000 (07:36 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Jun 2009 07:36:17 +0000 (07:36 +0000)
        Try to fix Windows (and possibly other platforms) build.

        Restore ResourceResponseBase::lastModifiedDate() and setLastModifiedDate() removed in previous commit.
        for now since PluginStream used on some platforms expects them and calculations differ from plain
        Last-modified header value.

        Also include <wtf/MathExtras.h> to get isfinite().

        * platform/network/ResourceResponseBase.cpp:
        (WebCore::ResourceResponseBase::adopt):
        (WebCore::ResourceResponseBase::copyData):
        (WebCore::ResourceResponseBase::setLastModifiedDate):
        (WebCore::ResourceResponseBase::lastModifiedDate):
        * platform/network/ResourceResponseBase.h:
        * platform/network/cf/ResourceResponseCFNet.cpp:
        (WebCore::ResourceResponse::platformLazyInit):

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

WebCore/ChangeLog
WebCore/loader/CachedResource.cpp
WebCore/platform/network/ResourceResponseBase.cpp
WebCore/platform/network/ResourceResponseBase.h
WebCore/platform/network/cf/ResourceResponseCFNet.cpp

index 73b938a..7617c4a 100644 (file)
@@ -1,3 +1,22 @@
+2009-06-05  Antti Koivisto  <antti@apple.com>
+
+        Try to fix Windows (and possibly other platforms) build.
+
+        Restore ResourceResponseBase::lastModifiedDate() and setLastModifiedDate() removed in previous commit.
+        for now since PluginStream used on some platforms expects them and calculations differ from plain 
+        Last-modified header value.
+        
+        Also include <wtf/MathExtras.h> to get isfinite().
+
+        * platform/network/ResourceResponseBase.cpp:
+        (WebCore::ResourceResponseBase::adopt):
+        (WebCore::ResourceResponseBase::copyData):
+        (WebCore::ResourceResponseBase::setLastModifiedDate):
+        (WebCore::ResourceResponseBase::lastModifiedDate):
+        * platform/network/ResourceResponseBase.h:
+        * platform/network/cf/ResourceResponseCFNet.cpp:
+        (WebCore::ResourceResponse::platformLazyInit):
+
 2009-06-03  Antti Koivisto  <antti@apple.com>
 
         Reviewed by Dave Kilzer.
index 950fca8..dceeec0 100644 (file)
@@ -33,6 +33,7 @@
 #include "PurgeableBuffer.h"
 #include "Request.h"
 #include <wtf/CurrentTime.h>
+#include <wtf/MathExtras.h>
 #include <wtf/RefCountedLeakCounter.h>
 #include <wtf/Vector.h>
 
index 7d2d773..3f8917f 100644 (file)
@@ -30,6 +30,7 @@
 #include "ResourceResponse.h"
 #include <runtime/DateMath.h>
 #include <wtf/CurrentTime.h>
+#include <wtf/MathExtras.h>
 #include <wtf/StdLibExtras.h>
 
 using namespace std;
@@ -80,6 +81,8 @@ auto_ptr<ResourceResponse> ResourceResponseBase::adopt(auto_ptr<CrossThreadResou
 
     response->lazyInit();
     response->m_httpHeaderFields.adopt(std::auto_ptr<CrossThreadHTTPHeaderMapData>(data->m_httpHeaders.release()));
+    response->setLastModifiedDate(data->m_lastModifiedDate);
+
     return response;
 }
 
@@ -94,6 +97,7 @@ auto_ptr<CrossThreadResourceResponseData> ResourceResponseBase::copyData() const
     data->m_httpStatusCode = httpStatusCode();
     data->m_httpStatusText = httpStatusText().copy();
     data->m_httpHeaders.adopt(httpHeaderFields().copyData());
+    data->m_lastModifiedDate = lastModifiedDate();
     return data;
 }
 
@@ -398,6 +402,20 @@ bool ResourceResponseBase::isAttachment() const
     DEFINE_STATIC_LOCAL(const AtomicString, attachmentString, ("attachment"));
     return equalIgnoringCase(value, attachmentString);
 }
+  
+void ResourceResponseBase::setLastModifiedDate(time_t lastModifiedDate)
+{
+    lazyInit();
+
+    m_lastModifiedDate = lastModifiedDate;
+}
+
+time_t ResourceResponseBase::lastModifiedDate() const
+{
+    lazyInit();
+
+    return m_lastModifiedDate;
+}
 
 void ResourceResponseBase::lazyInit() const
 {
index c437097..7138908 100644 (file)
@@ -77,6 +77,11 @@ public:
     bool isMultipart() const { return mimeType() == "multipart/x-mixed-replace"; }
 
     bool isAttachment() const;
+    
+    // FIXME: These are used by PluginStream on some platforms. Calculations may differ from just returning plain Last-odified header.
+    // Leaving it for now but this should go away in favor of generic solution.
+    void setLastModifiedDate(time_t);
+    time_t lastModifiedDate() const; 
 
     // These functions return parsed values of the corresponding response headers.
     // NaN means that the header was not present or had invalid value.
@@ -117,6 +122,7 @@ protected:
     int m_httpStatusCode;
     String m_httpStatusText;
     HTTPHeaderMap m_httpHeaderFields;
+    time_t m_lastModifiedDate;
 
     bool m_isNull : 1;
     
@@ -151,6 +157,7 @@ struct CrossThreadResourceResponseData {
     int m_httpStatusCode;
     String m_httpStatusText;
     OwnPtr<CrossThreadHTTPHeaderMapData> m_httpHeaders;
+    time_t m_lastModifiedDate;
 };
 
 } // namespace WebCore
index 32d7421..95e9aff 100644 (file)
@@ -79,6 +79,8 @@ void ResourceResponse::platformLazyInit()
     m_expectedContentLength = CFURLResponseGetExpectedContentLength(m_cfResponse.get());
     m_textEncodingName = CFURLResponseGetTextEncodingName(m_cfResponse.get());
 
+    m_lastModifiedDate = toTimeT(CFURLResponseGetLastModifiedDate(m_cfResponse.get()));
+
     RetainPtr<CFStringRef> suggestedFilename(AdoptCF, CFURLResponseCopySuggestedFilename(m_cfResponse.get()));
     m_suggestedFilename = suggestedFilename.get();