Diff
Modified: trunk/Source/WebCore/ChangeLog (201353 => 201354)
--- trunk/Source/WebCore/ChangeLog 2016-05-24 21:30:14 UTC (rev 201353)
+++ trunk/Source/WebCore/ChangeLog 2016-05-24 21:38:50 UTC (rev 201354)
@@ -1,3 +1,16 @@
+2016-05-24 Ryan Haddad <[email protected]>
+
+ Unreviewed, rolling out r201341.
+
+ This change may have caused LayoutTests to crash on Mac and
+ iOS
+
+ Reverted changeset:
+
+ "Use lambda capture with initializer instead of StringCapture"
+ https://bugs.webkit.org/show_bug.cgi?id=158010
+ http://trac.webkit.org/changeset/201341
+
2016-05-24 Adam Bergkvist <[email protected]>
WebRTC: RTCIceCandidate: Make attributes readonly (and update constructor arg)
Modified: trunk/Source/WebCore/fileapi/AsyncFileStream.cpp (201353 => 201354)
--- trunk/Source/WebCore/fileapi/AsyncFileStream.cpp 2016-05-24 21:30:14 UTC (rev 201353)
+++ trunk/Source/WebCore/fileapi/AsyncFileStream.cpp 2016-05-24 21:38:50 UTC (rev 201354)
@@ -138,10 +138,11 @@
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([path = path.isolatedCopy(), expectedModificationTime](FileStream& stream) -> std::function<void(FileStreamClient&)> {
- long long size = stream.getSize(path, expectedModificationTime);
+ perform([capturedPath, expectedModificationTime](FileStream& stream) -> std::function<void(FileStreamClient&)> {
+ long long size = stream.getSize(capturedPath.string(), expectedModificationTime);
return [size](FileStreamClient& client) {
client.didGetSize(size);
};
@@ -150,9 +151,10 @@
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([path = path.isolatedCopy(), offset, length](FileStream& stream) -> std::function<void(FileStreamClient&)> {
- bool success = stream.openForRead(path, offset, length);
+ perform([capturedPath, offset, length](FileStream& stream) -> std::function<void(FileStreamClient&)> {
+ bool success = stream.openForRead(capturedPath.string(), offset, length);
return [success](FileStreamClient& client) {
client.didOpen(success);
};
@@ -161,8 +163,9 @@
void AsyncFileStream::openForWrite(const String& path)
{
- perform([path = path.isolatedCopy()](FileStream& stream) -> std::function<void(FileStreamClient&)> {
- bool success = stream.openForWrite(path);
+ StringCapture capturedPath(path);
+ perform([capturedPath](FileStream& stream) -> std::function<void(FileStreamClient&)> {
+ bool success = stream.openForWrite(capturedPath.string());
return [success](FileStreamClient& client) {
client.didOpen(success);
};
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (201353 => 201354)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2016-05-24 21:30:14 UTC (rev 201353)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2016-05-24 21:38:50 UTC (rev 201354)
@@ -1703,9 +1703,10 @@
String unblockRequestDeniedScript { contentFilter.unblockRequestDeniedScript() };
if (!unblockRequestDeniedScript.isEmpty() && frame) {
static_assert(std::is_base_of<ThreadSafeRefCounted<Frame>, Frame>::value, "Frame must be ThreadSafeRefCounted.");
- unblockHandler.wrapWithDecisionHandler([frame, unblockRequestDeniedScript = unblockRequestDeniedScript.isolatedCopy()](bool unblocked) {
+ StringCapture capturedScript { unblockRequestDeniedScript };
+ unblockHandler.wrapWithDecisionHandler([frame, capturedScript](bool unblocked) {
if (!unblocked)
- frame->script().executeScript(unblockRequestDeniedScript);
+ frame->script().executeScript(capturedScript.string());
});
}
frameLoader()->client().contentFilterDidBlockLoad(WTFMove(unblockHandler));
Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp (201353 => 201354)
--- trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp 2016-05-24 21:30:14 UTC (rev 201353)
+++ trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp 2016-05-24 21:38:50 UTC (rev 201354)
@@ -98,12 +98,13 @@
auto* contentSecurityPolicyCopy = std::make_unique<ContentSecurityPolicy>(*securityOrigin).release();
contentSecurityPolicyCopy->copyStateFrom(contentSecurityPolicy);
- m_loaderProxy.postTaskToLoader([this, requestData, optionsCopy, contentSecurityPolicyCopy, outgoingReferrer = outgoingReferrer.isolatedCopy()](ScriptExecutionContext& context) {
+ StringCapture capturedOutgoingReferrer(outgoingReferrer);
+ m_loaderProxy.postTaskToLoader([this, requestData, optionsCopy, contentSecurityPolicyCopy, capturedOutgoingReferrer](ScriptExecutionContext& context) {
ASSERT(isMainThread());
Document& document = downcast<Document>(context);
auto request = ResourceRequest::adopt(std::unique_ptr<CrossThreadResourceRequestData>(requestData));
- request->setHTTPReferrer(outgoingReferrer);
+ request->setHTTPReferrer(capturedOutgoingReferrer.string());
auto options = std::unique_ptr<ThreadableLoaderOptions>(optionsCopy);
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (201353 => 201354)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2016-05-24 21:30:14 UTC (rev 201353)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2016-05-24 21:38:50 UTC (rev 201354)
@@ -430,9 +430,10 @@
{
ASSERT(WebThreadIsCurrent());
RefPtr<WebVideoFullscreenControllerContext> protectedThis(this);
- dispatch_async(dispatch_get_main_queue(), [protectedThis, this, enabled, type, localizedDeviceName = localizedDeviceName.isolatedCopy()] {
+ StringCapture capturedLocalizedDeviceName(localizedDeviceName);
+ dispatch_async(dispatch_get_main_queue(), [protectedThis, this, enabled, type, capturedLocalizedDeviceName] {
if (m_interface)
- m_interface->setExternalPlayback(enabled, type, localizedDeviceName);
+ m_interface->setExternalPlayback(enabled, type, capturedLocalizedDeviceName.string());
});
}
Modified: trunk/Source/WebCore/platform/network/curl/CurlDownload.cpp (201353 => 201354)
--- trunk/Source/WebCore/platform/network/curl/CurlDownload.cpp 2016-05-24 21:30:14 UTC (rev 201353)
+++ trunk/Source/WebCore/platform/network/curl/CurlDownload.cpp 2016-05-24 21:38:50 UTC (rev 201354)
@@ -414,12 +414,14 @@
});
}
} else {
+ StringCapture capturedHeader(header);
+
RefPtr<CurlDownload> protectedThis(this);
- callOnMainThread([this, header = header.isolatedCopy(), protectedThis] {
- int splitPos = header.find(":");
+ callOnMainThread([this, capturedHeader, protectedThis] {
+ int splitPos = capturedHeader.string().find(":");
if (splitPos != -1)
- m_response.setHTTPHeaderField(header.left(splitPos), header.substring(splitPos + 1).stripWhiteSpace());
+ m_response.setHTTPHeaderField(capturedHeader.string().left(splitPos), capturedHeader.string().substring(splitPos + 1).stripWhiteSpace());
});
}
}
Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp (201353 => 201354)
--- trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp 2016-05-24 21:30:14 UTC (rev 201353)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp 2016-05-24 21:38:50 UTC (rev 201354)
@@ -141,7 +141,9 @@
void WorkerMessagingProxy::postExceptionToWorkerObject(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL)
{
- m_scriptExecutionContext->postTask([this, errorMessage = errorMessage.isolatedCopy(), sourceURL = sourceURL.isolatedCopy(), lineNumber, columnNumber] (ScriptExecutionContext& context) {
+ StringCapture capturedErrorMessage(errorMessage);
+ StringCapture capturedSourceURL(sourceURL);
+ m_scriptExecutionContext->postTask([this, capturedErrorMessage, capturedSourceURL, lineNumber, columnNumber] (ScriptExecutionContext& context) {
Worker* workerObject = this->workerObject();
if (!workerObject)
return;
@@ -149,18 +151,20 @@
// 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(errorMessage, sourceURL, lineNumber, columnNumber));
+ bool errorHandled = !workerObject->dispatchEvent(ErrorEvent::create(capturedErrorMessage.string(), capturedSourceURL.string(), lineNumber, columnNumber));
if (!errorHandled)
- context.reportException(errorMessage, lineNumber, columnNumber, sourceURL, 0);
+ context.reportException(capturedErrorMessage.string(), lineNumber, columnNumber, capturedSourceURL.string(), 0);
});
}
void WorkerMessagingProxy::postConsoleMessageToWorkerObject(MessageSource source, MessageLevel level, const String& message, int lineNumber, int columnNumber, const String& sourceURL)
{
- m_scriptExecutionContext->postTask([this, source, level, message = message.isolatedCopy(), sourceURL = sourceURL.isolatedCopy(), lineNumber, columnNumber] (ScriptExecutionContext& context) {
+ StringCapture capturedMessage(message);
+ StringCapture capturedSourceURL(sourceURL);
+ m_scriptExecutionContext->postTask([this, source, level, capturedMessage, capturedSourceURL, lineNumber, columnNumber] (ScriptExecutionContext& context) {
if (askedToTerminate())
return;
- context.addConsoleMessage(source, level, message, sourceURL, lineNumber, columnNumber);
+ context.addConsoleMessage(source, level, capturedMessage.string(), capturedSourceURL.string(), lineNumber, columnNumber);
});
}
Modified: trunk/Source/WebKit2/ChangeLog (201353 => 201354)
--- trunk/Source/WebKit2/ChangeLog 2016-05-24 21:30:14 UTC (rev 201353)
+++ trunk/Source/WebKit2/ChangeLog 2016-05-24 21:38:50 UTC (rev 201354)
@@ -1,3 +1,16 @@
+2016-05-24 Ryan Haddad <[email protected]>
+
+ Unreviewed, rolling out r201341.
+
+ This change may have caused LayoutTests to crash on Mac and
+ iOS
+
+ Reverted changeset:
+
+ "Use lambda capture with initializer instead of StringCapture"
+ https://bugs.webkit.org/show_bug.cgi?id=158010
+ http://trac.webkit.org/changeset/201341
+
2016-05-24 Alex Christensen <[email protected]>
Fix null pointer dereferencing in WebViewImpl::inputContext
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp (201353 => 201354)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp 2016-05-24 21:30:14 UTC (rev 201353)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp 2016-05-24 21:38:50 UTC (rev 201354)
@@ -618,8 +618,9 @@
void Cache::deleteDumpFile()
{
auto queue = WorkQueue::create("com.apple.WebKit.Cache.delete");
- queue->dispatch([filePath = dumpFilePath().isolatedCopy()] {
- WebCore::deleteFile(filePath);
+ StringCapture dumpFilePathCapture(dumpFilePath());
+ queue->dispatch([dumpFilePathCapture] {
+ WebCore::deleteFile(dumpFilePathCapture.string());
});
}
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.cpp (201353 => 201354)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.cpp 2016-05-24 21:30:14 UTC (rev 201353)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.cpp 2016-05-24 21:38:50 UTC (rev 201354)
@@ -93,9 +93,13 @@
ASSERT(RunLoop::isMain());
auto startTime = std::chrono::system_clock::now();
- serialBackgroundIOQueue().dispatch([this, databasePath = databasePath.isolatedCopy(), networkCachePath = singleton().recordsPath().isolatedCopy(), startTime] {
+
+ StringCapture databasePathCapture(databasePath);
+ StringCapture networkCachePathCapture(singleton().recordsPath());
+ serialBackgroundIOQueue().dispatch([this, databasePathCapture, networkCachePathCapture, startTime] {
WebCore::SQLiteTransactionInProgressAutoCounter transactionCounter;
+ String databasePath = databasePathCapture.string();
if (!WebCore::makeAllDirectories(WebCore::directoryName(databasePath)))
return;
@@ -124,7 +128,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(networkCachePath);
+ bootstrapFromNetworkCache(networkCachePathCapture.string());
#if !LOG_DISABLED
elapsedMS = static_cast<int64_t>(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - startTime).count());
#endif
@@ -172,8 +176,9 @@
clear();
- serialBackgroundIOQueue().dispatch([this, networkCachePath = singleton().recordsPath().isolatedCopy()] {
- bootstrapFromNetworkCache(networkCachePath);
+ StringCapture networkCachePathCapture(singleton().recordsPath());
+ serialBackgroundIOQueue().dispatch([this, networkCachePathCapture] {
+ bootstrapFromNetworkCache(networkCachePathCapture.string());
LOG(NetworkCache, "(NetworkProcess) statistics cache shrink completed m_approximateEntryCount=%lu", static_cast<size_t>(m_approximateEntryCount));
});
}
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp (201353 => 201354)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp 2016-05-24 21:30:14 UTC (rev 201353)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp 2016-05-24 21:38:50 UTC (rev 201354)
@@ -558,8 +558,9 @@
void Storage::updateFileModificationTime(const String& path)
{
- serialBackgroundIOQueue().dispatch([path = path.isolatedCopy()] {
- updateFileModificationTimeIfNeeded(path);
+ StringCapture filePathCapture(path);
+ serialBackgroundIOQueue().dispatch([filePathCapture] {
+ updateFileModificationTimeIfNeeded(filePathCapture.string());
});
}
@@ -896,9 +897,13 @@
if (m_blobFilter)
m_blobFilter->clear();
m_approximateRecordsSize = 0;
- ioQueue().dispatch([this, modifiedSinceTime, completionHandler = WTFMove(completionHandler), type = type.isolatedCopy()] () mutable {
+
+ // 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] {
auto recordsPath = this->recordsPath();
- traverseRecordsFiles(recordsPath, type, [modifiedSinceTime](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) {
+ traverseRecordsFiles(recordsPath, typeCapture.string(), [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);
@@ -913,9 +918,10 @@
// This cleans unreferenced blobs.
m_blobStorage.synchronize();
- if (completionHandler) {
- RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] {
- completionHandler();
+ if (completionHandlerPtr) {
+ RunLoop::main().dispatch([completionHandlerPtr] {
+ (*completionHandlerPtr)();
+ delete completionHandlerPtr;
});
}
});
Modified: trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp (201353 => 201354)
--- trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp 2016-05-24 21:30:14 UTC (rev 201353)
+++ trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp 2016-05-24 21:38:50 UTC (rev 201354)
@@ -307,8 +307,11 @@
void UserContentExtensionStore::lookupContentExtension(const WTF::String& identifier, std::function<void(RefPtr<API::UserContentExtension>, std::error_code)> completionHandler)
{
RefPtr<UserContentExtensionStore> self(this);
- m_readQueue->dispatch([self, identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler] {
- auto path = constructedPath(storePath, identifier);
+ StringCapture identifierCapture(identifier);
+ StringCapture pathCapture(m_storePath);
+
+ m_readQueue->dispatch([self, identifierCapture, pathCapture, completionHandler] {
+ auto path = constructedPath(pathCapture.string(), identifierCapture.string());
ContentExtensionMetaData metaData;
Data fileData;
@@ -326,8 +329,8 @@
return;
}
- RunLoop::main().dispatch([self, identifier = identifier.isolatedCopy(), fileData, metaData, completionHandler] {
- RefPtr<API::UserContentExtension> userContentExtension = createExtension(identifier, metaData, fileData);
+ RunLoop::main().dispatch([self, identifierCapture, fileData, metaData, completionHandler] {
+ RefPtr<API::UserContentExtension> userContentExtension = createExtension(identifierCapture.string(), metaData, fileData);
completionHandler(userContentExtension, { });
});
});
@@ -336,12 +339,16 @@
void UserContentExtensionStore::compileContentExtension(const WTF::String& identifier, WTF::String&& json, std::function<void(RefPtr<API::UserContentExtension>, std::error_code)> completionHandler)
{
RefPtr<UserContentExtensionStore> self(this);
- m_compileQueue->dispatch([self, identifier = identifier.isolatedCopy(), json = json.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler] () mutable {
- auto path = constructedPath(storePath, identifier);
+ StringCapture identifierCapture(identifier);
+ StringCapture jsonCapture(WTFMove(json));
+ StringCapture pathCapture(m_storePath);
+ m_compileQueue->dispatch([self, identifierCapture, jsonCapture, pathCapture, completionHandler] () mutable {
+ auto path = constructedPath(pathCapture.string(), identifierCapture.string());
+
ContentExtensionMetaData metaData;
Data fileData;
- auto error = compiledToFile(WTFMove(json), path, metaData, fileData);
+ auto error = compiledToFile(jsonCapture.releaseString(), path, metaData, fileData);
if (error) {
RunLoop::main().dispatch([self, error, completionHandler] {
completionHandler(nullptr, error);
@@ -349,8 +356,8 @@
return;
}
- RunLoop::main().dispatch([self, identifier = identifier.isolatedCopy(), fileData, metaData, completionHandler] {
- RefPtr<API::UserContentExtension> userContentExtension = createExtension(identifier, metaData, fileData);
+ RunLoop::main().dispatch([self, identifierCapture, fileData, metaData, completionHandler] {
+ RefPtr<API::UserContentExtension> userContentExtension = createExtension(identifierCapture.string(), metaData, fileData);
completionHandler(userContentExtension, { });
});
});
@@ -359,9 +366,12 @@
void UserContentExtensionStore::removeContentExtension(const WTF::String& identifier, std::function<void(std::error_code)> completionHandler)
{
RefPtr<UserContentExtensionStore> self(this);
- m_removeQueue->dispatch([self, identifier = identifier.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler] {
- auto path = constructedPath(storePath, identifier);
+ StringCapture identifierCapture(identifier);
+ StringCapture pathCapture(m_storePath);
+ 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 (201353 => 201354)
--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp 2016-05-24 21:30:14 UTC (rev 201353)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp 2016-05-24 21:38:50 UTC (rev 201354)
@@ -258,11 +258,13 @@
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 = m_mediaCacheDirectory.isolatedCopy(), callbackAggregator] {
- HashSet<RefPtr<WebCore::SecurityOrigin>> origins = WebCore::HTMLMediaElement::originsInMediaCache(mediaCacheDirectory);
+ m_queue->dispatch([fetchOptions, mediaCacheDirectory, callbackAggregator] {
+ HashSet<RefPtr<WebCore::SecurityOrigin>> origins = WebCore::HTMLMediaElement::originsInMediaCache(mediaCacheDirectory.string());
WebsiteData* websiteData = new WebsiteData;
for (auto& origin : origins) {
@@ -276,8 +278,8 @@
delete websiteData;
});
});
+#endif
}
-#endif
auto networkProcessAccessType = computeNetworkProcessAccessTypeForDataFetch(dataTypes, !isPersistent());
if (networkProcessAccessType != ProcessAccessType::None) {
@@ -355,10 +357,13 @@
}
if (dataTypes.contains(WebsiteDataType::OfflineWebApplicationCache) && isPersistent()) {
+ StringCapture applicationCacheDirectory { m_applicationCacheDirectory };
+ StringCapture applicationCacheFlatFileSubdirectoryName { m_applicationCacheFlatFileSubdirectoryName };
+
callbackAggregator->addPendingCallback();
- m_queue->dispatch([fetchOptions, applicationCacheDirectory = m_applicationCacheDirectory.isolatedCopy(), applicationCacheFlatFileSubdirectoryName = m_applicationCacheFlatFileSubdirectoryName.isolatedCopy(), callbackAggregator] {
- auto storage = WebCore::ApplicationCacheStorage::create(applicationCacheDirectory, applicationCacheFlatFileSubdirectoryName);
+ m_queue->dispatch([fetchOptions, applicationCacheDirectory, applicationCacheFlatFileSubdirectoryName, callbackAggregator] {
+ auto storage = WebCore::ApplicationCacheStorage::create(applicationCacheDirectory.string(), applicationCacheFlatFileSubdirectoryName.string());
WebsiteData* websiteData = new WebsiteData;
@@ -381,11 +386,13 @@
}
if (dataTypes.contains(WebsiteDataType::WebSQLDatabases) && isPersistent()) {
+ StringCapture webSQLDatabaseDirectory { m_webSQLDatabaseDirectory };
+
callbackAggregator->addPendingCallback();
- m_queue->dispatch([webSQLDatabaseDirectory = m_webSQLDatabaseDirectory.isolatedCopy(), callbackAggregator] {
+ m_queue->dispatch([webSQLDatabaseDirectory, callbackAggregator] {
Vector<RefPtr<WebCore::SecurityOrigin>> origins;
- WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory)->origins(origins);
+ WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory.string())->origins(origins);
RunLoop::main().dispatch([callbackAggregator, origins]() mutable {
WebsiteData websiteData;
@@ -411,10 +418,12 @@
#endif
if (dataTypes.contains(WebsiteDataType::MediaKeys) && isPersistent()) {
+ StringCapture mediaKeysStorageDirectory { m_mediaKeysStorageDirectory };
+
callbackAggregator->addPendingCallback();
- m_queue->dispatch([mediaKeysStorageDirectory = m_mediaKeysStorageDirectory.isolatedCopy(), callbackAggregator] {
- auto origins = mediaKeyOrigins(mediaKeysStorageDirectory);
+ m_queue->dispatch([mediaKeysStorageDirectory, callbackAggregator] {
+ auto origins = mediaKeyOrigins(mediaKeysStorageDirectory.string());
RunLoop::main().dispatch([callbackAggregator, origins]() mutable {
WebsiteData websiteData;
@@ -547,18 +556,20 @@
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 = m_mediaCacheDirectory.isolatedCopy(), callbackAggregator] {
- WebCore::HTMLMediaElement::clearMediaCache(mediaCacheDirectory, modifiedSince);
+ m_queue->dispatch([modifiedSince, mediaCacheDirectory, callbackAggregator] {
+ WebCore::HTMLMediaElement::clearMediaCache(mediaCacheDirectory.string(), modifiedSince);
WTF::RunLoop::main().dispatch([callbackAggregator] {
callbackAggregator->removePendingCallback();
});
});
+#endif
}
-#endif
auto networkProcessAccessType = computeNetworkProcessAccessTypeForDataRemoval(dataTypes, !isPersistent());
if (networkProcessAccessType != ProcessAccessType::None) {
@@ -626,10 +637,13 @@
}
if (dataTypes.contains(WebsiteDataType::OfflineWebApplicationCache) && isPersistent()) {
+ StringCapture applicationCacheDirectory { m_applicationCacheDirectory };
+ StringCapture applicationCacheFlatFileSubdirectoryName { m_applicationCacheFlatFileSubdirectoryName };
+
callbackAggregator->addPendingCallback();
- m_queue->dispatch([applicationCacheDirectory = m_applicationCacheDirectory.isolatedCopy(), applicationCacheFlatFileSubdirectoryName = m_applicationCacheFlatFileSubdirectoryName.isolatedCopy(), callbackAggregator] {
- auto storage = WebCore::ApplicationCacheStorage::create(applicationCacheDirectory, applicationCacheFlatFileSubdirectoryName);
+ m_queue->dispatch([applicationCacheDirectory, applicationCacheFlatFileSubdirectoryName, callbackAggregator] {
+ auto storage = WebCore::ApplicationCacheStorage::create(applicationCacheDirectory.string(), applicationCacheFlatFileSubdirectoryName.string());
storage->deleteAllCaches();
@@ -640,10 +654,12 @@
}
if (dataTypes.contains(WebsiteDataType::WebSQLDatabases) && isPersistent()) {
+ StringCapture webSQLDatabaseDirectory { m_webSQLDatabaseDirectory };
+
callbackAggregator->addPendingCallback();
- m_queue->dispatch([webSQLDatabaseDirectory = m_webSQLDatabaseDirectory.isolatedCopy(), callbackAggregator, modifiedSince] {
- WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory)->deleteDatabasesModifiedSince(modifiedSince);
+ m_queue->dispatch([webSQLDatabaseDirectory, callbackAggregator, modifiedSince] {
+ WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory.string())->deleteDatabasesModifiedSince(modifiedSince);
RunLoop::main().dispatch([callbackAggregator] {
callbackAggregator->removePendingCallback();
@@ -665,10 +681,12 @@
#endif
if (dataTypes.contains(WebsiteDataType::MediaKeys) && isPersistent()) {
+ StringCapture mediaKeysStorageDirectory { m_mediaKeysStorageDirectory };
+
callbackAggregator->addPendingCallback();
- m_queue->dispatch([mediaKeysStorageDirectory = m_mediaKeysStorageDirectory.isolatedCopy(), callbackAggregator, modifiedSince] {
- removeMediaKeys(mediaKeysStorageDirectory, modifiedSince);
+ m_queue->dispatch([mediaKeysStorageDirectory, callbackAggregator, modifiedSince] {
+ removeMediaKeys(mediaKeysStorageDirectory.string(), modifiedSince);
RunLoop::main().dispatch([callbackAggregator] {
callbackAggregator->removePendingCallback();
@@ -781,24 +799,25 @@
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 = m_mediaCacheDirectory.isolatedCopy(), callbackAggregator] {
- WebCore::HTMLMediaElement::clearMediaCacheForOrigins(mediaCacheDirectory, origins);
+ m_queue->dispatch([origins, mediaCacheDirectory, callbackAggregator] {
+ WebCore::HTMLMediaElement::clearMediaCacheForOrigins(mediaCacheDirectory.string(), origins);
WTF::RunLoop::main().dispatch([callbackAggregator] {
callbackAggregator->removePendingCallback();
});
});
+#endif
}
-#endif
auto networkProcessAccessType = computeNetworkProcessAccessTypeForDataRemoval(dataTypes, !isPersistent());
if (networkProcessAccessType != ProcessAccessType::None) {
@@ -873,6 +892,9 @@
}
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)
@@ -880,8 +902,8 @@
}
callbackAggregator->addPendingCallback();
- m_queue->dispatch([origins, applicationCacheDirectory = m_applicationCacheDirectory.isolatedCopy(), applicationCacheFlatFileSubdirectoryName = m_applicationCacheFlatFileSubdirectoryName.isolatedCopy(), callbackAggregator] {
- auto storage = WebCore::ApplicationCacheStorage::create(applicationCacheDirectory, applicationCacheFlatFileSubdirectoryName);
+ m_queue->dispatch([origins, applicationCacheDirectory, applicationCacheFlatFileSubdirectoryName, callbackAggregator] {
+ auto storage = WebCore::ApplicationCacheStorage::create(applicationCacheDirectory.string(), applicationCacheFlatFileSubdirectoryName.string());
for (const auto& origin : origins)
storage->deleteCacheForOrigin(*origin);
@@ -893,6 +915,8 @@
}
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)
@@ -900,8 +924,8 @@
}
callbackAggregator->addPendingCallback();
- m_queue->dispatch([origins, callbackAggregator, webSQLDatabaseDirectory = m_webSQLDatabaseDirectory.isolatedCopy()] {
- auto databaseTracker = WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory);
+ m_queue->dispatch([origins, callbackAggregator, webSQLDatabaseDirectory] {
+ auto databaseTracker = WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory.string());
for (const auto& origin : origins)
databaseTracker->deleteOrigin(origin.get());
@@ -926,6 +950,7 @@
#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)
@@ -933,9 +958,9 @@
}
callbackAggregator->addPendingCallback();
- m_queue->dispatch([mediaKeysStorageDirectory = m_mediaKeysStorageDirectory.isolatedCopy(), callbackAggregator, origins] {
+ m_queue->dispatch([mediaKeysStorageDirectory, callbackAggregator, origins] {
- removeMediaKeys(mediaKeysStorageDirectory, origins);
+ removeMediaKeys(mediaKeysStorageDirectory.string(), origins);
RunLoop::main().dispatch([callbackAggregator] {
callbackAggregator->removePendingCallback();