Use auto for some of our lambda function parameters
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 May 2016 16:50:26 +0000 (16:50 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 May 2016 16:50:26 +0000 (16:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=158001

Reviewed by Darin Adler.

Use auto for some of our lambda function parameters now that we build with c++14.

Source/WebCore:

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::buffered):
(WebCore::MediaSource::monitorSourceBuffers):
(WebCore::MediaSource::endOfStream):
* Modules/mediasource/SampleMap.cpp:
(WebCore::PresentationOrderSampleMap::findSamplesWithinPresentationRangeFromEnd):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::ariaSelectedRows):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::writeBlobsToDiskForIndexedDB):
* css/CSSValueList.cpp:
(WebCore::CSSValueList::removeAll):
* css/MediaList.cpp:
(WebCore::MediaQuerySet::remove):
* css/MediaQuery.cpp:
(WebCore::MediaQuery::MediaQuery):
* css/MediaQueryMatcher.cpp:
(WebCore::MediaQueryMatcher::removeListener):
* dom/Document.cpp:
(WebCore::Document::validateAutoSizingNodes):
* dom/Element.cpp:
(WebCore::Element::detachAttrNodeFromElementWithValue):
* dom/MutationObserver.cpp:
(WebCore::MutationObserver::deliverAllMutations):
* dom/Node.cpp:
(WebCore::Node::unregisterMutationObserver):
* html/LinkIconCollector.cpp:
* inspector/InspectorIndexedDBAgent.cpp:
(WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::loadDataURL):
* page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::sortedTrackListForMenu):
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu):
* page/animation/AnimationController.cpp:
(WebCore::AnimationControllerPrivate::clear):
* platform/graphics/FontCascade.cpp:
(WebCore::pruneUnreferencedEntriesFromFontCascadeCache):
* platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::pruneSystemFallbacks):
* platform/graphics/PathUtilities.cpp:
(WebCore::addIntersectionPoints):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGLData::SharedGLData::~SharedGLData):
* platform/mac/HIDGamepad.cpp:
(WebCore::HIDGamepad::initElements):
* svg/SVGToOTFFontConversion.cpp:
(WebCore::SVGToOTFFontConverter::appendLigatureSubtable):
(WebCore::SVGToOTFFontConverter::finishAppendingKERNSubtable):

Source/WebKit2:

* DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
(WebKit::WebIDBConnectionToClient::didGetRecord):
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::fetchDiskCacheEntries):
(WebKit::NetworkProcess::fetchWebsiteData):
(WebKit::clearDiskCacheEntries):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::retrieveCacheEntry):
(WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
* NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
(WebKit::NetworkCache::SpeculativeLoad::didFinishLoading):
* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::SpeculativeLoadManager::registerLoad):
(WebKit::NetworkCache::SpeculativeLoadManager::retrieveEntryFromStorage):
(WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry):
(WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
(WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::removeFromPendingWriteOperations):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
(-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
* Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
(-[_WKRemoteObjectInterface debugDescription]):
* UIProcess/API/C/WKApplicationCacheManager.cpp:
(WKApplicationCacheManagerGetApplicationCacheOrigins):
* UIProcess/API/C/WKKeyValueStorageManager.cpp:
(WKKeyValueStorageManagerGetKeyValueStorageOrigins):
(WKKeyValueStorageManagerGetStorageDetailsByOrigin):
* UIProcess/API/C/WKResourceCacheManager.cpp:
(WKResourceCacheManagerGetCacheOrigins):
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _fetchDataRecordsOfTypes:withOptions:completionHandler:]):
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::removeAllUserScripts):
(WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
(WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::removeAnimationForKey):

Source/WTF:

* wtf/BubbleSort.h:
(WTF::bubbleSort):

Tools:

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::willDestroyPage):

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

47 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/BubbleSort.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediasource/MediaSource.cpp
Source/WebCore/Modules/mediasource/SampleMap.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/bindings/js/SerializedScriptValue.cpp
Source/WebCore/css/CSSValueList.cpp
Source/WebCore/css/MediaList.cpp
Source/WebCore/css/MediaQuery.cpp
Source/WebCore/css/MediaQueryMatcher.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/MutationObserver.cpp
Source/WebCore/dom/Node.cpp
Source/WebCore/html/LinkIconCollector.cpp
Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/page/CaptionUserPreferences.cpp
Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
Source/WebCore/page/animation/AnimationController.cpp
Source/WebCore/platform/graphics/FontCascade.cpp
Source/WebCore/platform/graphics/FontCascadeFonts.cpp
Source/WebCore/platform/graphics/PathUtilities.cpp
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm
Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
Source/WebCore/platform/mac/HIDGamepad.cpp
Source/WebCore/svg/SVGToOTFFontConversion.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit2/NetworkProcess/NetworkProcess.cpp
Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp
Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm
Source/WebKit2/Shared/API/Cocoa/_WKRemoteObjectInterface.mm
Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp
Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp
Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp
Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp
Tools/ChangeLog
Tools/Scripts/webkitpy/style/checkers/cpp.py
Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp

index 2d21bd5..cf84282 100644 (file)
@@ -1,3 +1,15 @@
+2016-05-24  Chris Dumez  <cdumez@apple.com>
+
+        Use auto for some of our lambda function parameters
+        https://bugs.webkit.org/show_bug.cgi?id=158001
+
+        Reviewed by Darin Adler.
+
+        Use auto for some of our lambda function parameters now that we build with c++14.
+
+        * wtf/BubbleSort.h:
+        (WTF::bubbleSort):
+
 2016-05-23  Chris Dumez  <cdumez@apple.com>
 
         Speed up move of vectors of POD types that have an inline buffer
index 86bbca2..4d52286 100644 (file)
@@ -89,8 +89,7 @@ void bubbleSort(IteratorType begin, IteratorType end)
 {
     bubbleSort(
         begin, end,
-        [] (const typename std::iterator_traits<IteratorType>::value_type& left,
-            const typename std::iterator_traits<IteratorType>::value_type& right) -> bool {
+        [](auto& left, auto& right) {
             return left < right;
         });
 }
index bd012d7..5d50f5f 100644 (file)
@@ -1,3 +1,65 @@
+2016-05-24  Chris Dumez  <cdumez@apple.com>
+
+        Use auto for some of our lambda function parameters
+        https://bugs.webkit.org/show_bug.cgi?id=158001
+
+        Reviewed by Darin Adler.
+
+        Use auto for some of our lambda function parameters now that we build with c++14.
+
+        * Modules/mediasource/MediaSource.cpp:
+        (WebCore::MediaSource::buffered):
+        (WebCore::MediaSource::monitorSourceBuffers):
+        (WebCore::MediaSource::endOfStream):
+        * Modules/mediasource/SampleMap.cpp:
+        (WebCore::PresentationOrderSampleMap::findSamplesWithinPresentationRangeFromEnd):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::ariaSelectedRows):
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::SerializedScriptValue::writeBlobsToDiskForIndexedDB):
+        * css/CSSValueList.cpp:
+        (WebCore::CSSValueList::removeAll):
+        * css/MediaList.cpp:
+        (WebCore::MediaQuerySet::remove):
+        * css/MediaQuery.cpp:
+        (WebCore::MediaQuery::MediaQuery):
+        * css/MediaQueryMatcher.cpp:
+        (WebCore::MediaQueryMatcher::removeListener):
+        * dom/Document.cpp:
+        (WebCore::Document::validateAutoSizingNodes):
+        * dom/Element.cpp:
+        (WebCore::Element::detachAttrNodeFromElementWithValue):
+        * dom/MutationObserver.cpp:
+        (WebCore::MutationObserver::deliverAllMutations):
+        * dom/Node.cpp:
+        (WebCore::Node::unregisterMutationObserver):
+        * html/LinkIconCollector.cpp:
+        * inspector/InspectorIndexedDBAgent.cpp:
+        (WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::loadDataURL):
+        * page/CaptionUserPreferences.cpp:
+        (WebCore::CaptionUserPreferences::sortedTrackListForMenu):
+        * page/CaptionUserPreferencesMediaAF.cpp:
+        (WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu):
+        * page/animation/AnimationController.cpp:
+        (WebCore::AnimationControllerPrivate::clear):
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::pruneUnreferencedEntriesFromFontCascadeCache):
+        * platform/graphics/FontCascadeFonts.cpp:
+        (WebCore::FontCascadeFonts::pruneSystemFallbacks):
+        * platform/graphics/PathUtilities.cpp:
+        (WebCore::addIntersectionPoints):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore::TextureMapperGLData::SharedGLData::~SharedGLData):
+        * platform/mac/HIDGamepad.cpp:
+        (WebCore::HIDGamepad::initElements):
+        * svg/SVGToOTFFontConversion.cpp:
+        (WebCore::SVGToOTFFontConverter::appendLigatureSubtable):
+        (WebCore::SVGToOTFFontConverter::finishAppendingKERNSubtable):
+
 2016-05-24  Antti Koivisto  <antti@apple.com>
 
         REGRESSION (r196629): Safari can get into a state where switching Reader theme doesn't apply to the webpage
index 9a54b61..57d503d 100644 (file)
@@ -141,7 +141,7 @@ MediaTime MediaSource::currentTime() const
 
 std::unique_ptr<PlatformTimeRanges> MediaSource::buffered() const
 {
-    if (m_buffered && m_activeSourceBuffers->length() && std::all_of(m_activeSourceBuffers->begin(), m_activeSourceBuffers->end(), [] (RefPtr<SourceBuffer>& buffer) { return !buffer->isBufferedDirty(); }))
+    if (m_buffered && m_activeSourceBuffers->length() && std::all_of(m_activeSourceBuffers->begin(), m_activeSourceBuffers->end(), [](auto& buffer) { return !buffer->isBufferedDirty(); }))
         return std::make_unique<PlatformTimeRanges>(*m_buffered);
 
     m_buffered = std::make_unique<PlatformTimeRanges>();
@@ -264,7 +264,7 @@ void MediaSource::monitorSourceBuffers()
     // playback position:
     auto begin = m_activeSourceBuffers->begin();
     auto end = m_activeSourceBuffers->end();
-    if (std::all_of(begin, end, [](RefPtr<SourceBuffer>& sourceBuffer) {
+    if (std::all_of(begin, end, [](auto& sourceBuffer) {
         return !sourceBuffer->hasCurrentTime();
     })) {
         // 1. Set the HTMLMediaElement.readyState attribute to HAVE_METADATA.
@@ -278,7 +278,7 @@ void MediaSource::monitorSourceBuffers()
 
     // ↳ If buffered for all objects in activeSourceBuffers contain TimeRanges that include the current
     // playback position and enough data to ensure uninterrupted playback:
-    if (std::all_of(begin, end, [](RefPtr<SourceBuffer>& sourceBuffer) {
+    if (std::all_of(begin, end, [](auto& sourceBuffer) {
         return sourceBuffer->hasFutureTime() && sourceBuffer->canPlayThrough();
     })) {
         // 1. Set the HTMLMediaElement.readyState attribute to HAVE_ENOUGH_DATA.
@@ -295,7 +295,7 @@ void MediaSource::monitorSourceBuffers()
 
     // ↳ If buffered for all objects in activeSourceBuffers contain a TimeRange that includes
     // the current playback position and some time beyond the current playback position, then run the following steps:
-    if (std::all_of(begin, end, [](RefPtr<SourceBuffer>& sourceBuffer) {
+    if (std::all_of(begin, end, [](auto& sourceBuffer) {
         return sourceBuffer->hasFutureTime();
     })) {
         // 1. Set the HTMLMediaElement.readyState attribute to HAVE_FUTURE_DATA.
@@ -426,7 +426,7 @@ void MediaSource::endOfStream(Optional<EndOfStreamError> error, ExceptionCode& e
 
     // 2. If the updating attribute equals true on any SourceBuffer in sourceBuffers, then throw an
     // INVALID_STATE_ERR exception and abort these steps.
-    if (std::any_of(m_sourceBuffers->begin(), m_sourceBuffers->end(), [](RefPtr<SourceBuffer>& sourceBuffer) { return sourceBuffer->updating(); })) {
+    if (std::any_of(m_sourceBuffers->begin(), m_sourceBuffers->end(), [](auto& sourceBuffer) { return sourceBuffer->updating(); })) {
         ec = INVALID_STATE_ERR;
         return;
     }
index 95dacc0..86d5533 100644 (file)
@@ -244,11 +244,11 @@ PresentationOrderSampleMap::iterator_range PresentationOrderSampleMap::findSampl
 
 PresentationOrderSampleMap::iterator_range PresentationOrderSampleMap::findSamplesWithinPresentationRangeFromEnd(const MediaTime& beginTime, const MediaTime& endTime)
 {
-    reverse_iterator rangeEnd = std::find_if(rbegin(), rend(), [&beginTime] (PresentationOrderSampleMap::MapType::value_type value) {
+    reverse_iterator rangeEnd = std::find_if(rbegin(), rend(), [&beginTime](auto& value) {
         return value.second->presentationTime() <= beginTime;
     });
 
-    reverse_iterator rangeStart = std::find_if(rbegin(), rangeEnd, [&endTime] (PresentationOrderSampleMap::MapType::value_type value) {
+    reverse_iterator rangeStart = std::find_if(rbegin(), rangeEnd, [&endTime](auto& value) {
         return value.second->presentationTime() <= endTime;
     });
 
index 482e1bd..e9190dd 100644 (file)
@@ -3245,7 +3245,7 @@ void AccessibilityRenderObject::ariaSelectedRows(AccessibilityChildrenVector& re
     }
 
     // Get all the rows.
-    auto rowsIteration = [&](const AccessibilityChildrenVector& rows) {
+    auto rowsIteration = [&](auto& rows) {
         for (auto& row : rows) {
             if (row->isSelected()) {
                 result.append(row);
index adc0ed3..7e8481a 100644 (file)
@@ -2802,7 +2802,7 @@ void SerializedScriptValue::writeBlobsToDiskForIndexedDB(std::function<void (con
     ASSERT(hasBlobURLs());
 
     RefPtr<SerializedScriptValue> protectedThis(this);
-    blobRegistry().writeBlobsToTemporaryFiles(m_blobURLs, [completionHandler = WTFMove(completionHandler), this, protectedThis = WTFMove(protectedThis)](const Vector<String>& blobFilePaths) {
+    blobRegistry().writeBlobsToTemporaryFiles(m_blobURLs, [completionHandler = WTFMove(completionHandler), this, protectedThis = WTFMove(protectedThis)](auto& blobFilePaths) {
         ASSERT(isMainThread());
 
         if (blobFilePaths.isEmpty()) {
index 3dd0432..fec2152 100644 (file)
@@ -60,7 +60,7 @@ bool CSSValueList::removeAll(CSSValue* value)
     if (!value)
         return false;
 
-    return m_values.removeAllMatching([value] (const Ref<CSSValue>& current) {
+    return m_values.removeAllMatching([value](auto& current) {
         return current->equals(*value);
     }) > 0;
 }
index b7bdb10..01f8862 100644 (file)
@@ -186,7 +186,7 @@ bool MediaQuerySet::remove(const String& queryStringToRemove)
     if (!parsedQuery)
         return false;
     
-    return m_queries.removeFirstMatching([&parsedQuery] (const std::unique_ptr<MediaQuery>& query) {
+    return m_queries.removeFirstMatching([&parsedQuery](auto& query) {
         return *query == *parsedQuery;
     });
 }
index fc24bad..4a25a11 100644 (file)
@@ -83,7 +83,7 @@ MediaQuery::MediaQuery(Restrictor r, const String& mediaType, std::unique_ptr<Ex
         return;
     }
 
-    std::sort(m_expressions->begin(), m_expressions->end(), [](const std::unique_ptr<MediaQueryExp>& a, const std::unique_ptr<MediaQueryExp>& b) {
+    std::sort(m_expressions->begin(), m_expressions->end(), [](auto& a, auto& b) {
         return codePointCompare(a->serialize(), b->serialize()) < 0;
     });
 
index 9ab688a..160c7d3 100644 (file)
@@ -131,7 +131,7 @@ void MediaQueryMatcher::removeListener(MediaQueryListListener* listener, MediaQu
     if (!m_document)
         return;
 
-    m_listeners.removeFirstMatching([listener, query] (const std::unique_ptr<Listener>& current) {
+    m_listeners.removeFirstMatching([listener, query](auto& current) {
         return *current->listener() == *listener && current->query() == query;
     });
 }
index 134554a..6f33f23 100644 (file)
@@ -5299,7 +5299,7 @@ void Document::validateAutoSizingNodes()
         // candidate size.
         value->adjustNodeSizes();
     }
-    m_textAutoSizedNodes.removeIf([] (TextAutoSizingMap::KeyValuePairType& keyAndValue) {
+    m_textAutoSizedNodes.removeIf([](auto& keyAndValue) {
         return !keyAndValue.value->numNodes();
     });
 }
index b9729f1..ff3c656 100644 (file)
@@ -3194,7 +3194,7 @@ void Element::detachAttrNodeFromElementWithValue(Attr* attrNode, const AtomicStr
     attrNode->detachFromElementWithValue(value);
 
     auto& attrNodeList = *attrNodeListForElement(*this);
-    bool found = attrNodeList.removeFirstMatching([attrNode] (const RefPtr<Attr>& attribute) {
+    bool found = attrNodeList.removeFirstMatching([attrNode](auto& attribute) {
         return attribute->qualifiedName() == attrNode->qualifiedName();
     });
     ASSERT_UNUSED(found, found);
index 567207a..42d798c 100644 (file)
@@ -244,7 +244,7 @@ void MutationObserver::deliverAllMutations()
         Vector<RefPtr<MutationObserver>> observers;
         copyToVector(activeMutationObservers(), observers);
         activeMutationObservers().clear();
-        std::sort(observers.begin(), observers.end(), [](const RefPtr<MutationObserver>& lhs, const RefPtr<MutationObserver>& rhs) {
+        std::sort(observers.begin(), observers.end(), [](auto& lhs, auto& rhs) {
             return lhs->m_priority < rhs->m_priority;
         });
 
index 04b9218..4f39b63 100644 (file)
@@ -2086,7 +2086,7 @@ void Node::unregisterMutationObserver(MutationObserverRegistration* registration
     if (!registry)
         return;
 
-    registry->removeFirstMatching([registration] (const std::unique_ptr<MutationObserverRegistration>& current) {
+    registry->removeFirstMatching([registration](auto& current) {
         return current.get() == registration;
     });
 }
index 9d2c02e..13e760a 100644 (file)
@@ -107,7 +107,7 @@ auto LinkIconCollector::iconsOfTypes(OptionSet<LinkIconType> iconTypes) -> Vecto
         icons.append({ url, iconType, iconSize });
     }
 
-    std::sort(icons.begin(), icons.end(), [](const LinkIconCollector::Icon& a, const LinkIconCollector::Icon& b) {
+    std::sort(icons.begin(), icons.end(), [](auto& a, auto& b) {
         return compareIcons(a, b) < 0;
     });
 
index ac0edd4..33030b2 100644 (file)
@@ -600,7 +600,7 @@ void InspectorIndexedDBAgent::requestDatabaseNames(ErrorString& errorString, con
         return;
 
     RefPtr<RequestDatabaseNamesCallback> callback = WTFMove(requestCallback);
-    idbFactory->getAllDatabaseNames(*topOrigin, *openingOrigin, [callback](const Vector<String>& databaseNames) {
+    idbFactory->getAllDatabaseNames(*topOrigin, *openingOrigin, [callback](auto& databaseNames) {
         if (!callback->isActive())
             return;
 
index b78f409..b8f2ce8 100644 (file)
@@ -253,7 +253,7 @@ void ResourceLoader::loadDataURL()
     if (auto* scheduledPairs = m_frame->page()->scheduledRunLoopPairs())
         scheduleContext.scheduledPairs = *scheduledPairs;
 #endif
-    DataURLDecoder::decode(url, scheduleContext, [protectedThis, url] (Optional<DataURLDecoder::Result> decodeResult) {
+    DataURLDecoder::decode(url, scheduleContext, [protectedThis, url](auto decodeResult) {
         if (protectedThis->reachedTerminalState())
             return;
         if (!decodeResult) {
index 1e96a12..b273417 100644 (file)
@@ -221,7 +221,7 @@ Vector<RefPtr<TextTrack>> CaptionUserPreferences::sortedTrackListForMenu(TextTra
             tracksForMenu.append(track);
     }
 
-    std::sort(tracksForMenu.begin(), tracksForMenu.end(), [](const RefPtr<TextTrack>& a, const RefPtr<TextTrack>& b) {
+    std::sort(tracksForMenu.begin(), tracksForMenu.end(), [](auto& a, auto& b) {
         return codePointCompare(trackDisplayName(a.get()), trackDisplayName(b.get())) < 0;
     });
 
@@ -256,7 +256,7 @@ Vector<RefPtr<AudioTrack>> CaptionUserPreferences::sortedTrackListForMenu(AudioT
         tracksForMenu.append(track);
     }
 
-    std::sort(tracksForMenu.begin(), tracksForMenu.end(), [](const RefPtr<AudioTrack>& a, const RefPtr<AudioTrack>& b) {
+    std::sort(tracksForMenu.begin(), tracksForMenu.end(), [](auto& a, auto& b) {
         return codePointCompare(trackDisplayName(a.get()), trackDisplayName(b.get())) < 0;
     });
 
index 65d2445..d239cb3 100644 (file)
@@ -838,7 +838,7 @@ Vector<RefPtr<AudioTrack>> CaptionUserPreferencesMediaAF::sortedTrackListForMenu
         tracksForMenu.append(track);
     }
     
-    std::sort(tracksForMenu.begin(), tracksForMenu.end(), [](const RefPtr<AudioTrack>& a, const RefPtr<AudioTrack>& b) {
+    std::sort(tracksForMenu.begin(), tracksForMenu.end(), [](auto& a, auto& b) {
         return codePointCompare(trackDisplayName(a.get()), trackDisplayName(b.get())) < 0;
     });
     
index 3a9ea56..c3efb5d 100644 (file)
@@ -107,8 +107,8 @@ bool AnimationControllerPrivate::clear(RenderElement& renderer)
         return info.element == element;
     });
 
-    m_elementChangesToDispatch.removeAllMatching([element] (const Ref<Element>& currElement) {
-        return &currElement.get() == element;
+    m_elementChangesToDispatch.removeAllMatching([element](auto& currentElement) {
+        return currentElement.ptr() == element;
     });
     
     // Return false if we didn't do anything OR we are suspended (so we don't try to
index 1f690be..e74a8c8 100644 (file)
@@ -250,7 +250,7 @@ static unsigned computeFontCascadeCacheHash(const FontCascadeCacheKey& key)
 
 void pruneUnreferencedEntriesFromFontCascadeCache()
 {
-    fontCascadeCache().removeIf([](FontCascadeCache::KeyValuePairType& entry) {
+    fontCascadeCache().removeIf([](auto& entry) {
         return entry.value->fonts.get().hasOneRef();
     });
 }
index efaa2c2..c3f2326 100644 (file)
@@ -454,7 +454,7 @@ void FontCascadeFonts::pruneSystemFallbacks()
     // Mutable glyph pages may reference fallback fonts.
     if (m_cachedPageZero.isMixedFont())
         m_cachedPageZero = { };
-    m_cachedPages.removeIf([](decltype(m_cachedPages)::KeyValuePairType& keyAndValue) {
+    m_cachedPages.removeIf([](auto& keyAndValue) {
         return keyAndValue.value.isMixedFont();
     });
     m_systemFallbackFontSet.clear();
index dfd0918..25fe433 100644 (file)
@@ -134,7 +134,7 @@ static bool addIntersectionPoints(Vector<FloatPointGraph::Polygon>& polys, Float
             intersectionPoints.append(graph.findOrCreateNode(intersectionPoint));
         }
 
-        std::sort(intersectionPoints.begin(), intersectionPoints.end(), [edgeA] (FloatPointGraph::Node* a, FloatPointGraph::Node* b) {
+        std::sort(intersectionPoints.begin(), intersectionPoints.end(), [edgeA](auto* a, auto* b) {
             return FloatPoint(*edgeA.first - *b).lengthSquared() > FloatPoint(*edgeA.first - *a).lengthSquared();
         });
 
index d92a6c8..e8cabed 100644 (file)
@@ -531,14 +531,14 @@ void MediaPlayerPrivateMediaStreamAVFObjC::updateTracks()
     MediaStreamTrackPrivateVector currentTracks = m_mediaStreamPrivate->tracks();
     bool selectedVideoTrackChanged = false;
 
-    std::function<void(RefPtr<AudioTrackPrivateMediaStream>, int)> enableAudioTrack = [this](RefPtr<AudioTrackPrivateMediaStream> track, int index)
+    std::function<void(RefPtr<AudioTrackPrivateMediaStream>, int)> enableAudioTrack = [this](auto track, int index)
     {
         track->setTrackIndex(index);
         track->setEnabled(track->streamTrack()->enabled() && !track->streamTrack()->muted());
     };
     updateTracksOfType(m_audioTrackMap, RealtimeMediaSource::Audio, currentTracks, &AudioTrackPrivateMediaStream::create, m_player, &MediaPlayer::removeAudioTrack, &MediaPlayer::addAudioTrack, enableAudioTrack);
 
-    std::function<void(RefPtr<VideoTrackPrivateMediaStream>, int)> enableVideoTrack = [this, &selectedVideoTrackChanged](RefPtr<VideoTrackPrivateMediaStream> track, int index)
+    std::function<void(RefPtr<VideoTrackPrivateMediaStream>, int)> enableVideoTrack = [this, &selectedVideoTrackChanged](auto track, int index)
     {
         bool wasSelected = track->selected();
         track->setTrackIndex(index);
index 50b7bfa..868f877 100644 (file)
@@ -88,8 +88,8 @@ private:
         ~SharedGLData()
         {
             ASSERT(std::any_of(contextDataMap().begin(), contextDataMap().end(),
-                [this](GLContextDataMap::KeyValuePairType& entry) { return entry.value == this; }));
-            contextDataMap().removeIf([this] (GLContextDataMap::KeyValuePairType& entry) { return entry.value == this; });
+                [this](auto& entry) { return entry.value == this; }));
+            contextDataMap().removeIf([this](auto& entry) { return entry.value == this; });
         }
 
     private:
index 3700975..77c18e3 100644 (file)
@@ -74,7 +74,7 @@ void HIDGamepad::initElements()
     initElementsFromArray(elements.get());
 
     // Buttons are specified to appear highest priority first in the array.
-    std::sort(m_buttons.begin(), m_buttons.end(), [](const std::unique_ptr<HIDGamepadButton>& a, const std::unique_ptr<HIDGamepadButton>& b) {
+    std::sort(m_buttons.begin(), m_buttons.end(), [](auto& a, auto& b) {
         return a->priority < b->priority;
     });
 
index f04a3d0..9dcc18e 100644 (file)
@@ -754,7 +754,7 @@ void SVGToOTFFontConverter::appendLigatureSubtable(size_t subtableRecordLocation
     }
     if (ligaturePairs.size() > std::numeric_limits<uint16_t>::max())
         ligaturePairs.clear();
-    std::sort(ligaturePairs.begin(), ligaturePairs.end(), [](const LigaturePair& lhs, const LigaturePair& rhs) {
+    std::sort(ligaturePairs.begin(), ligaturePairs.end(), [](auto& lhs, auto& rhs) {
         return lhs.first[0] < rhs.first[0];
     });
     Vector<size_t> overlappingFirstGlyphSegmentLengths;
@@ -1078,7 +1078,7 @@ template<typename T> inline size_t SVGToOTFFontConverter::appendKERNSubtable(boo
 
 size_t SVGToOTFFontConverter::finishAppendingKERNSubtable(Vector<KerningData> kerningData, uint16_t coverage)
 {
-    std::sort(kerningData.begin(), kerningData.end(), [](const KerningData& a, const KerningData& b) {
+    std::sort(kerningData.begin(), kerningData.end(), [](auto& a, auto& b) {
         return a.glyph1 < b.glyph1 || (a.glyph1 == b.glyph1 && a.glyph2 < b.glyph2);
     });
 
index 118288b..7b39c17 100644 (file)
@@ -1,3 +1,54 @@
+2016-05-24  Chris Dumez  <cdumez@apple.com>
+
+        Use auto for some of our lambda function parameters
+        https://bugs.webkit.org/show_bug.cgi?id=158001
+
+        Reviewed by Darin Adler.
+
+        Use auto for some of our lambda function parameters now that we build with c++14.
+
+        * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
+        (WebKit::WebIDBConnectionToClient::didGetRecord):
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::fetchDiskCacheEntries):
+        (WebKit::NetworkProcess::fetchWebsiteData):
+        (WebKit::clearDiskCacheEntries):
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::retrieveCacheEntry):
+        (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
+        (WebKit::NetworkCache::SpeculativeLoad::didFinishLoading):
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
+        (WebKit::NetworkCache::SpeculativeLoadManager::registerLoad):
+        (WebKit::NetworkCache::SpeculativeLoadManager::retrieveEntryFromStorage):
+        (WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry):
+        (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
+        (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
+        * NetworkProcess/cache/NetworkCacheStorage.cpp:
+        (WebKit::NetworkCache::Storage::removeFromPendingWriteOperations):
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
+        (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
+        * Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
+        (-[_WKRemoteObjectInterface debugDescription]):
+        * UIProcess/API/C/WKApplicationCacheManager.cpp:
+        (WKApplicationCacheManagerGetApplicationCacheOrigins):
+        * UIProcess/API/C/WKKeyValueStorageManager.cpp:
+        (WKKeyValueStorageManagerGetKeyValueStorageOrigins):
+        (WKKeyValueStorageManagerGetStorageDetailsByOrigin):
+        * UIProcess/API/C/WKResourceCacheManager.cpp:
+        (WKResourceCacheManagerGetCacheOrigins):
+        * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+        (-[WKWebsiteDataStore _fetchDataRecordsOfTypes:withOptions:completionHandler:]):
+        * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
+        (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
+        (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
+        (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::removeAnimationForKey):
+
 2016-05-23  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         Assertion failure for Reflect.get with Proxy and primitive value as explicit receiver
index 93dedd2..e0d19ad 100644 (file)
@@ -317,7 +317,7 @@ void NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles(const Vector<Stri
     for (auto& file : fileReferences)
         file->prepareForFileAccess();
 
-    NetworkBlobRegistry::singleton().writeBlobsToTemporaryFiles(blobURLs, [this, protector, requestIdentifier, fileReferences](const Vector<String>& fileNames) {
+    NetworkBlobRegistry::singleton().writeBlobsToTemporaryFiles(blobURLs, [this, protector, requestIdentifier, fileReferences](auto& fileNames) {
         for (auto& file : fileReferences)
             file->revokeFileAccess();
 
index 6b61663..5b7da77 100644 (file)
@@ -314,7 +314,7 @@ static void fetchDiskCacheEntries(SessionID sessionID, OptionSet<WebsiteDataFetc
     if (NetworkCache::singleton().isEnabled()) {
         auto* originsAndSizes = new HashMap<RefPtr<SecurityOrigin>, uint64_t>();
 
-        NetworkCache::singleton().traverse([fetchOptions, completionHandler, originsAndSizes](const NetworkCache::Cache::TraversalEntry *traversalEntry) {
+        NetworkCache::singleton().traverse([fetchOptions, completionHandler, originsAndSizes](auto* traversalEntry) {
             if (!traversalEntry) {
                 Vector<WebsiteData::Entry> entries;
 
@@ -379,7 +379,7 @@ void NetworkProcess::fetchWebsiteData(SessionID sessionID, OptionSet<WebsiteData
         WebsiteData m_websiteData;
     };
 
-    RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator([this, callbackID](WebsiteData websiteData) {
+    RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator([this, callbackID] (WebsiteData websiteData) {
         parentProcessConnection()->send(Messages::NetworkProcessProxy::DidFetchWebsiteData(callbackID, websiteData), 0);
     }));
 
@@ -389,7 +389,7 @@ void NetworkProcess::fetchWebsiteData(SessionID sessionID, OptionSet<WebsiteData
     }
 
     if (websiteDataTypes.contains(WebsiteDataType::DiskCache)) {
-        fetchDiskCacheEntries(sessionID, fetchOptions, [callbackAggregator](Vector<WebsiteData::Entry> entries) {
+        fetchDiskCacheEntries(sessionID, fetchOptions, [callbackAggregator](auto entries) {
             callbackAggregator->m_websiteData.entries.appendVector(entries);
         });
     }
@@ -432,8 +432,7 @@ static void clearDiskCacheEntries(const Vector<SecurityOriginData>& origins, std
 
         auto* cacheKeysToDelete = new Vector<NetworkCache::Key>;
 
-        NetworkCache::singleton().traverse([completionHandler, originsToDelete, cacheKeysToDelete](const NetworkCache::Cache::TraversalEntry *traversalEntry) {
-
+        NetworkCache::singleton().traverse([completionHandler, originsToDelete, cacheKeysToDelete](auto* traversalEntry) {
             if (traversalEntry) {
                 if (originsToDelete->contains(SecurityOrigin::create(traversalEntry->entry.response().url())))
                     cacheKeysToDelete->append(traversalEntry->entry.key());
index 4367a4e..d268597 100644 (file)
@@ -165,7 +165,7 @@ void NetworkResourceLoader::retrieveCacheEntry(const ResourceRequest& request)
     ASSERT(canUseCache(request));
 
     RefPtr<NetworkResourceLoader> loader(this);
-    NetworkCache::singleton().retrieve(request, { m_parameters.webPageID, m_parameters.webFrameID }, [loader, request](std::unique_ptr<NetworkCache::Entry> entry) {
+    NetworkCache::singleton().retrieve(request, { m_parameters.webPageID, m_parameters.webFrameID }, [loader, request](auto entry) {
         if (loader->hasOneRef()) {
             // The loader has been aborted and is only held alive by this lambda.
             return;
@@ -516,7 +516,7 @@ void NetworkResourceLoader::tryStoreAsCacheEntry()
     // Keep the connection alive.
     RefPtr<NetworkConnectionToWebProcess> connection(&connectionToWebProcess());
     RefPtr<NetworkResourceLoader> loader(this);
-    NetworkCache::singleton().store(m_networkLoad->currentRequest(), m_response, WTFMove(m_bufferedDataForCache), [loader, connection](NetworkCache::MappedBody& mappedBody) {
+    NetworkCache::singleton().store(m_networkLoad->currentRequest(), m_response, WTFMove(m_bufferedDataForCache), [loader, connection](auto& mappedBody) {
 #if ENABLE(SHAREABLE_RESOURCE)
         if (mappedBody.shareableResourceHandle.isNull())
             return;
index e4a561a..a113228 100644 (file)
@@ -105,7 +105,7 @@ void SpeculativeLoad::didReceiveBuffer(RefPtr<SharedBuffer>&& buffer, int report
 void SpeculativeLoad::didFinishLoading(double finishTime)
 {
     if (!m_cacheEntryForValidation && m_bufferedDataForCache)
-        m_cacheEntryForValidation = NetworkCache::singleton().store(m_originalRequest, m_response, WTFMove(m_bufferedDataForCache), [](NetworkCache::MappedBody& mappedBody) { });
+        m_cacheEntryForValidation = NetworkCache::singleton().store(m_originalRequest, m_response, WTFMove(m_bufferedDataForCache), [](auto& mappedBody) { });
 
     didComplete();
 }
index de15b55..bd9e516 100644 (file)
@@ -409,7 +409,7 @@ void SpeculativeLoadManager::addPreloadedEntry(std::unique_ptr<Entry> entry, con
 
 void SpeculativeLoadManager::retrieveEntryFromStorage(const Key& key, const RetrieveCompletionHandler& completionHandler)
 {
-    m_storage.retrieve(key, static_cast<unsigned>(ResourceLoadPriority::Medium), [completionHandler](std::unique_ptr<Storage::Record> record) {
+    m_storage.retrieve(key, static_cast<unsigned>(ResourceLoadPriority::Medium), [completionHandler](auto record) {
         if (!record) {
             completionHandler(nullptr);
             return false;
@@ -537,7 +537,7 @@ void SpeculativeLoadManager::retrieveSubresourcesEntry(const Key& storageKey, st
 {
     ASSERT(storageKey.type() == "resource");
     auto subresourcesStorageKey = makeSubresourcesKey(storageKey);
-    m_storage.retrieve(subresourcesStorageKey, static_cast<unsigned>(ResourceLoadPriority::Medium), [completionHandler](std::unique_ptr<Storage::Record> record) {
+    m_storage.retrieve(subresourcesStorageKey, static_cast<unsigned>(ResourceLoadPriority::Medium), [completionHandler](auto record) {
         if (!record) {
             completionHandler(nullptr);
             return false;
index de76a13..ea6e094 100644 (file)
@@ -526,7 +526,7 @@ Data Storage::encodeRecord(const Record& record, Optional<BlobStorage::Blob> blo
 void Storage::removeFromPendingWriteOperations(const Key& key)
 {
     while (true) {
-        auto found = m_pendingWriteOperations.findIf([&key](const std::unique_ptr<WriteOperation>& operation) {
+        auto found = m_pendingWriteOperations.findIf([&key](auto& operation) {
             return operation->record.key == key;
         });
 
index a640f44..f0810b5 100644 (file)
@@ -123,7 +123,7 @@ static NSURLSessionAuthChallengeDisposition toNSURLSessionAuthChallengeDispositi
     auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
     if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier, storedCredentials)) {
         auto completionHandlerCopy = Block_copy(completionHandler);
-        networkDataTask->willPerformHTTPRedirection(response, request, [completionHandlerCopy, taskIdentifier](const WebCore::ResourceRequest& request) {
+        networkDataTask->willPerformHTTPRedirection(response, request, [completionHandlerCopy, taskIdentifier](auto& request) {
             LOG(NetworkSession, "%llu willPerformHTTPRedirection completionHandler (%s)", taskIdentifier, request.url().string().utf8().data());
             completionHandlerCopy(request.nsURLRequest(WebCore::UpdateHTTPBody));
             Block_release(completionHandlerCopy);
@@ -142,7 +142,7 @@ static NSURLSessionAuthChallengeDisposition toNSURLSessionAuthChallengeDispositi
     auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
     if (auto* networkDataTask = _session->dataTaskForIdentifier(taskIdentifier, storedCredentials)) {
         auto completionHandlerCopy = Block_copy(completionHandler);
-        networkDataTask->willPerformHTTPRedirection(WebCore::synthesizeRedirectResponseIfNecessary([task currentRequest], request, nil), request, [completionHandlerCopy, taskIdentifier](const WebCore::ResourceRequest& request) {
+        networkDataTask->willPerformHTTPRedirection(WebCore::synthesizeRedirectResponseIfNecessary([task currentRequest], request, nil), request, [completionHandlerCopy, taskIdentifier](auto& request) {
             LOG(NetworkSession, "%llu _schemeUpgraded completionHandler (%s)", taskIdentifier, request.url().string().utf8().data());
             completionHandlerCopy(request.nsURLRequest(WebCore::UpdateHTTPBody));
             Block_release(completionHandlerCopy);
index d8f0f1c..b0da4b6 100644 (file)
@@ -210,11 +210,11 @@ static void initializeMethods(_WKRemoteObjectInterface *interface, Protocol *pro
 {
     auto result = adoptNS([[NSMutableString alloc] initWithFormat:@"<%@: %p; protocol = \"%@\"; identifier = \"%@\"\n", NSStringFromClass(self.class), self, _identifier.get(), NSStringFromProtocol(_protocol)]);
 
-    auto descriptionForClasses = [](const Vector<HashSet<Class>>& allowedClasses) {
+    auto descriptionForClasses = [](auto& allowedClasses) {
         auto result = adoptNS([[NSMutableString alloc] initWithString:@"["]);
         bool needsComma = false;
 
-        auto descriptionForArgument = [](const HashSet<Class>& allowedArgumentClasses) {
+        auto descriptionForArgument = [](auto& allowedArgumentClasses) {
             auto result = adoptNS([[NSMutableString alloc] initWithString:@"{"]);
 
             Vector<Class> orderedArgumentClasses;
index afab70d..285914c 100644 (file)
@@ -40,7 +40,7 @@ WKTypeID WKApplicationCacheManagerGetTypeID()
 void WKApplicationCacheManagerGetApplicationCacheOrigins(WKApplicationCacheManagerRef applicationCacheManager, void* context, WKApplicationCacheManagerGetApplicationCacheOriginsFunction callback)
 {
     auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(applicationCacheManager))->websiteDataStore();
-    websiteDataStore.fetchData(WebsiteDataType::OfflineWebApplicationCache, { }, [context, callback](Vector<WebsiteDataRecord> dataRecords) {
+    websiteDataStore.fetchData(WebsiteDataType::OfflineWebApplicationCache, { }, [context, callback](auto dataRecords) {
         Vector<RefPtr<API::Object>> securityOrigins;
         for (const auto& dataRecord : dataRecords) {
             for (const auto& origin : dataRecord.origins)
index e412511..7ea6a98 100644 (file)
@@ -69,7 +69,7 @@ void WKKeyValueStorageManagerGetKeyValueStorageOrigins(WKKeyValueStorageManagerR
         return;
     }
 
-    storageManager->getLocalStorageOrigins([context, callback](HashSet<RefPtr<WebCore::SecurityOrigin>>&& securityOrigins) {
+    storageManager->getLocalStorageOrigins([context, callback](auto&& securityOrigins) {
         Vector<RefPtr<API::Object>> webSecurityOrigins;
         webSecurityOrigins.reserveInitialCapacity(securityOrigins.size());
         for (auto& origin : securityOrigins)
@@ -89,7 +89,7 @@ void WKKeyValueStorageManagerGetStorageDetailsByOrigin(WKKeyValueStorageManagerR
         return;
     }
 
-    storageManager->getLocalStorageOriginDetails([context, callback](Vector<LocalStorageDatabaseTracker::OriginDetails> storageDetails) {
+    storageManager->getLocalStorageOriginDetails([context, callback](auto storageDetails) {
         HashMap<String, RefPtr<API::Object>> detailsMap;
         Vector<RefPtr<API::Object>> result;
         result.reserveInitialCapacity(storageDetails.size());
index 73bdc0a..bb66509 100644 (file)
@@ -52,7 +52,7 @@ static OptionSet<WebsiteDataType> toWebsiteDataTypes(WKResourceCachesToClear cac
 void WKResourceCacheManagerGetCacheOrigins(WKResourceCacheManagerRef cacheManager, void* context, WKResourceCacheManagerGetCacheOriginsFunction callback)
 {
     auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(cacheManager))->websiteDataStore();
-    websiteDataStore.fetchData(toWebsiteDataTypes(WKResourceCachesToClearAll), { }, [context, callback](Vector<WebsiteDataRecord> dataRecords) {
+    websiteDataStore.fetchData(toWebsiteDataTypes(WKResourceCachesToClearAll), { }, [context, callback](auto dataRecords) {
         Vector<RefPtr<API::Object>> securityOrigins;
         for (const auto& dataRecord : dataRecords) {
             for (const auto& origin : dataRecord.origins)
index ef9fa55..3bdc5cd 100644 (file)
@@ -153,7 +153,7 @@ static Vector<WebKit::WebsiteDataRecord> toWebsiteDataRecords(NSArray *dataRecor
     if (options & _WKWebsiteDataStoreFetchOptionComputeSizes)
         fetchOptions |= WebKit::WebsiteDataFetchOption::ComputeSizes;
 
-    _websiteDataStore->websiteDataStore().fetchData(WebKit::toWebsiteDataTypes(dataTypes), fetchOptions, [completionHandlerCopy](Vector<WebKit::WebsiteDataRecord> websiteDataRecords) {
+    _websiteDataStore->websiteDataStore().fetchData(WebKit::toWebsiteDataTypes(dataTypes), fetchOptions, [completionHandlerCopy](auto websiteDataRecords) {
         Vector<RefPtr<API::Object>> elements;
         elements.reserveInitialCapacity(websiteDataRecords.size());
 
index b0a933c..97e1848 100644 (file)
@@ -189,7 +189,7 @@ void WebUserContentControllerProxy::removeAllUserScripts(API::UserContentWorld&
     for (WebProcessProxy* process : m_processes)
         process->connection()->send(Messages::WebUserContentController::RemoveAllUserScripts({ world.identifier() }), m_identifier);
 
-    unsigned userScriptsRemoved = m_userScripts->removeAllOfTypeMatching<API::UserScript>([&] (const RefPtr<API::UserScript>& userScript) -> bool {
+    unsigned userScriptsRemoved = m_userScripts->removeAllOfTypeMatching<API::UserScript>([&](const auto& userScript) {
         return &userScript->userContentWorld() == &world;
     });
 
@@ -244,7 +244,7 @@ void WebUserContentControllerProxy::removeAllUserStyleSheets(API::UserContentWor
     for (WebProcessProxy* process : m_processes)
         process->connection()->send(Messages::WebUserContentController::RemoveAllUserStyleSheets({ world.identifier() }), m_identifier);
 
-    unsigned userStyleSheetsRemoved = m_userStyleSheets->removeAllOfTypeMatching<API::UserStyleSheet>([&] (const RefPtr<API::UserStyleSheet>& userStyleSheet) -> bool {
+    unsigned userStyleSheetsRemoved = m_userStyleSheets->removeAllOfTypeMatching<API::UserStyleSheet>([&](const auto& userStyleSheet) {
         return &userStyleSheet->userContentWorld() == &world;
     });
 
@@ -310,7 +310,7 @@ void WebUserContentControllerProxy::removeAllUserMessageHandlers(API::UserConten
         process->connection()->send(Messages::WebUserContentController::RemoveAllUserScriptMessageHandlers({ world.identifier() }), m_identifier);
 
     unsigned numberRemoved = 0;
-    m_scriptMessageHandlers.removeIf([&](HashMap<uint64_t, RefPtr<WebScriptMessageHandler>>::KeyValuePairType& entry) {
+    m_scriptMessageHandlers.removeIf([&](auto& entry) {
         if (&entry.value->userContentWorld() == &world) {
             ++numberRemoved;
             return true;
index aab764d..1fd3638 100644 (file)
@@ -350,7 +350,7 @@ void PlatformCALayerRemote::addAnimationForKey(const String& key, PlatformCAAnim
 void PlatformCALayerRemote::removeAnimationForKey(const String& key)
 {
     if (m_animations.remove(key)) {
-        m_properties.addedAnimations.removeFirstMatching([&key] (const std::pair<String, PlatformCAAnimationRemote::Properties>& pair) {
+        m_properties.addedAnimations.removeFirstMatching([&key](auto& pair) {
             return pair.first == key;
         });
     }
index a690cc2..b43ebe3 100644 (file)
@@ -1,3 +1,15 @@
+2016-05-24  Chris Dumez  <cdumez@apple.com>
+
+        Use auto for some of our lambda function parameters
+        https://bugs.webkit.org/show_bug.cgi?id=158001
+
+        Reviewed by Darin Adler.
+
+        Use auto for some of our lambda function parameters now that we build with c++14.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::willDestroyPage):
+
 2016-05-23  Brady Eidson  <beidson@apple.com>
 
         check-webkit-style gets flags std::literals::chrono_literals as bad naming.
index adb945e..160ceaa 100644 (file)
@@ -2433,6 +2433,7 @@ def check_braces(clean_lines, line_number, error):
     elif (search(r'\)\s*(((const|override)\s*)*\s*)?{\s*$', line)
           and line.count('(') == line.count(')')
           and not search(r'(\s*(if|for|while|switch|NS_ENUM|@synchronized)|} @catch)\b', line)
+          and line.find("](") < 0
           and not match(r'\s+[A-Z_][A-Z_0-9]+\b', line)):
         error(line_number, 'whitespace/braces', 4,
               'Place brace on its own line for function definitions.')
index 3674d7e..260d283 100644 (file)
@@ -1769,6 +1769,10 @@ class CppStyleTest(CppStyleTestBase):
             '}\n',
             '')
         self.assert_multi_line_lint(
+            '[]() {\n'
+            '}\n',
+            '')
+        self.assert_multi_line_lint(
             'if (condition\n'
             '    && condition2\n'
             '    && condition3) {\n'
index a03326e..ba77652 100644 (file)
@@ -109,7 +109,7 @@ void InjectedBundle::didCreatePage(WKBundlePageRef page)
 
 void InjectedBundle::willDestroyPage(WKBundlePageRef page)
 {
-    m_pages.removeFirstMatching([page] (const std::unique_ptr<InjectedBundlePage>& current) {
+    m_pages.removeFirstMatching([page](auto& current) {
         return current->page() == page;
     });
 }