Title: [187698] trunk/Source/WebKit2
Revision
187698
Author
[email protected]
Date
2015-07-31 17:43:36 -0700 (Fri, 31 Jul 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::decode):
(WebKit::NetworkCache::Key::operator=): Deleted.
(WebKit::NetworkCache::Key::computeHash): Deleted.
(WebKit::NetworkCache::Key::encode): Deleted.
* NetworkProcess/cache/NetworkCacheKey.h:
(WebKit::NetworkCache::Key::method): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (187697 => 187698)


--- trunk/Source/WebKit2/ChangeLog	2015-08-01 00:29:44 UTC (rev 187697)
+++ trunk/Source/WebKit2/ChangeLog	2015-08-01 00:43:36 UTC (rev 187698)
@@ -1,5 +1,30 @@
 2015-07-31  Chris Dumez  <[email protected]>
 
+        [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::decode):
+        (WebKit::NetworkCache::Key::operator=): Deleted.
+        (WebKit::NetworkCache::Key::computeHash): Deleted.
+        (WebKit::NetworkCache::Key::encode): Deleted.
+        * NetworkProcess/cache/NetworkCacheKey.h:
+        (WebKit::NetworkCache::Key::method): Deleted.
+
+2015-07-31  Chris Dumez  <[email protected]>
+
         Coalesce concurrent authentication challenges for the same ProtectionSpace
         https://bugs.webkit.org/show_bug.cgi?id=147496
         <rdar://problem/16839069>

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp (187697 => 187698)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp	2015-08-01 00:29:44 UTC (rev 187697)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp	2015-08-01 00:43:36 UTC (rev 187698)
@@ -113,7 +113,7 @@
     // FIXME: This implements minimal Range header disk cache support. We don't parse
     // ranges so only the same exact range request will be served from the cache.
     String range = request.httpHeaderField(WebCore::HTTPHeaderName::Range);
-    return { request.httpMethod(), partition, range, request.url().string()  };
+    return { partition, range, request.url().string() };
 }
 
 static String headerValueForVary(const WebCore::ResourceRequest& request, const String& headerName)

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheKey.cpp (187697 => 187698)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheKey.cpp	2015-08-01 00:29:44 UTC (rev 187697)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheKey.cpp	2015-08-01 00:43:36 UTC (rev 187698)
@@ -37,17 +37,15 @@
 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_range(o.m_range.isolatedCopy())
     , m_hash(o.m_hash)
 {
 }
 
-Key::Key(const String& method, const String& partition, const String& range, const String& identifier)
-    : m_method(method.isolatedCopy())
-    , m_partition(partition.isolatedCopy())
+Key::Key(const String& partition, const String& range, const String& identifier)
+    : m_partition(partition.isolatedCopy())
     , m_identifier(identifier.isolatedCopy())
     , m_range(range.isolatedCopy())
     , m_hash(computeHash())
@@ -56,7 +54,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_range = other.m_range.isolatedCopy();
@@ -85,7 +82,6 @@
     // We don't really need a cryptographic hash. The key is always verified against the entry header.
     // SHA1 just happens to be suitably sized, fast and available.
     SHA1 sha1;
-    hashString(sha1, m_method);
     hashString(sha1, m_partition);
     hashString(sha1, m_identifier);
     hashString(sha1, m_range);
@@ -128,12 +124,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 && m_range == other.m_range;
+    return m_hash == other.m_hash && m_partition == other.m_partition && m_identifier == other.m_identifier && m_range == other.m_range;
 }
 
 void Key::encode(Encoder& encoder) const
 {
-    encoder << m_method;
     encoder << m_partition;
     encoder << m_identifier;
     encoder << m_range;
@@ -142,7 +137,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_range) && decoder.decode(key.m_hash);
+    return decoder.decode(key.m_partition) && decoder.decode(key.m_identifier) && decoder.decode(key.m_range) && decoder.decode(key.m_hash);
 }
 
 }

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheKey.h (187697 => 187698)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheKey.h	2015-08-01 00:29:44 UTC (rev 187697)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheKey.h	2015-08-01 00:43:36 UTC (rev 187698)
@@ -44,14 +44,13 @@
     Key() { }
     Key(const Key&);
     Key(Key&&) = default;
-    Key(const String& method, const String& partition, const String& range, const String& identifier);
+    Key(const String& partition, const String& range, 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; }
 
@@ -71,7 +70,6 @@
 private:
     HashType computeHash() const;
 
-    String m_method;
     String m_partition;
     String m_identifier;
     String m_range;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to