Avoid useless copying of Key::HashType in loops in NetworkCache::Storage::synchronize()
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Oct 2015 08:53:21 +0000 (08:53 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Oct 2015 08:53:21 +0000 (08:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150061

Reviewed by Carlos Garcia Campos.

Avoid useless copying of Key::HashType in loops in NetworkCache::Storage::synchronize().
Key::HashType is currently a SHA1::Digest, which is a std::array<uint8_t, 20>.

* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::synchronize):

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

Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp

index 8795a3b..319dd96 100644 (file)
@@ -1,3 +1,16 @@
+2015-10-13  Chris Dumez  <cdumez@apple.com>
+
+        Avoid useless copying of Key::HashType in loops in NetworkCache::Storage::synchronize()
+        https://bugs.webkit.org/show_bug.cgi?id=150061
+
+        Reviewed by Carlos Garcia Campos.
+
+        Avoid useless copying of Key::HashType in loops in NetworkCache::Storage::synchronize().
+        Key::HashType is currently a SHA1::Digest, which is a std::array<uint8_t, 20>.
+
+        * NetworkProcess/cache/NetworkCacheStorage.cpp:
+        (WebKit::NetworkCache::Storage::synchronize):
+
 2015-10-12  Philip Chimento  <philip.chimento@gmail.com>
 
         [GTK] OSX linker doesn't understand --whole-archive
index 38c0ef1..fa5ba7d 100644 (file)
@@ -259,11 +259,11 @@ void Storage::synchronize()
             auto recordFilter = std::unique_ptr<ContentsFilter>(recordFilterPtr);
             auto bodyFilter = std::unique_ptr<ContentsFilter>(bodyFilterPtr);
 
-            for (auto hash : m_recordFilterHashesAddedDuringSynchronization)
+            for (auto& hash : m_recordFilterHashesAddedDuringSynchronization)
                 recordFilter->add(hash);
             m_recordFilterHashesAddedDuringSynchronization.clear();
 
-            for (auto hash : m_bodyFilterHashesAddedDuringSynchronization)
+            for (auto& hash : m_bodyFilterHashesAddedDuringSynchronization)
                 bodyFilter->add(hash);
             m_bodyFilterHashesAddedDuringSynchronization.clear();