Title: [200630] trunk/Source/WebKit2
Revision
200630
Author
[email protected]
Date
2016-05-10 10:45:47 -0700 (Tue, 10 May 2016)

Log Message

[SpeculativeValidation] Do not start a preload if there is already one pending
https://bugs.webkit.org/show_bug.cgi?id=157522
<rdar://problem/26156083>

Reviewed by Alex Christensen.

Do not start a preload if there is already one pending. We failed to check in
SpeculativeLoadManager::preloadEntry() if there was already a pending preload.
As a result, we would sometimes cancel an already pending preload and start
one from scratch which is inefficient. It would also sometimes lead to hitting
an assertion in the SpeculativeLoad destructor because we could destroy the
SpeculativeLoad without finishing or cancelling the load.

* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (200629 => 200630)


--- trunk/Source/WebKit2/ChangeLog	2016-05-10 17:42:58 UTC (rev 200629)
+++ trunk/Source/WebKit2/ChangeLog	2016-05-10 17:45:47 UTC (rev 200630)
@@ -1,3 +1,21 @@
+2016-05-10  Chris Dumez  <[email protected]>
+
+        [SpeculativeValidation] Do not start a preload if there is already one pending
+        https://bugs.webkit.org/show_bug.cgi?id=157522
+        <rdar://problem/26156083>
+
+        Reviewed by Alex Christensen.
+
+        Do not start a preload if there is already one pending. We failed to check in
+        SpeculativeLoadManager::preloadEntry() if there was already a pending preload.
+        As a result, we would sometimes cancel an already pending preload and start
+        one from scratch which is inefficient. It would also sometimes lead to hitting
+        an assertion in the SpeculativeLoad destructor because we could destroy the
+        SpeculativeLoad without finishing or cancelling the load.
+
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
+        (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
+
 2016-05-10  Anders Carlsson  <[email protected]>
 
         Fix a deprecation warning.

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp (200629 => 200630)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp	2016-05-10 17:42:58 UTC (rev 200629)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp	2016-05-10 17:45:47 UTC (rev 200630)
@@ -489,11 +489,16 @@
 
 void SpeculativeLoadManager::preloadEntry(const Key& key, const SubresourceInfo& subResourceInfo, const GlobalFrameID& frameID)
 {
+    if (m_pendingPreloads.contains(key))
+        return;
+
     m_pendingPreloads.add(key, nullptr);
     auto* subResourceInfoPtr = new SubresourceInfo(subResourceInfo);
     retrieveEntryFromStorage(key, [this, key, subResourceInfoPtr, frameID](std::unique_ptr<Entry> entry) {
         auto subResourceInfo = std::unique_ptr<SubresourceInfo>(subResourceInfoPtr);
-        m_pendingPreloads.remove(key);
+        ASSERT(!m_pendingPreloads.get(key));
+        bool removed = m_pendingPreloads.remove(key);
+        ASSERT_UNUSED(removed, removed);
 
         if (satisfyPendingRequests(key, entry.get())) {
             if (entry)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to