Diff
Modified: trunk/LayoutTests/ChangeLog (231233 => 231234)
--- trunk/LayoutTests/ChangeLog 2018-05-02 16:13:38 UTC (rev 231233)
+++ trunk/LayoutTests/ChangeLog 2018-05-02 16:41:55 UTC (rev 231234)
@@ -1,3 +1,14 @@
+2018-05-02 Youenn Fablet <[email protected]>
+
+ CacheStorage::Engine should keep a list of initialization callback
+ https://bugs.webkit.org/show_bug.cgi?id=185184
+ <rdar://problem/38875651>
+
+ Reviewed by Antti Koivisto.
+
+ * http/wpt/cache-storage/a-cache-open.https-expected.txt: Added.
+ * http/wpt/cache-storage/a-cache-open.https.html: Added.
+
2018-05-02 Ms2ger <[email protected]>
Update document-create-touch.html expectations for r231114
Added: trunk/LayoutTests/http/wpt/cache-storage/a-cache-open.https-expected.txt (0 => 231234)
--- trunk/LayoutTests/http/wpt/cache-storage/a-cache-open.https-expected.txt (rev 0)
+++ trunk/LayoutTests/http/wpt/cache-storage/a-cache-open.https-expected.txt 2018-05-02 16:41:55 UTC (rev 231234)
@@ -0,0 +1,3 @@
+
+PASS Testing opening several caches in parallel
+
Added: trunk/LayoutTests/http/wpt/cache-storage/a-cache-open.https.html (0 => 231234)
--- trunk/LayoutTests/http/wpt/cache-storage/a-cache-open.https.html (rev 0)
+++ trunk/LayoutTests/http/wpt/cache-storage/a-cache-open.https.html 2018-05-02 16:41:55 UTC (rev 231234)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Cache Storage: testing several open in parallel</title>
+<script src=""
+<script src=""
+</head>
+<body>
+<script>
+promise_test(test => {
+ return Promise.all([
+ self.caches.open("test1"),
+ self.caches.open("test2"),
+ self.caches.open("test3"),
+ self.caches.open("test4"),
+ self.caches.open("test5"),
+ self.caches.open("test6"),
+ self.caches.open("test7"),
+ self.caches.open("test8"),
+ self.caches.open("test9"),
+ self.caches.open("test10")
+ ]);
+}, "Testing opening several caches in parallel");
+</script>
+</body>
+</html>
Modified: trunk/Source/WebKit/ChangeLog (231233 => 231234)
--- trunk/Source/WebKit/ChangeLog 2018-05-02 16:13:38 UTC (rev 231233)
+++ trunk/Source/WebKit/ChangeLog 2018-05-02 16:41:55 UTC (rev 231234)
@@ -1,3 +1,19 @@
+2018-05-02 Youenn Fablet <[email protected]>
+
+ CacheStorage::Engine should keep a list of initialization callback
+ https://bugs.webkit.org/show_bug.cgi?id=185184
+ <rdar://problem/38875651>
+
+ Reviewed by Antti Koivisto.
+
+ Keep each initialize callback in a Vector so as to compute the salt only once.
+ Call all callbacks then in a loop.
+
+ * NetworkProcess/cache/CacheStorageEngine.cpp:
+ (WebKit::CacheStorage::Engine::~Engine):
+ (WebKit::CacheStorage::Engine::initialize):
+ * NetworkProcess/cache/CacheStorageEngine.h:
+
2018-05-02 Jer Noble <[email protected]>
Pipe volume through PlaybackSessionManager/Proxy.
Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp (231233 => 231234)
--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp 2018-05-02 16:13:38 UTC (rev 231233)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp 2018-05-02 16:41:55 UTC (rev 231234)
@@ -67,8 +67,9 @@
for (auto& caches : m_caches.values())
caches->detach();
- if (m_initializationCallback)
- m_initializationCallback(Error::Internal);
+ auto initializationCallbacks = WTFMove(m_initializationCallbacks);
+ for (auto& callback : initializationCallbacks)
+ callback(Error::Internal);
auto writeCallbacks = WTFMove(m_pendingWriteCallbacks);
for (auto& callback : writeCallbacks.values())
@@ -204,8 +205,12 @@
return;
}
- m_initializationCallback = WTFMove(callback);
+ bool shouldComputeSalt = m_initializationCallbacks.isEmpty();
+ m_initializationCallbacks.append(WTFMove(callback));
+ if (!shouldComputeSalt)
+ return;
+
String saltPath = WebCore::FileSystem::pathByAppendingComponent(m_rootPath, ASCIILiteral("salt"));
m_ioQueue->dispatch([this, weakThis = makeWeakPtr(this), saltPath = WTFMove(saltPath)] () mutable {
WebCore::FileSystem::makeAllDirectories(m_rootPath);
@@ -213,12 +218,11 @@
if (!weakThis)
return;
- if (!salt) {
- m_initializationCallback(Error::WriteDisk);
- return;
- }
m_salt = WTFMove(salt);
- m_initializationCallback(std::nullopt);
+
+ auto callbacks = WTFMove(m_initializationCallbacks);
+ for (auto& callback : callbacks)
+ callback(m_salt ? std::nullopt : std::make_optional(Error::WriteDisk));
});
});
}
Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h (231233 => 231234)
--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h 2018-05-02 16:13:38 UTC (rev 231233)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h 2018-05-02 16:41:55 UTC (rev 231234)
@@ -118,7 +118,7 @@
RefPtr<WorkQueue> m_ioQueue;
std::optional<NetworkCache::Salt> m_salt;
HashMap<CacheIdentifier, LockCount> m_cacheLocks;
- WebCore::DOMCacheEngine::CompletionCallback m_initializationCallback;
+ Vector<WebCore::DOMCacheEngine::CompletionCallback> m_initializationCallbacks;
WeakPtrFactory<Engine> m_weakFactory;
HashMap<uint64_t, WebCore::DOMCacheEngine::CompletionCallback> m_pendingWriteCallbacks;
HashMap<uint64_t, CompletionHandler<void(const NetworkCache::Data&, int error)>> m_pendingReadCallbacks;