Clean up / optimize NetworkCacheSubresourcesEntry
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Nov 2015 23:21:38 +0000 (23:21 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Nov 2015 23:21:38 +0000 (23:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151405

Reviewed by Antti Koivisto.

Clean up / optimize NetworkCacheSubresourcesEntry:
- Remove m_sourceStorageRecord data member
- Avoid copying the Key when constructing it

* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::encodeAsSubresourcesRecord):
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
(WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:

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

Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h

index ea66a2f..1164c6f 100644 (file)
@@ -1,3 +1,20 @@
+2015-11-18  Chris Dumez  <cdumez@apple.com>
+
+        Clean up / optimize NetworkCacheSubresourcesEntry
+        https://bugs.webkit.org/show_bug.cgi?id=151405
+
+        Reviewed by Antti Koivisto.
+
+        Clean up / optimize NetworkCacheSubresourcesEntry:
+        - Remove m_sourceStorageRecord data member
+        - Avoid copying the Key when constructing it
+
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
+        (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::encodeAsSubresourcesRecord):
+        * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
+        (WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
+        * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
+
 2015-11-18  Jer Noble  <jer.noble@apple.com>
 
         Expose WebCore's AudioPlaybackRequiresUserGesture setting to WebKit & WebKit2
index 08227a4..0412ba6 100644 (file)
@@ -141,7 +141,7 @@ public:
             LOG(NetworkCacheSpeculativePreloading, "(NetworkProcess) * Subresource: '%s'.", subresourceKey.identifier().utf8().data());
 #endif
 
-        return SubresourcesEntry(subresourcesStorageKey, WTF::move(subresourceKeys)).encodeAsStorageRecord();
+        return SubresourcesEntry(WTF::move(subresourcesStorageKey), WTF::move(subresourceKeys)).encodeAsStorageRecord();
     }
 
     void markAsCompleted()
index 77dd000..6cb11d0 100644 (file)
@@ -69,8 +69,8 @@ SubresourcesEntry::SubresourcesEntry(const Storage::Record& storageEntry)
     ASSERT(m_key.type() == "subresources");
 }
 
-SubresourcesEntry::SubresourcesEntry(const Key& key, Vector<Key>&& subresourceKeys)
-    : m_key(key)
+SubresourcesEntry::SubresourcesEntry(Key&& key, Vector<Key>&& subresourceKeys)
+    : m_key(WTF::move(key))
     , m_timeStamp(std::chrono::system_clock::now())
     , m_subresourceKeys(WTF::move(subresourceKeys))
 {
index beadbd2..973f2a4 100644 (file)
@@ -36,7 +36,7 @@ namespace NetworkCache {
 class SubresourcesEntry {
     WTF_MAKE_NONCOPYABLE(SubresourcesEntry); WTF_MAKE_FAST_ALLOCATED;
 public:
-    SubresourcesEntry(const Key&, Vector<Key>&& subresourceKeys);
+    SubresourcesEntry(Key&&, Vector<Key>&& subresourceKeys);
     explicit SubresourcesEntry(const Storage::Record&);
 
     Storage::Record encodeAsStorageRecord() const;
@@ -49,7 +49,6 @@ public:
 private:
     Key m_key;
     std::chrono::system_clock::time_point m_timeStamp;
-    Storage::Record m_sourceStorageRecord;
     Vector<Key> m_subresourceKeys;
 };