Title: [182296] trunk/Source/WebKit2
Revision
182296
Author
cdu...@apple.com
Date
2015-04-02 16:19:42 -0700 (Thu, 02 Apr 2015)

Log Message

[WK2][NetworkCache] Drop HTTP method from NetworkCache::Key
https://bugs.webkit.org/show_bug.cgi?id=143348

Reviewed by Antti Koivisto.

Drop HTTP method from NetworkCache::Key as we only cache GET responses
for now. Even when we start caching HEAD responses, we likely will not
want the method to be part of the key because:
- A HEAD response can be used to update the headers of a previously cached response to GET
- A cached GET response may be used to satisfy subsequent HEAD requests

* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::makeCacheKey):
* NetworkProcess/cache/NetworkCacheKey.cpp:
(WebKit::NetworkCache::Key::Key):
(WebKit::NetworkCache::Key::operator=):
(WebKit::NetworkCache::Key::computeHash):
(WebKit::NetworkCache::Key::operator==):
(WebKit::NetworkCache::Key::encode):
(WebKit::NetworkCache::Key::decode):
* NetworkProcess/cache/NetworkCacheKey.h:
(WebKit::NetworkCache::Key::method): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (182295 => 182296)


--- trunk/Source/WebKit2/ChangeLog	2015-04-02 22:50:40 UTC (rev 182295)
+++ trunk/Source/WebKit2/ChangeLog	2015-04-02 23:19:42 UTC (rev 182296)
@@ -1,3 +1,28 @@
+2015-04-02  Chris Dumez  <cdu...@apple.com>
+
+        [WK2][NetworkCache] Drop HTTP method from NetworkCache::Key
+        https://bugs.webkit.org/show_bug.cgi?id=143348
+
+        Reviewed by Antti Koivisto.
+
+        Drop HTTP method from NetworkCache::Key as we only cache GET responses
+        for now. Even when we start caching HEAD responses, we likely will not
+        want the method to be part of the key because:
+        - A HEAD response can be used to update the headers of a previously cached response to GET
+        - A cached GET response may be used to satisfy subsequent HEAD requests
+
+        * NetworkProcess/cache/NetworkCache.cpp:
+        (WebKit::NetworkCache::makeCacheKey):
+        * NetworkProcess/cache/NetworkCacheKey.cpp:
+        (WebKit::NetworkCache::Key::Key):
+        (WebKit::NetworkCache::Key::operator=):
+        (WebKit::NetworkCache::Key::computeHash):
+        (WebKit::NetworkCache::Key::operator==):
+        (WebKit::NetworkCache::Key::encode):
+        (WebKit::NetworkCache::Key::decode):
+        * NetworkProcess/cache/NetworkCacheKey.h:
+        (WebKit::NetworkCache::Key::method): Deleted.
+
 2015-04-02  Jer Noble  <jer.no...@apple.com>
 
         [Mac][WK2] Fullscreen animation incorrect when initiated on non-primary monitor

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp (182295 => 182296)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp	2015-04-02 22:50:40 UTC (rev 182295)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp	2015-04-02 23:19:42 UTC (rev 182296)
@@ -92,7 +92,7 @@
 #endif
     if (partition.isEmpty())
         partition = ASCIILiteral("No partition");
-    return { request.httpMethod(), partition, request.url().string()  };
+    return { partition, request.url().string() };
 }
 
 static String headerValueForVary(const WebCore::ResourceRequest& request, const String& headerName)

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheKey.cpp (182295 => 182296)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheKey.cpp	2015-04-02 22:50:40 UTC (rev 182295)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheKey.cpp	2015-04-02 23:19:42 UTC (rev 182296)
@@ -37,16 +37,14 @@
 namespace NetworkCache {
 
 Key::Key(const Key& o)
-    : m_method(o.m_method.isolatedCopy())
-    , m_partition(o.m_partition.isolatedCopy())
+    : m_partition(o.m_partition.isolatedCopy())
     , m_identifier(o.m_identifier.isolatedCopy())
     , m_hash(o.m_hash)
 {
 }
 
-Key::Key(const String& method, const String& partition, const String& identifier)
-    : m_method(method.isolatedCopy())
-    , m_partition(partition.isolatedCopy())
+Key::Key(const String& partition, const String& identifier)
+    : m_partition(partition.isolatedCopy())
     , m_identifier(identifier.isolatedCopy())
     , m_hash(computeHash())
 {
@@ -54,7 +52,6 @@
 
 Key& Key::operator=(const Key& other)
 {
-    m_method = other.m_method.isolatedCopy();
     m_partition = other.m_partition.isolatedCopy();
     m_identifier = other.m_identifier.isolatedCopy();
     m_hash = other.m_hash;
@@ -79,7 +76,6 @@
     // We don't really need a cryptographic hash. The key is always verified against the entry header.
     // MD5 just happens to be suitably sized, fast and available.
     MD5 md5;
-    hashString(md5, m_method);
     hashString(md5, m_partition);
     hashString(md5, m_identifier);
     MD5::Digest hash;
@@ -121,12 +117,11 @@
 
 bool Key::operator==(const Key& other) const
 {
-    return m_hash == other.m_hash && m_method == other.m_method && m_partition == other.m_partition && m_identifier == other.m_identifier;
+    return m_hash == other.m_hash && m_partition == other.m_partition && m_identifier == other.m_identifier;
 }
 
 void Key::encode(Encoder& encoder) const
 {
-    encoder << m_method;
     encoder << m_partition;
     encoder << m_identifier;
     encoder << m_hash;
@@ -134,7 +129,7 @@
 
 bool Key::decode(Decoder& decoder, Key& key)
 {
-    return decoder.decode(key.m_method) && decoder.decode(key.m_partition) && decoder.decode(key.m_identifier) && decoder.decode(key.m_hash);
+    return decoder.decode(key.m_partition) && decoder.decode(key.m_identifier) && decoder.decode(key.m_hash);
 }
 
 }

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheKey.h (182295 => 182296)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheKey.h	2015-04-02 22:50:40 UTC (rev 182295)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheKey.h	2015-04-02 23:19:42 UTC (rev 182296)
@@ -44,14 +44,13 @@
     Key() { }
     Key(const Key&);
     Key(Key&&) = default;
-    Key(const String& method, const String& partition, const String& identifier);
+    Key(const String& partition, const String& identifier);
 
     Key& operator=(const Key&);
     Key& operator=(Key&&) = default;
 
     bool isNull() const { return m_identifier.isNull(); }
 
-    const String& method() const { return m_method; }
     const String& partition() const { return m_partition; }
     const String& identifier() const { return m_identifier; }
 
@@ -73,7 +72,6 @@
 private:
     HashType computeHash() const;
 
-    String m_method;
     String m_partition;
     String m_identifier;
     HashType m_hash;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to