Title: [153333] trunk/Source
Revision
153333
Author
[email protected]
Date
2013-07-25 10:10:34 -0700 (Thu, 25 Jul 2013)

Log Message

Remove lastModifiedDate from ResourceResponse
https://bugs.webkit.org/show_bug.cgi?id=119092

Reviewed by Andreas Kling.

Source/WebCore:

Computing m_lastResponseDate is costly on some platforms and we already have a better way to
get the last response time, so convert the two call sites that used to call ResourceresponseBase::lastModifiedDate()
over to using lastModified() instead.

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

Source/WebKit2:

Update for WebCore changes.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::lastModifiedDate):
Use ResourceResponse::lastModified() to get the last modified date.

(WebKit::PluginView::Stream::didReceiveResponse):
Call the static lastModified function.

(WebKit::PluginView::manualLoadDidReceiveResponse):
Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (153332 => 153333)


--- trunk/Source/WebCore/ChangeLog	2013-07-25 17:10:19 UTC (rev 153332)
+++ trunk/Source/WebCore/ChangeLog	2013-07-25 17:10:34 UTC (rev 153333)
@@ -1,3 +1,25 @@
+2013-07-25  Anders Carlsson  <[email protected]>
+
+        Remove lastModifiedDate from ResourceResponse
+        https://bugs.webkit.org/show_bug.cgi?id=119092
+
+        Reviewed by Andreas Kling.
+
+        Computing m_lastResponseDate is costly on some platforms and we already have a better way to
+        get the last response time, so convert the two call sites that used to call ResourceresponseBase::lastModifiedDate()
+        over to using lastModified() instead.
+
+        * platform/network/ResourceResponseBase.cpp:
+        (WebCore::ResourceResponseBase::ResourceResponseBase):
+        (WebCore::ResourceResponseBase::adopt):
+        (WebCore::ResourceResponseBase::copyData):
+        * platform/network/ResourceResponseBase.h:
+        * platform/network/cf/ResourceResponseCFNet.cpp:
+        (WebCore::ResourceResponse::platformLazyInit):
+        * plugins/PluginStream.cpp:
+        (WebCore::lastModifiedDate):
+        (WebCore::PluginStream::startStream):
+
 2013-07-25  Yi Shen  <[email protected]>
 
         Optimize the thread locks for API Shims

Modified: trunk/Source/WebCore/WebCore.exp.in (153332 => 153333)


--- trunk/Source/WebCore/WebCore.exp.in	2013-07-25 17:10:19 UTC (rev 153332)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-07-25 17:10:34 UTC (rev 153333)
@@ -1509,11 +1509,11 @@
 __ZNK7WebCore20CachedResourceLoader11isPreloadedERKN3WTF6StringE
 __ZNK7WebCore20HTMLTableCellElement9cellAboveEv
 __ZNK7WebCore20ResourceResponseBase12isAttachmentEv
+__ZNK7WebCore20ResourceResponseBase12lastModifiedEv
 __ZNK7WebCore20ResourceResponseBase14httpStatusCodeEv
 __ZNK7WebCore20ResourceResponseBase14httpStatusTextEv
 __ZNK7WebCore20ResourceResponseBase15httpHeaderFieldEPKc
 __ZNK7WebCore20ResourceResponseBase16httpHeaderFieldsEv
-__ZNK7WebCore20ResourceResponseBase16lastModifiedDateEv
 __ZNK7WebCore20ResourceResponseBase16textEncodingNameEv
 __ZNK7WebCore20ResourceResponseBase17suggestedFilenameEv
 __ZNK7WebCore20ResourceResponseBase21expectedContentLengthEv

Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp (153332 => 153333)


--- trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp	2013-07-25 17:10:19 UTC (rev 153332)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp	2013-07-25 17:10:34 UTC (rev 153333)
@@ -47,7 +47,6 @@
 ResourceResponseBase::ResourceResponseBase()  
     : m_expectedContentLength(0)
     , m_httpStatusCode(0)
-    , m_lastModifiedDate(0)
     , m_wasCached(false)
     , m_connectionID(0)
     , m_connectionReused(false)
@@ -75,7 +74,6 @@
     , m_textEncodingName(textEncodingName)
     , m_suggestedFilename(filename)
     , m_httpStatusCode(0)
-    , m_lastModifiedDate(0)
     , m_wasCached(false)
     , m_connectionID(0)
     , m_connectionReused(false)
@@ -110,7 +108,6 @@
 
     response->lazyInit(CommonAndUncommonFields);
     response->m_httpHeaderFields.adopt(data->m_httpHeaders.release());
-    response->setLastModifiedDate(data->m_lastModifiedDate);
     response->setResourceLoadTiming(data->m_resourceLoadTiming.release());
     response->doPlatformAdopt(data);
     return response.release();
@@ -127,7 +124,6 @@
     data->m_httpStatusCode = httpStatusCode();
     data->m_httpStatusText = httpStatusText().isolatedCopy();
     data->m_httpHeaders = httpHeaderFields().copyData();
-    data->m_lastModifiedDate = lastModifiedDate();
     if (m_resourceLoadTiming)
         data->m_resourceLoadTiming = m_resourceLoadTiming->deepCopy();
     return asResourceResponse().doPlatformCopyData(data.release());
@@ -517,22 +513,6 @@
     return equalIgnoringCase(value, attachmentString);
 }
   
-void ResourceResponseBase::setLastModifiedDate(time_t lastModifiedDate)
-{
-    lazyInit(CommonAndUncommonFields);
-
-    m_lastModifiedDate = lastModifiedDate;
-
-    // FIXME: Should invalidate or update platform response if present.
-}
-
-time_t ResourceResponseBase::lastModifiedDate() const
-{
-    lazyInit(CommonAndUncommonFields);
-
-    return m_lastModifiedDate;
-}
-
 bool ResourceResponseBase::wasCached() const
 {
     lazyInit(CommonAndUncommonFields);

Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (153332 => 153333)


--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h	2013-07-25 17:10:19 UTC (rev 153332)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h	2013-07-25 17:10:34 UTC (rev 153333)
@@ -88,11 +88,6 @@
 
     bool isAttachment() const;
     
-    // FIXME: These are used by PluginStream on some platforms. Calculations may differ from just returning plain Last-Modified 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.
     bool cacheControlContainsNoCache() const;
@@ -153,7 +148,6 @@
     int m_httpStatusCode;
     String m_httpStatusText;
     HTTPHeaderMap m_httpHeaderFields;
-    time_t m_lastModifiedDate;
     bool m_wasCached : 1;
     unsigned m_connectionID;
     bool m_connectionReused : 1;
@@ -198,7 +192,6 @@
     int m_httpStatusCode;
     String m_httpStatusText;
     OwnPtr<CrossThreadHTTPHeaderMapData> m_httpHeaders;
-    time_t m_lastModifiedDate;
     RefPtr<ResourceLoadTiming> m_resourceLoadTiming;
 };
 

Modified: trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp (153332 => 153333)


--- trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp	2013-07-25 17:10:19 UTC (rev 153332)
+++ trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp	2013-07-25 17:10:34 UTC (rev 153333)
@@ -95,8 +95,6 @@
         if (textEncodingNameLength >= 2 && m_textEncodingName[0U] == '"' && m_textEncodingName[textEncodingNameLength - 1] == '"')
             m_textEncodingName = m_textEncodingName.substring(1, textEncodingNameLength - 2);
 
-        m_lastModifiedDate = toTimeT(CFURLResponseGetLastModifiedDate(m_cfResponse.get()));
-
         CFHTTPMessageRef httpResponse = CFURLResponseGetHTTPResponse(m_cfResponse.get());
         if (httpResponse) {
             m_httpStatusCode = CFHTTPMessageGetResponseStatusCode(httpResponse);

Modified: trunk/Source/WebCore/plugins/PluginStream.cpp (153332 => 153333)


--- trunk/Source/WebCore/plugins/PluginStream.cpp	2013-07-25 17:10:19 UTC (rev 153332)
+++ trunk/Source/WebCore/plugins/PluginStream.cpp	2013-07-25 17:10:34 UTC (rev 153333)
@@ -121,6 +121,15 @@
     m_client = 0;
 }
 
+static uint32_t lastModifiedDate(const ResourceResponse& response)
+{
+    double lastModified = response.lastModified();
+    if (!std::isfinite(lastModified))
+        return 0;
+
+    return lastModified * 1000;
+}
+
 void PluginStream::startStream()
 {
     ASSERT(m_streamState == StreamBeforeStarted);
@@ -167,7 +176,7 @@
     m_stream.pdata = 0;
     m_stream.ndata = this;
     m_stream.end = max(expectedContentLength, 0LL);
-    m_stream.lastmodified = m_resourceResponse.lastModifiedDate();
+    m_stream.lastmodified = lastModifiedDate(m_resourceResponse);
     m_stream.notifyData = m_notifyData;
 
     m_transferMode = NP_NORMAL;

Modified: trunk/Source/WebKit2/ChangeLog (153332 => 153333)


--- trunk/Source/WebKit2/ChangeLog	2013-07-25 17:10:19 UTC (rev 153332)
+++ trunk/Source/WebKit2/ChangeLog	2013-07-25 17:10:34 UTC (rev 153333)
@@ -1,3 +1,22 @@
+2013-07-25  Anders Carlsson  <[email protected]>
+
+        Remove lastModifiedDate from ResourceResponse
+        https://bugs.webkit.org/show_bug.cgi?id=119092
+
+        Reviewed by Andreas Kling.
+
+        Update for WebCore changes.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::lastModifiedDate):
+        Use ResourceResponse::lastModified() to get the last modified date.
+
+        (WebKit::PluginView::Stream::didReceiveResponse):
+        Call the static lastModified function.
+
+        (WebKit::PluginView::manualLoadDidReceiveResponse):
+        Ditto.
+
 2013-07-25  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Add support for running unit tests in the web process

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (153332 => 153333)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2013-07-25 17:10:19 UTC (rev 153332)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2013-07-25 17:10:34 UTC (rev 153333)
@@ -200,6 +200,15 @@
     return headers;
 }
 
+static uint32_t lastModifiedDate(const ResourceResponse& response)
+{
+    double lastModified = response.lastModified();
+    if (!std::isfinite(lastModified))
+        return 0;
+
+    return lastModified * 1000;
+}
+
 void PluginView::Stream::didReceiveResponse(NetscapePlugInStreamLoader*, const ResourceResponse& response)
 {
     // Compute the stream related data from the resource response.
@@ -213,7 +222,7 @@
     if (expectedContentLength > 0)
         streamLength = expectedContentLength;
 
-    m_pluginView->m_plugin->streamDidReceiveResponse(m_streamID, responseURL, streamLength, response.lastModifiedDate(), mimeType, headers, response.suggestedFilename());
+    m_pluginView->m_plugin->streamDidReceiveResponse(m_streamID, responseURL, streamLength, lastModifiedDate(response), mimeType, headers, response.suggestedFilename());
 }
 
 void PluginView::Stream::didReceiveData(NetscapePlugInStreamLoader*, const char* bytes, int length)
@@ -384,7 +393,7 @@
     if (expectedContentLength > 0)
         streamLength = expectedContentLength;
 
-    m_plugin->manualStreamDidReceiveResponse(responseURL, streamLength, response.lastModifiedDate(), mimeType, headers, response.suggestedFilename());
+    m_plugin->manualStreamDidReceiveResponse(responseURL, streamLength, lastModifiedDate(response), mimeType, headers, response.suggestedFilename());
 }
 
 void PluginView::manualLoadDidReceiveData(const char* bytes, int length)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to