Diff
Modified: trunk/Source/WebCore/ChangeLog (201340 => 201341)
--- trunk/Source/WebCore/ChangeLog 2016-05-24 19:01:35 UTC (rev 201340)
+++ trunk/Source/WebCore/ChangeLog 2016-05-24 19:03:42 UTC (rev 201341)
@@ -1,3 +1,29 @@
+2016-05-24 Chris Dumez <[email protected]>
+
+ Use lambda capture with initializer instead of StringCapture
+ https://bugs.webkit.org/show_bug.cgi?id=158010
+
+ Reviewed by Antti Koivisto.
+
+ Use lambda capture with initializer instead of StringCapture now that
+ we support C++14.
+
+ * fileapi/AsyncFileStream.cpp:
+ (WebCore::AsyncFileStream::getSize):
+ (WebCore::AsyncFileStream::openForRead):
+ (WebCore::AsyncFileStream::openForWrite):
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::installContentFilterUnblockHandler):
+ * loader/WorkerThreadableLoader.cpp:
+ (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
+ * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+ (WebVideoFullscreenControllerContext::setExternalPlayback):
+ * platform/network/curl/CurlDownload.cpp:
+ (WebCore::CurlDownload::didReceiveHeader):
+ * workers/WorkerMessagingProxy.cpp:
+ (WebCore::WorkerMessagingProxy::postExceptionToWorkerObject):
+ (WebCore::WorkerMessagingProxy::postConsoleMessageToWorkerObject):
+
2016-05-24 Said Abou-Hallawa <[email protected]>
In accelerated drawing mode, ImageBuffer::putByteArray() should copy the bytes directly to the IOSurface backing store
Modified: trunk/Source/WebCore/fileapi/AsyncFileStream.cpp (201340 => 201341)
--- trunk/Source/WebCore/fileapi/AsyncFileStream.cpp 2016-05-24 19:01:35 UTC (rev 201340)
+++ trunk/Source/WebCore/fileapi/AsyncFileStream.cpp 2016-05-24 19:03:42 UTC (rev 201341)
@@ -138,11 +138,10 @@
void AsyncFileStream::getSize(const String& path, double expectedModificationTime)
{
- StringCapture capturedPath(path);
// FIXME: Explicit return type here and in all the other cases like this below is a workaround for a deficiency
// in the Windows compiler at the time of this writing. Could remove it if that is resolved.
- perform([capturedPath, expectedModificationTime](FileStream& stream) -> std::function<void(FileStreamClient&)> {
- long long size = stream.getSize(capturedPath.string(), expectedModificationTime);
+ perform([path = path.isolatedCopy(), expectedModificationTime](FileStream& stream) -> std::function<void(FileStreamClient&)> {
+ long long size = stream.getSize(path, expectedModificationTime);
return [size](FileStreamClient& client) {
client.didGetSize(size);
};
@@ -151,10 +150,9 @@
void AsyncFileStream::openForRead(const String& path, long long offset, long long length)
{
- StringCapture capturedPath(path);
// FIXME: Explicit return type here is a workaround for a deficiency in the Windows compiler at the time of this writing.
- perform([capturedPath, offset, length](FileStream& stream) -> std::function<void(FileStreamClient&)> {
- bool success = stream.openForRead(capturedPath.string(), offset, length);
+ perform([path = path.isolatedCopy(), offset, length](FileStream& stream) -> std::function<void(FileStreamClient&)> {
+ bool success = stream.openForRead(path, offset, length);
return [success](FileStreamClient& client) {
client.didOpen(success);
};
@@ -163,9 +161,8 @@
void AsyncFileStream::openForWrite(const String& path)
{
- StringCapture capturedPath(path);
- perform([capturedPath](FileStream& stream) -> std::function<void(FileStreamClient&)> {
- bool success = stream.openForWrite(capturedPath.string());
+ perform([path = path.isolatedCopy()](FileStream& stream) -> std::function<void(FileStreamClient&)> {
+ bool success = stream.openForWrite(path);
return [success](FileStreamClient& client) {
client.didOpen(success);
};
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (201340 => 201341)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2016-05-24 19:01:35 UTC (rev 201340)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2016-05-24 19:03:42 UTC (rev 201341)
@@ -1703,10 +1703,9 @@
String unblockRequestDeniedScript { contentFilter.unblockRequestDeniedScript() };
if (!unblockRequestDeniedScript.isEmpty() && frame) {
static_assert(std::is_base_of<ThreadSafeRefCounted<Frame>, Frame>::value, "Frame must be ThreadSafeRefCounted.");
- StringCapture capturedScript { unblockRequestDeniedScript };
- unblockHandler.wrapWithDecisionHandler([frame, capturedScript](bool unblocked) {
+ unblockHandler.wrapWithDecisionHandler([frame, unblockRequestDeniedScript = unblockRequestDeniedScript.isolatedCopy()](bool unblocked) {
if (!unblocked)
- frame->script().executeScript(capturedScript.string());
+ frame->script().executeScript(unblockRequestDeniedScript);
});
}
frameLoader()->client().contentFilterDidBlockLoad(WTFMove(unblockHandler));
Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp (201340 => 201341)
--- trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp 2016-05-24 19:01:35 UTC (rev 201340)
+++ trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp 2016-05-24 19:03:42 UTC (rev 201341)
@@ -98,13 +98,12 @@
auto* contentSecurityPolicyCopy = std::make_unique<ContentSecurityPolicy>(*securityOrigin).release();
contentSecurityPolicyCopy->copyStateFrom(contentSecurityPolicy);
- StringCapture capturedOutgoingReferrer(outgoingReferrer);
- m_loaderProxy.postTaskToLoader([this, requestData, optionsCopy, contentSecurityPolicyCopy, capturedOutgoingReferrer](ScriptExecutionContext& context) {
+ m_loaderProxy.postTaskToLoader([this, requestData, optionsCopy, contentSecurityPolicyCopy, outgoingReferrer = outgoingReferrer.isolatedCopy()](ScriptExecutionContext& context) {
ASSERT(isMainThread());
Document& document = downcast<Document>(context);
auto request = ResourceRequest::adopt(std::unique_ptr<CrossThreadResourceRequestData>(requestData));
- request->setHTTPReferrer(capturedOutgoingReferrer.string());
+ request->setHTTPReferrer(outgoingReferrer);
auto options = std::unique_ptr<ThreadableLoaderOptions>(optionsCopy);
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (201340 => 201341)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2016-05-24 19:01:35 UTC (rev 201340)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2016-05-24 19:03:42 UTC (rev 201341)
@@ -430,10 +430,9 @@
{
ASSERT(WebThreadIsCurrent());
RefPtr<WebVideoFullscreenControllerContext> protectedThis(this);
- StringCapture capturedLocalizedDeviceName(localizedDeviceName);
- dispatch_async(dispatch_get_main_queue(), [protectedThis, this, enabled, type, capturedLocalizedDeviceName] {
+ dispatch_async(dispatch_get_main_queue(), [protectedThis, this, enabled, type, localizedDeviceName = localizedDeviceName.isolatedCopy()] {
if (m_interface)
- m_interface->setExternalPlayback(enabled, type, capturedLocalizedDeviceName.string());
+ m_interface->setExternalPlayback(enabled, type, localizedDeviceName);
});
}
Modified: trunk/Source/WebCore/platform/network/curl/CurlDownload.cpp (201340 => 201341)
--- trunk/Source/WebCore/platform/network/curl/CurlDownload.cpp 2016-05-24 19:01:35 UTC (rev 201340)
+++ trunk/Source/WebCore/platform/network/curl/CurlDownload.cpp 2016-05-24 19:03:42 UTC (rev 201341)
@@ -414,14 +414,12 @@
});
}
} else {
- StringCapture capturedHeader(header);
-
RefPtr<CurlDownload> protectedThis(this);
- callOnMainThread([this, capturedHeader, protectedThis] {
- int splitPos = capturedHeader.string().find(":");
+ callOnMainThread([this, header = header.isolatedCopy(), protectedThis] {
+ int splitPos = header.find(":");
if (splitPos != -1)
- m_response.setHTTPHeaderField(capturedHeader.string().left(splitPos), capturedHeader.string().substring(splitPos + 1).stripWhiteSpace());
+ m_response.setHTTPHeaderField(header.left(splitPos), header.substring(splitPos + 1).stripWhiteSpace());
});
}
}
Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp (201340 => 201341)
--- trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp 2016-05-24 19:01:35 UTC (rev 201340)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp 2016-05-24 19:03:42 UTC (rev 201341)
@@ -141,9 +141,7 @@
void WorkerMessagingProxy::postExceptionToWorkerObject(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL)
{
- StringCapture capturedErrorMessage(errorMessage);
- StringCapture capturedSourceURL(sourceURL);
- m_scriptExecutionContext->postTask([this, capturedErrorMessage, capturedSourceURL, lineNumber, columnNumber] (ScriptExecutionContext& context) {
+ m_scriptExecutionContext->postTask([this, errorMessage = errorMessage.isolatedCopy(), sourceURL = sourceURL.isolatedCopy(), lineNumber, columnNumber] (ScriptExecutionContext& context) {
Worker* workerObject = this->workerObject();
if (!workerObject)
return;
@@ -151,20 +149,18 @@
// We don't bother checking the askedToTerminate() flag here, because exceptions should *always* be reported even if the thread is terminated.
// This is intentionally different than the behavior in MessageWorkerTask, because terminated workers no longer deliver messages (section 4.6 of the WebWorker spec), but they do report exceptions.
- bool errorHandled = !workerObject->dispatchEvent(ErrorEvent::create(capturedErrorMessage.string(), capturedSourceURL.string(), lineNumber, columnNumber));
+ bool errorHandled = !workerObject->dispatchEvent(ErrorEvent::create(errorMessage, sourceURL, lineNumber, columnNumber));
if (!errorHandled)
- context.reportException(capturedErrorMessage.string(), lineNumber, columnNumber, capturedSourceURL.string(), 0);
+ context.reportException(errorMessage, lineNumber, columnNumber, sourceURL, 0);
});
}
void WorkerMessagingProxy::postConsoleMessageToWorkerObject(MessageSource source, MessageLevel level, const String& message, int lineNumber, int columnNumber, const String& sourceURL)
{
- StringCapture capturedMessage(message);
- StringCapture capturedSourceURL(sourceURL);
- m_scriptExecutionContext->postTask([this, source, level, capturedMessage, capturedSourceURL, lineNumber, columnNumber] (ScriptExecutionContext& context) {
+ m_scriptExecutionContext->postTask([this, source, level, message = message.isolatedCopy(), sourceURL = sourceURL.isolatedCopy(), lineNumber, columnNumber] (ScriptExecutionContext& context) {
if (askedToTerminate())
return;
- context.addConsoleMessage(source, level, capturedMessage.string(), capturedSourceURL.string(), lineNumber, columnNumber);
+ context.addConsoleMessage(source, level, message, sourceURL, lineNumber, columnNumber);
});
}
Modified: trunk/Source/WebKit2/ChangeLog (201340 => 201341)
--- trunk/Source/WebKit2/ChangeLog 2016-05-24 19:01:35 UTC (rev 201340)
+++ trunk/Source/WebKit2/ChangeLog 2016-05-24 19:03:42 UTC (rev 201341)
@@ -1,5 +1,31 @@
2016-05-24 Chris Dumez <[email protected]>
+ Use lambda capture with initializer instead of StringCapture
+ https://bugs.webkit.org/show_bug.cgi?id=158010
+
+ Reviewed by Antti Koivisto.
+
+ Use lambda capture with initializer instead of StringCapture now that
+ we support C++14.
+
+ * NetworkProcess/cache/NetworkCache.cpp:
+ (WebKit::NetworkCache::Cache::deleteDumpFile):
+ * NetworkProcess/cache/NetworkCacheStatistics.cpp:
+ (WebKit::NetworkCache::Statistics::initialize):
+ (WebKit::NetworkCache::Statistics::shrinkIfNeeded):
+ * NetworkProcess/cache/NetworkCacheStorage.cpp:
+ (WebKit::NetworkCache::Storage::updateFileModificationTime):
+ (WebKit::NetworkCache::Storage::clear):
+ * UIProcess/API/APIUserContentExtensionStore.cpp:
+ (API::UserContentExtensionStore::lookupContentExtension):
+ (API::UserContentExtensionStore::compileContentExtension):
+ (API::UserContentExtensionStore::removeContentExtension):
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::fetchData):
+ (WebKit::WebsiteDataStore::removeData):
+
+2016-05-24 Chris Dumez <[email protected]>
+
Use auto for some of our lambda function parameters
https://bugs.webkit.org/show_bug.cgi?id=158001
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp (201340 => 201341)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp 2016-05-24 19:01:35 UTC (rev 201340)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp 2016-05-24 19:03:42 UTC (rev 201341)
@@ -618,9 +618,8 @@
void Cache::deleteDumpFile()
{
auto queue = WorkQueue::create("com.apple.WebKit.Cache.delete");
- StringCapture dumpFilePathCapture(dumpFilePath());
- queue->dispatch([dumpFilePathCapture] {
- WebCore::deleteFile(dumpFilePathCapture.string());
+ queue->dispatch([filePath = dumpFilePath().isolatedCopy()] {
+ WebCore::deleteFile(filePath);
});
}
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.cpp (201340 => 201341)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.cpp 2016-05-24 19:01:35 UTC (rev 201340)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.cpp 2016-05-24 19:03:42 UTC (rev 201341)
@@ -93,13 +93,9 @@
ASSERT(RunLoop::isMain());
auto startTime = std::chrono::system_clock::now();
-
- StringCapture databasePathCapture(databasePath);
- StringCapture networkCachePathCapture(singleton().recordsPath());
- serialBackgroundIOQueue().dispatch([this, databasePathCapture, networkCachePathCapture, startTime] {
+ serialBackgroundIOQueue().dispatch([this, databasePath = databasePath.isolatedCopy(), networkCachePath = singleton().recordsPath().isolatedCopy(), startTime] {
WebCore::SQLiteTransactionInProgressAutoCounter transactionCounter;
- String databasePath = databasePathCapture.string();
if (!WebCore::makeAllDirectories(WebCore::directoryName(databasePath)))
return;
@@ -128,7 +124,7 @@
LOG(NetworkCache, "(NetworkProcess) Network cache statistics database load complete, entries=%lu time=%" PRIi64 "ms", static_cast<size_t>(m_approximateEntryCount), elapsedMS);
if (!m_approximateEntryCount) {
- bootstrapFromNetworkCache(networkCachePathCapture.string());
+ bootstrapFromNetworkCache(networkCachePath);
#if !LOG_DISABLED
elapsedMS = static_cast<int64_t>(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - startTime).count());
#endif
@@ -176,9 +172,8 @@
clear();
- StringCapture networkCachePathCapture(singleton().recordsPath());
- serialBackgroundIOQueue().dispatch([this, networkCachePathCapture] {
- bootstrapFromNetworkCache(networkCachePathCapture.string());
+ serialBackgroundIOQueue().dispatch([this, networkCachePath = singleton().recordsPath().isolatedCopy()] {
+ bootstrapFromNetworkCache(networkCachePath);
LOG(NetworkCache, "(NetworkProcess) statistics cache shrink completed m_approximateEntryCount=%lu", static_cast<size_t>(m_approximateEntryCount));
});
}
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp (201340 => 201341)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp 2016-05-24 19:01:35 UTC (rev 201340)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp 2016-05-24 19:03:42 UTC (rev 201341)
@@ -558,9 +558,8 @@
void Storage::updateFileModificationTime(const String& path)
{
- StringCapture filePathCapture(path);
- serialBackgroundIOQueue().dispatch([filePathCapture] {
- updateFileModificationTimeIfNeeded(filePathCapture.string());
+ serialBackgroundIOQueue().dispatch([path = path.isolatedCopy()] {
+ updateFileModificationTimeIfNeeded(path);
});
}
@@ -897,13 +896,9 @@
if (m_blobFilter)
m_blobFilter->clear();
m_approximateRecordsSize = 0;
-
- // Avoid non-thread safe std::function copies.
- auto* completionHandlerPtr = completionHandler ? new std::function<void ()>(WTFMove(completionHandler)) : nullptr;
- StringCapture typeCapture(type);
- ioQueue().dispatch([this, modifiedSinceTime, completionHandlerPtr, typeCapture] {
+ ioQueue().dispatch([this, modifiedSinceTime, completionHandler = WTFMove(completionHandler), type = type.isolatedCopy()] () mutable {
auto recordsPath = this->recordsPath();
- traverseRecordsFiles(recordsPath, typeCapture.string(), [modifiedSinceTime](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) {
+ traverseRecordsFiles(recordsPath, type, [modifiedSinceTime](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) {
auto filePath = WebCore::pathByAppendingComponent(recordDirectoryPath, fileName);
if (modifiedSinceTime > std::chrono::system_clock::time_point::min()) {
auto times = fileTimes(filePath);
@@ -918,10 +913,9 @@
// This cleans unreferenced blobs.
m_blobStorage.synchronize();
- if (completionHandlerPtr) {
- RunLoop::main().dispatch([completionHandlerPtr] {
- (*completionHandlerPtr)();
- delete completionHandlerPtr;
+ if (completionHandler) {
+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] {
+ completionHandler();
});
}
});
Modified: trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp (201340 => 201341)
--- trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp 2016-05-24 19:01:35 UTC (rev 201340)
+++ trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp 2016-05-24 19:03:42 UTC (rev 201341)
@@ -307,11 +307,8 @@
void UserContentExtensionStore::lookupContentExtension(const WTF::String& identifier, std::function<void(RefPtr<API::UserContentExtension>, std::error_code)> completionHandler)
{
RefPtr<UserContentExtensionStore> self(this);
- StringCapture identifierCapture(identifier);
- StringCapture pathCapture(m_storePath);
-
- m_readQueue->dispatch([self, identifierCapture, pathCapture, completionHandler] {
- auto path = constructedPath(pathCapture.string(), identifierCapture.string());
+ m_readQueue->dispatch([self, identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler] {
+ auto path = constructedPath(storePath, identifier);
ContentExtensionMetaData metaData;
Data fileData;
@@ -329,8 +326,8 @@
return;
}
- RunLoop::main().dispatch([self, identifierCapture, fileData, metaData, completionHandler] {
- RefPtr<API::UserContentExtension> userContentExtension = createExtension(identifierCapture.string(), metaData, fileData);
+ RunLoop::main().dispatch([self, identifier = identifier.isolatedCopy(), fileData, metaData, completionHandler] {
+ RefPtr<API::UserContentExtension> userContentExtension = createExtension(identifier, metaData, fileData);
completionHandler(userContentExtension, { });
});
});
@@ -339,16 +336,12 @@
void UserContentExtensionStore::compileContentExtension(const WTF::String& identifier, WTF::String&& json, std::function<void(RefPtr<API::UserContentExtension>, std::error_code)> completionHandler)
{
RefPtr<UserContentExtensionStore> self(this);
- StringCapture identifierCapture(identifier);
- StringCapture jsonCapture(WTFMove(json));
- StringCapture pathCapture(m_storePath);
+ m_compileQueue->dispatch([self, identifier = identifier.isolatedCopy(), json = json.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler] () mutable {
+ auto path = constructedPath(storePath, identifier);
- m_compileQueue->dispatch([self, identifierCapture, jsonCapture, pathCapture, completionHandler] () mutable {
- auto path = constructedPath(pathCapture.string(), identifierCapture.string());
-
ContentExtensionMetaData metaData;
Data fileData;
- auto error = compiledToFile(jsonCapture.releaseString(), path, metaData, fileData);
+ auto error = compiledToFile(WTFMove(json), path, metaData, fileData);
if (error) {
RunLoop::main().dispatch([self, error, completionHandler] {
completionHandler(nullptr, error);
@@ -356,8 +349,8 @@
return;
}
- RunLoop::main().dispatch([self, identifierCapture, fileData, metaData, completionHandler] {
- RefPtr<API::UserContentExtension> userContentExtension = createExtension(identifierCapture.string(), metaData, fileData);
+ RunLoop::main().dispatch([self, identifier = identifier.isolatedCopy(), fileData, metaData, completionHandler] {
+ RefPtr<API::UserContentExtension> userContentExtension = createExtension(identifier, metaData, fileData);
completionHandler(userContentExtension, { });
});
});
@@ -366,12 +359,9 @@
void UserContentExtensionStore::removeContentExtension(const WTF::String& identifier, std::function<void(std::error_code)> completionHandler)
{
RefPtr<UserContentExtensionStore> self(this);
- StringCapture identifierCapture(identifier);
- StringCapture pathCapture(m_storePath);
+ m_removeQueue->dispatch([self, identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler] {
+ auto path = constructedPath(storePath, identifier);
- m_removeQueue->dispatch([self, identifierCapture, pathCapture, completionHandler] {
- auto path = constructedPath(pathCapture.string(), identifierCapture.string());
-
if (!WebCore::deleteFile(path)) {
RunLoop::main().dispatch([self, completionHandler] {
completionHandler(Error::RemoveFailed);
Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp (201340 => 201341)
--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp 2016-05-24 19:01:35 UTC (rev 201340)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp 2016-05-24 19:03:42 UTC (rev 201341)
@@ -258,13 +258,11 @@
RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator(fetchOptions, WTFMove(completionHandler)));
- if (dataTypes.contains(WebsiteDataType::DiskCache)) {
- StringCapture mediaCacheDirectory { m_mediaCacheDirectory };
-
#if ENABLE(VIDEO)
+ if (dataTypes.contains(WebsiteDataType::DiskCache)) {
callbackAggregator->addPendingCallback();
- m_queue->dispatch([fetchOptions, mediaCacheDirectory, callbackAggregator] {
- HashSet<RefPtr<WebCore::SecurityOrigin>> origins = WebCore::HTMLMediaElement::originsInMediaCache(mediaCacheDirectory.string());
+ m_queue->dispatch([fetchOptions, mediaCacheDirectory = m_mediaCacheDirectory.isolatedCopy(), callbackAggregator] {
+ HashSet<RefPtr<WebCore::SecurityOrigin>> origins = WebCore::HTMLMediaElement::originsInMediaCache(mediaCacheDirectory);
WebsiteData* websiteData = new WebsiteData;
for (auto& origin : origins) {
@@ -278,8 +276,8 @@
delete websiteData;
});
});
-#endif
}
+#endif
auto networkProcessAccessType = computeNetworkProcessAccessTypeForDataFetch(dataTypes, !isPersistent());
if (networkProcessAccessType != ProcessAccessType::None) {
@@ -357,13 +355,10 @@
}
if (dataTypes.contains(WebsiteDataType::OfflineWebApplicationCache) && isPersistent()) {
- StringCapture applicationCacheDirectory { m_applicationCacheDirectory };
- StringCapture applicationCacheFlatFileSubdirectoryName { m_applicationCacheFlatFileSubdirectoryName };
-
callbackAggregator->addPendingCallback();
- m_queue->dispatch([fetchOptions, applicationCacheDirectory, applicationCacheFlatFileSubdirectoryName, callbackAggregator] {
- auto storage = WebCore::ApplicationCacheStorage::create(applicationCacheDirectory.string(), applicationCacheFlatFileSubdirectoryName.string());
+ m_queue->dispatch([fetchOptions, applicationCacheDirectory = m_applicationCacheDirectory.isolatedCopy(), applicationCacheFlatFileSubdirectoryName = m_applicationCacheFlatFileSubdirectoryName.isolatedCopy(), callbackAggregator] {
+ auto storage = WebCore::ApplicationCacheStorage::create(applicationCacheDirectory, applicationCacheFlatFileSubdirectoryName);
WebsiteData* websiteData = new WebsiteData;
@@ -386,13 +381,11 @@
}
if (dataTypes.contains(WebsiteDataType::WebSQLDatabases) && isPersistent()) {
- StringCapture webSQLDatabaseDirectory { m_webSQLDatabaseDirectory };
-
callbackAggregator->addPendingCallback();
- m_queue->dispatch([webSQLDatabaseDirectory, callbackAggregator] {
+ m_queue->dispatch([webSQLDatabaseDirectory = m_webSQLDatabaseDirectory.isolatedCopy(), callbackAggregator] {
Vector<RefPtr<WebCore::SecurityOrigin>> origins;
- WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory.string())->origins(origins);
+ WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory)->origins(origins);
RunLoop::main().dispatch([callbackAggregator, origins]() mutable {
WebsiteData websiteData;
@@ -418,12 +411,10 @@
#endif
if (dataTypes.contains(WebsiteDataType::MediaKeys) && isPersistent()) {
- StringCapture mediaKeysStorageDirectory { m_mediaKeysStorageDirectory };
-
callbackAggregator->addPendingCallback();
- m_queue->dispatch([mediaKeysStorageDirectory, callbackAggregator] {
- auto origins = mediaKeyOrigins(mediaKeysStorageDirectory.string());
+ m_queue->dispatch([mediaKeysStorageDirectory = m_mediaKeysStorageDirectory.isolatedCopy(), callbackAggregator] {
+ auto origins = mediaKeyOrigins(mediaKeysStorageDirectory);
RunLoop::main().dispatch([callbackAggregator, origins]() mutable {
WebsiteData websiteData;
@@ -556,20 +547,18 @@
RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator(WTFMove(completionHandler)));
- if (dataTypes.contains(WebsiteDataType::DiskCache)) {
- StringCapture mediaCacheDirectory { m_mediaCacheDirectory };
-
#if ENABLE(VIDEO)
+ if (dataTypes.contains(WebsiteDataType::DiskCache)) {
callbackAggregator->addPendingCallback();
- m_queue->dispatch([modifiedSince, mediaCacheDirectory, callbackAggregator] {
- WebCore::HTMLMediaElement::clearMediaCache(mediaCacheDirectory.string(), modifiedSince);
+ m_queue->dispatch([modifiedSince, mediaCacheDirectory = m_mediaCacheDirectory.isolatedCopy(), callbackAggregator] {
+ WebCore::HTMLMediaElement::clearMediaCache(mediaCacheDirectory, modifiedSince);
WTF::RunLoop::main().dispatch([callbackAggregator] {
callbackAggregator->removePendingCallback();
});
});
-#endif
}
+#endif
auto networkProcessAccessType = computeNetworkProcessAccessTypeForDataRemoval(dataTypes, !isPersistent());
if (networkProcessAccessType != ProcessAccessType::None) {
@@ -637,13 +626,10 @@
}
if (dataTypes.contains(WebsiteDataType::OfflineWebApplicationCache) && isPersistent()) {
- StringCapture applicationCacheDirectory { m_applicationCacheDirectory };
- StringCapture applicationCacheFlatFileSubdirectoryName { m_applicationCacheFlatFileSubdirectoryName };
-
callbackAggregator->addPendingCallback();
- m_queue->dispatch([applicationCacheDirectory, applicationCacheFlatFileSubdirectoryName, callbackAggregator] {
- auto storage = WebCore::ApplicationCacheStorage::create(applicationCacheDirectory.string(), applicationCacheFlatFileSubdirectoryName.string());
+ m_queue->dispatch([applicationCacheDirectory = m_applicationCacheDirectory.isolatedCopy(), applicationCacheFlatFileSubdirectoryName = m_applicationCacheFlatFileSubdirectoryName.isolatedCopy(), callbackAggregator] {
+ auto storage = WebCore::ApplicationCacheStorage::create(applicationCacheDirectory, applicationCacheFlatFileSubdirectoryName);
storage->deleteAllCaches();
@@ -654,12 +640,10 @@
}
if (dataTypes.contains(WebsiteDataType::WebSQLDatabases) && isPersistent()) {
- StringCapture webSQLDatabaseDirectory { m_webSQLDatabaseDirectory };
-
callbackAggregator->addPendingCallback();
- m_queue->dispatch([webSQLDatabaseDirectory, callbackAggregator, modifiedSince] {
- WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory.string())->deleteDatabasesModifiedSince(modifiedSince);
+ m_queue->dispatch([webSQLDatabaseDirectory = m_webSQLDatabaseDirectory.isolatedCopy(), callbackAggregator, modifiedSince] {
+ WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory)->deleteDatabasesModifiedSince(modifiedSince);
RunLoop::main().dispatch([callbackAggregator] {
callbackAggregator->removePendingCallback();
@@ -681,12 +665,10 @@
#endif
if (dataTypes.contains(WebsiteDataType::MediaKeys) && isPersistent()) {
- StringCapture mediaKeysStorageDirectory { m_mediaKeysStorageDirectory };
-
callbackAggregator->addPendingCallback();
- m_queue->dispatch([mediaKeysStorageDirectory, callbackAggregator, modifiedSince] {
- removeMediaKeys(mediaKeysStorageDirectory.string(), modifiedSince);
+ m_queue->dispatch([mediaKeysStorageDirectory = m_mediaKeysStorageDirectory.isolatedCopy(), callbackAggregator, modifiedSince] {
+ removeMediaKeys(mediaKeysStorageDirectory, modifiedSince);
RunLoop::main().dispatch([callbackAggregator] {
callbackAggregator->removePendingCallback();
@@ -799,25 +781,24 @@
RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator(WTFMove(completionHandler)));
+#if ENABLE(VIDEO)
if (dataTypes.contains(WebsiteDataType::DiskCache)) {
- StringCapture mediaCacheDirectory { m_mediaCacheDirectory };
HashSet<RefPtr<WebCore::SecurityOrigin>> origins;
for (const auto& dataRecord : dataRecords) {
for (const auto& origin : dataRecord.origins)
origins.add(origin);
}
-#if ENABLE(VIDEO)
callbackAggregator->addPendingCallback();
- m_queue->dispatch([origins, mediaCacheDirectory, callbackAggregator] {
- WebCore::HTMLMediaElement::clearMediaCacheForOrigins(mediaCacheDirectory.string(), origins);
+ m_queue->dispatch([origins, mediaCacheDirectory = m_mediaCacheDirectory.isolatedCopy(), callbackAggregator] {
+ WebCore::HTMLMediaElement::clearMediaCacheForOrigins(mediaCacheDirectory, origins);
WTF::RunLoop::main().dispatch([callbackAggregator] {
callbackAggregator->removePendingCallback();
});
});
-#endif
}
+#endif
auto networkProcessAccessType = computeNetworkProcessAccessTypeForDataRemoval(dataTypes, !isPersistent());
if (networkProcessAccessType != ProcessAccessType::None) {
@@ -892,9 +873,6 @@
}
if (dataTypes.contains(WebsiteDataType::OfflineWebApplicationCache) && isPersistent()) {
- StringCapture applicationCacheDirectory { m_applicationCacheDirectory };
- StringCapture applicationCacheFlatFileSubdirectoryName { m_applicationCacheFlatFileSubdirectoryName };
-
HashSet<RefPtr<WebCore::SecurityOrigin>> origins;
for (const auto& dataRecord : dataRecords) {
for (const auto& origin : dataRecord.origins)
@@ -902,8 +880,8 @@
}
callbackAggregator->addPendingCallback();
- m_queue->dispatch([origins, applicationCacheDirectory, applicationCacheFlatFileSubdirectoryName, callbackAggregator] {
- auto storage = WebCore::ApplicationCacheStorage::create(applicationCacheDirectory.string(), applicationCacheFlatFileSubdirectoryName.string());
+ m_queue->dispatch([origins, applicationCacheDirectory = m_applicationCacheDirectory.isolatedCopy(), applicationCacheFlatFileSubdirectoryName = m_applicationCacheFlatFileSubdirectoryName.isolatedCopy(), callbackAggregator] {
+ auto storage = WebCore::ApplicationCacheStorage::create(applicationCacheDirectory, applicationCacheFlatFileSubdirectoryName);
for (const auto& origin : origins)
storage->deleteCacheForOrigin(*origin);
@@ -915,8 +893,6 @@
}
if (dataTypes.contains(WebsiteDataType::WebSQLDatabases) && isPersistent()) {
- StringCapture webSQLDatabaseDirectory { m_webSQLDatabaseDirectory };
-
HashSet<RefPtr<WebCore::SecurityOrigin>> origins;
for (const auto& dataRecord : dataRecords) {
for (const auto& origin : dataRecord.origins)
@@ -924,8 +900,8 @@
}
callbackAggregator->addPendingCallback();
- m_queue->dispatch([origins, callbackAggregator, webSQLDatabaseDirectory] {
- auto databaseTracker = WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory.string());
+ m_queue->dispatch([origins, callbackAggregator, webSQLDatabaseDirectory = m_webSQLDatabaseDirectory.isolatedCopy()] {
+ auto databaseTracker = WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory);
for (const auto& origin : origins)
databaseTracker->deleteOrigin(origin.get());
@@ -950,7 +926,6 @@
#endif
if (dataTypes.contains(WebsiteDataType::MediaKeys) && isPersistent()) {
- StringCapture mediaKeysStorageDirectory { m_mediaKeysStorageDirectory };
HashSet<RefPtr<WebCore::SecurityOrigin>> origins;
for (const auto& dataRecord : dataRecords) {
for (const auto& origin : dataRecord.origins)
@@ -958,9 +933,9 @@
}
callbackAggregator->addPendingCallback();
- m_queue->dispatch([mediaKeysStorageDirectory, callbackAggregator, origins] {
+ m_queue->dispatch([mediaKeysStorageDirectory = m_mediaKeysStorageDirectory.isolatedCopy(), callbackAggregator, origins] {
- removeMediaKeys(mediaKeysStorageDirectory.string(), origins);
+ removeMediaKeys(mediaKeysStorageDirectory, origins);
RunLoop::main().dispatch([callbackAggregator] {
callbackAggregator->removePendingCallback();