Modified: trunk/Source/WebKit2/ChangeLog (217946 => 217947)
--- trunk/Source/WebKit2/ChangeLog 2017-06-08 20:39:00 UTC (rev 217946)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-08 21:37:50 UTC (rev 217947)
@@ -1,3 +1,19 @@
+2017-06-08 Chris Dumez <[email protected]>
+
+ Use WTF::Function more in SpeculativeLoadManager
+ https://bugs.webkit.org/show_bug.cgi?id=173109
+
+ Reviewed by Antti Koivisto.
+
+ Use WTF::Function more in SpeculativeLoadManager.
+
+ * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
+ (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::create):
+ (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::PendingFrameLoad):
+ (WebKit::NetworkCache::SpeculativeLoadManager::registerLoad):
+ (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
+ * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
+
2017-06-08 Youenn Fablet <[email protected]>
getUserMedia should not be prompted again if user denied access
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp (217946 => 217947)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp 2017-06-08 20:39:00 UTC (rev 217946)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp 2017-06-08 21:37:50 UTC (rev 217947)
@@ -159,7 +159,7 @@
class SpeculativeLoadManager::PendingFrameLoad : public RefCounted<PendingFrameLoad> {
public:
- static Ref<PendingFrameLoad> create(Storage& storage, const Key& mainResourceKey, std::function<void()>&& loadCompletionHandler)
+ static Ref<PendingFrameLoad> create(Storage& storage, const Key& mainResourceKey, WTF::Function<void()>&& loadCompletionHandler)
{
return adoptRef(*new PendingFrameLoad(storage, mainResourceKey, WTFMove(loadCompletionHandler)));
}
@@ -203,7 +203,7 @@
}
private:
- PendingFrameLoad(Storage& storage, const Key& mainResourceKey, std::function<void()>&& loadCompletionHandler)
+ PendingFrameLoad(Storage& storage, const Key& mainResourceKey, WTF::Function<void()>&& loadCompletionHandler)
: m_storage(storage)
, m_mainResourceKey(mainResourceKey)
, m_loadCompletionHandler(WTFMove(loadCompletionHandler))
@@ -238,7 +238,7 @@
Storage& m_storage;
Key m_mainResourceKey;
Vector<std::unique_ptr<SubresourceLoad>> m_subresourceLoads;
- std::function<void()> m_loadCompletionHandler;
+ WTF::Function<void()> m_loadCompletionHandler;
HysteresisActivity m_loadHysteresisActivity;
std::unique_ptr<SubresourcesEntry> m_existingEntry;
bool m_didFinishLoad { false };
@@ -377,14 +377,14 @@
ASSERT(!m_pendingFrameLoads.contains(frameID));
// Start tracking loads in this frame.
- RefPtr<PendingFrameLoad> pendingFrameLoad = PendingFrameLoad::create(m_storage, resourceKey, [this, frameID] {
+ auto pendingFrameLoad = PendingFrameLoad::create(m_storage, resourceKey, [this, frameID] {
bool wasRemoved = m_pendingFrameLoads.remove(frameID);
ASSERT_UNUSED(wasRemoved, wasRemoved);
});
- m_pendingFrameLoads.add(frameID, pendingFrameLoad);
+ m_pendingFrameLoads.add(frameID, pendingFrameLoad.copyRef());
// Retrieve the subresources entry if it exists to start speculative revalidation and to update it.
- retrieveSubresourcesEntry(resourceKey, [this, frameID, pendingFrameLoad](std::unique_ptr<SubresourcesEntry> entry) {
+ retrieveSubresourcesEntry(resourceKey, [this, frameID, pendingFrameLoad = WTFMove(pendingFrameLoad)](std::unique_ptr<SubresourcesEntry> entry) {
if (entry)
startSpeculativeRevalidation(frameID, *entry);
@@ -565,7 +565,7 @@
}
}
-void SpeculativeLoadManager::retrieveSubresourcesEntry(const Key& storageKey, std::function<void (std::unique_ptr<SubresourcesEntry>)>&& completionHandler)
+void SpeculativeLoadManager::retrieveSubresourcesEntry(const Key& storageKey, WTF::Function<void (std::unique_ptr<SubresourcesEntry>)>&& completionHandler)
{
ASSERT(storageKey.type() == "Resource");
auto subresourcesStorageKey = makeSubresourcesKey(storageKey, m_storage.salt());
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h (217946 => 217947)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h 2017-06-08 20:39:00 UTC (rev 217946)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h 2017-06-08 21:37:50 UTC (rev 217947)
@@ -64,7 +64,7 @@
void retrieveEntryFromStorage(const SubresourceInfo&, RetrieveCompletionHandler&&);
void revalidateSubresource(const SubresourceInfo&, std::unique_ptr<Entry>, const GlobalFrameID&);
bool satisfyPendingRequests(const Key&, Entry*);
- void retrieveSubresourcesEntry(const Key& storageKey, std::function<void (std::unique_ptr<SubresourcesEntry>)>&&);
+ void retrieveSubresourcesEntry(const Key& storageKey, WTF::Function<void (std::unique_ptr<SubresourcesEntry>)>&&);
void startSpeculativeRevalidation(const GlobalFrameID&, SubresourcesEntry&);
static bool canUsePreloadedEntry(const PreloadedEntry&, const WebCore::ResourceRequest& actualRequest);