Fix unused lambdas in WebKit2
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 14 May 2017 10:41:40 +0000 (10:41 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 14 May 2017 10:41:40 +0000 (10:41 +0000)
<https://webkit.org/b/172090>

Reviewed by Chris Dumez.

Fixes unused lambda warnings found with newer clang.

* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::retrieve):
* NetworkProcess/cache/NetworkCacheStatistics.cpp:
(WebKit::NetworkCache::Statistics::initialize):
- Use UNUSED_PARAM() to silence unused lambda warning since
  'startTime' is used in Debug builds.

* NetworkProcess/capture/NetworkCaptureManager.cpp:
(WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
- Remove unused 'this' from lambda capture.

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
(-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
(-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
- Use UNUSED_PARAM() to silence unused lambda warning since
  'taskIdentifier' is used in Debug builds.

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
(WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
- Remove unused 'this' from lambda captures.

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::fetchData):
- Remove unused 'fetchOptions' from lambda capture.
(WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
- Remove unused 'this' from lambda capture.

* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::forceRepaintIfNeeded):
- Remove unused 'this' from lambda capture.

* WebProcess/cocoa/WebVideoFullscreenManager.mm:
(WebKit::WebVideoFullscreenManager::didExitFullscreen):
- Remove unused 'this' from nested lambda captures.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216841 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.cpp
Source/WebKit2/NetworkProcess/capture/NetworkCaptureManager.cpp
Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm
Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp
Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm
Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm

index 0ef6044..a6686ec 100644 (file)
@@ -1,3 +1,50 @@
+2017-05-14  David Kilzer  <ddkilzer@apple.com>
+
+        Fix unused lambdas in WebKit2
+        <https://webkit.org/b/172090>
+
+        Reviewed by Chris Dumez.
+
+        Fixes unused lambda warnings found with newer clang.
+
+        * NetworkProcess/cache/NetworkCache.cpp:
+        (WebKit::NetworkCache::Cache::retrieve):
+        * NetworkProcess/cache/NetworkCacheStatistics.cpp:
+        (WebKit::NetworkCache::Statistics::initialize):
+        - Use UNUSED_PARAM() to silence unused lambda warning since
+          'startTime' is used in Debug builds.
+
+        * NetworkProcess/capture/NetworkCaptureManager.cpp:
+        (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
+        - Remove unused 'this' from lambda capture.
+
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
+        (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
+        (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
+        (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
+        - Use UNUSED_PARAM() to silence unused lambda warning since
+          'taskIdentifier' is used in Debug builds.
+
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
+        (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
+        - Remove unused 'this' from lambda captures.
+
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::fetchData):
+        - Remove unused 'fetchOptions' from lambda capture.
+        (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
+        - Remove unused 'this' from lambda capture.
+
+        * UIProcess/mac/ViewGestureControllerMac.mm:
+        (WebKit::ViewGestureController::forceRepaintIfNeeded):
+        - Remove unused 'this' from lambda capture.
+
+        * WebProcess/cocoa/WebVideoFullscreenManager.mm:
+        (WebKit::WebVideoFullscreenManager::didExitFullscreen):
+        - Remove unused 'this' from nested lambda captures.
+
 2017-05-13  Eric Carlson  <eric.carlson@apple.com>
 
         [MediaStream] deviceId constraint doesn't work with getUserMedia
index cd29b6d..97dc902 100644 (file)
@@ -382,6 +382,8 @@ void Cache::retrieve(const WebCore::ResourceRequest& request, const GlobalFrameI
 #if !LOG_DISABLED
         auto elapsedMS = static_cast<int64_t>(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - startTime).count());
         LOG(NetworkCache, "(NetworkProcess) retrieve complete useDecision=%d priority=%d time=%" PRIi64 "ms", static_cast<int>(useDecision), static_cast<int>(request.priority()), elapsedMS);
+#else
+        UNUSED_PARAM(startTime);
 #endif
         completionHandler(WTFMove(entry));
 
index ecdafea..2be7172 100644 (file)
@@ -122,6 +122,8 @@ void Statistics::initialize(const String& databasePath)
 
 #if !LOG_DISABLED
         auto elapsedMS = static_cast<int64_t>(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - startTime).count());
+#else
+        UNUSED_PARAM(startTime);
 #endif
         LOG(NetworkCache, "(NetworkProcess) Network cache statistics database load complete, entries=%lu time=%" PRIi64 "ms", static_cast<size_t>(m_approximateEntryCount), elapsedMS);
 
@@ -129,6 +131,8 @@ void Statistics::initialize(const String& databasePath)
             bootstrapFromNetworkCache(networkCachePath);
 #if !LOG_DISABLED
             elapsedMS = static_cast<int64_t>(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - startTime).count());
+#else
+            UNUSED_PARAM(startTime);
 #endif
             LOG(NetworkCache, "(NetworkProcess) Network cache statistics database bootstrapping complete, entries=%lu time=%" PRIi64 "ms", static_cast<size_t>(m_approximateEntryCount), elapsedMS);
         }
index bf8ff4d..6ed4fb3 100644 (file)
@@ -298,7 +298,7 @@ int Manager::fuzzyMatchURLs(const WebCore::URL& requestURL, const WebCore::URLPa
         } else {
             DEBUG_LOG("Mismatching parameter names: " STRING_SPECIFIER ", " STRING_SPECIFIER, DEBUG_STR(requestParameter->first), DEBUG_STR(resourceParameter->first));
 
-            const auto scanForwardForMatch = [this, &score, kParameterMatchScore, kParameterMismatchScore, kParameterMissingScore](const auto& fixedIter, auto& scanningIter, const auto& scannerEnd) {
+            const auto scanForwardForMatch = [&score, kParameterMatchScore, kParameterMismatchScore, kParameterMissingScore](const auto& fixedIter, auto& scanningIter, const auto& scannerEnd) {
                 auto scanner = scanningIter;
                 while (scanner != scannerEnd && scanner->key != fixedIter->key)
                     ++scanner;
index fe8e427..6e5cbc0 100644 (file)
@@ -147,7 +147,11 @@ static WebCore::NetworkLoadPriority toNetworkLoadPriority(float priority)
     if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier, storedCredentials)) {
         auto completionHandlerCopy = Block_copy(completionHandler);
         networkDataTask->willPerformHTTPRedirection(response, request, [completionHandlerCopy, taskIdentifier](auto& request) {
+#if !LOG_DISABLED
             LOG(NetworkSession, "%llu willPerformHTTPRedirection completionHandler (%s)", taskIdentifier, request.url().string().utf8().data());
+#else
+            UNUSED_PARAM(taskIdentifier);
+#endif
             completionHandlerCopy(request.nsURLRequest(WebCore::UpdateHTTPBody));
             Block_release(completionHandlerCopy);
         });
@@ -171,7 +175,11 @@ static WebCore::NetworkLoadPriority toNetworkLoadPriority(float priority)
     if (auto* networkDataTask = _session->dataTaskForIdentifier(taskIdentifier, storedCredentials)) {
         auto completionHandlerCopy = Block_copy(completionHandler);
         networkDataTask->willPerformHTTPRedirection(WebCore::synthesizeRedirectResponseIfNecessary([task currentRequest], request, nil), request, [completionHandlerCopy, taskIdentifier](auto& request) {
+#if !LOG_DISABLED
             LOG(NetworkSession, "%llu _schemeUpgraded completionHandler (%s)", taskIdentifier, request.url().string().utf8().data());
+#else
+            UNUSED_PARAM(taskIdentifier);
+#endif
             completionHandlerCopy(request.nsURLRequest(WebCore::UpdateHTTPBody));
             Block_release(completionHandlerCopy);
         });
@@ -213,7 +221,11 @@ static WebCore::NetworkLoadPriority toNetworkLoadPriority(float priority)
         auto sessionID = _session->sessionID();
         auto challengeCompletionHandler = [completionHandlerCopy, sessionID, authenticationChallenge, taskIdentifier, partition = networkDataTask->partition()](WebKit::AuthenticationChallengeDisposition disposition, const WebCore::Credential& credential)
         {
+#if !LOG_DISABLED
             LOG(NetworkSession, "%llu didReceiveChallenge completionHandler %d", taskIdentifier, disposition);
+#else
+            UNUSED_PARAM(taskIdentifier);
+#endif
 #if !USE(CREDENTIAL_STORAGE_WITH_NETWORK_SESSION)
             UNUSED_PARAM(sessionID);
             UNUSED_PARAM(authenticationChallenge);
@@ -369,7 +381,11 @@ static WebCore::NetworkLoadPriority toNetworkLoadPriority(float priority)
 
         auto completionHandlerCopy = Block_copy(completionHandler);
         networkDataTask->didReceiveResponse(WTFMove(resourceResponse), [completionHandlerCopy, taskIdentifier](WebCore::PolicyAction policyAction) {
+#if !LOG_DISABLED
             LOG(NetworkSession, "%llu didReceiveResponse completionHandler (%d)", taskIdentifier, policyAction);
+#else
+            UNUSED_PARAM(taskIdentifier);
+#endif
             completionHandlerCopy(toNSURLSessionResponseDisposition(policyAction));
             Block_release(completionHandlerCopy);
         });
index 12c6df3..7134cff 100644 (file)
@@ -186,7 +186,7 @@ void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver(std::fun
 #if PLATFORM(COCOA)
     WebResourceLoadStatisticsManager::registerUserDefaultsIfNeeded();
 #endif
-    m_resourceLoadStatisticsStore->setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler = WTFMove(shouldPartitionCookiesForDomainsHandler)] (const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst) {
+    m_resourceLoadStatisticsStore->setShouldPartitionCookiesCallback([shouldPartitionCookiesForDomainsHandler = WTFMove(shouldPartitionCookiesForDomainsHandler)] (const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst) {
         shouldPartitionCookiesForDomainsHandler(domainsToRemove, domainsToAdd, clearFirst);
     });
     m_resourceLoadStatisticsStore->setWritePersistentStoreCallback([this]() {
@@ -223,7 +223,7 @@ void WebResourceLoadStatisticsStore::processDidCloseConnection(WebProcessProxy&,
 void WebResourceLoadStatisticsStore::applicationWillTerminate()
 {
     BinarySemaphore semaphore;
-    m_statisticsQueue->dispatch([this, &semaphore] {
+    m_statisticsQueue->dispatch([&semaphore] {
         // Make sure any ongoing work in our queue is finished before we terminate.
         semaphore.signal();
     });
index ca14b22..b6eaeef 100644 (file)
@@ -285,7 +285,7 @@ void WebsiteDataStore::fetchData(OptionSet<WebsiteDataType> dataTypes, OptionSet
 #if ENABLE(VIDEO)
     if (dataTypes.contains(WebsiteDataType::DiskCache)) {
         callbackAggregator->addPendingCallback();
-        m_queue->dispatch([fetchOptions, mediaCacheDirectory = m_configuration.mediaCacheDirectory.isolatedCopy(), callbackAggregator] {
+        m_queue->dispatch([mediaCacheDirectory = m_configuration.mediaCacheDirectory.isolatedCopy(), callbackAggregator] {
             // FIXME: Make HTMLMediaElement::originsInMediaCache return a collection of SecurityOriginDatas.
             HashSet<RefPtr<WebCore::SecurityOrigin>> origins = WebCore::HTMLMediaElement::originsInMediaCache(mediaCacheDirectory);
             WebsiteData websiteData;
@@ -503,7 +503,7 @@ void WebsiteDataStore::fetchData(OptionSet<WebsiteDataType> dataTypes, OptionSet
 
 void WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, Vector<String>&& topPrivatelyControlledDomains, std::function<void(Vector<WebsiteDataRecord>&&, Vector<String>&&)> completionHandler)
 {
-    fetchData(dataTypes, fetchOptions, [topPrivatelyControlledDomains = WTFMove(topPrivatelyControlledDomains), completionHandler, this](auto&& existingDataRecords) {
+    fetchData(dataTypes, fetchOptions, [topPrivatelyControlledDomains = WTFMove(topPrivatelyControlledDomains), completionHandler](auto&& existingDataRecords) {
         Vector<WebsiteDataRecord> matchingDataRecords;
         Vector<String> domainsWithMatchingDataRecords;
         for (auto&& dataRecord : existingDataRecords) {
index e25211c..029900e 100644 (file)
@@ -767,7 +767,7 @@ void ViewGestureController::forceRepaintIfNeeded()
     m_hasOutstandingRepaintRequest = true;
 
     uint64_t pageID = m_webPageProxy.pageID();
-    m_webPageProxy.forceRepaint(VoidCallback::create([this, pageID] (CallbackBase::Error error) {
+    m_webPageProxy.forceRepaint(VoidCallback::create([pageID] (CallbackBase::Error error) {
         if (auto gestureController = gestureControllerForPage(pageID))
             gestureController->removeSwipeSnapshot();
     }));
index a6c3624..df61b07 100644 (file)
@@ -369,10 +369,10 @@ void WebVideoFullscreenManager::didExitFullscreen(uint64_t contextId)
     std::tie(model, interface) = ensureModelAndInterface(contextId);
     RefPtr<WebVideoFullscreenManager> strongThis(this);
     
-    model->waitForPreparedForInlineThen([strongThis, this, contextId, interface, model] {
-        dispatch_async(dispatch_get_main_queue(), [strongThis, this, contextId, interface, model] {
-            model->setVideoFullscreenLayer(nil, [strongThis, this, contextId, interface] {
-                dispatch_async(dispatch_get_main_queue(), [strongThis, this, contextId, interface] {
+    model->waitForPreparedForInlineThen([strongThis, contextId, interface, model] {
+        dispatch_async(dispatch_get_main_queue(), [strongThis, contextId, interface, model] {
+            model->setVideoFullscreenLayer(nil, [strongThis, contextId, interface] {
+                dispatch_async(dispatch_get_main_queue(), [strongThis, contextId, interface] {
                     if (interface->layerHostingContext()) {
                         interface->layerHostingContext()->setRootLayer(nullptr);
                         interface->setLayerHostingContext(nullptr);