Diff
Modified: trunk/Source/WTF/ChangeLog (156306 => 156307)
--- trunk/Source/WTF/ChangeLog 2013-09-23 23:26:23 UTC (rev 156306)
+++ trunk/Source/WTF/ChangeLog 2013-09-23 23:53:28 UTC (rev 156307)
@@ -1,5 +1,16 @@
2013-09-23 Anders Carlsson <[email protected]>
+ Test the waters and begin using lambdas
+ https://bugs.webkit.org/show_bug.cgi?id=121809
+
+ Reviewed by Andreas Kling.
+
+ * wtf/ListDump.h:
+ (WTF::sortedListDump):
+ Use std::less instead of a custom lessThan function.
+
+2013-09-23 Anders Carlsson <[email protected]>
+
ListHashSet::removeLast should only remove one element.
* wtf/ListHashSet.h:
Modified: trunk/Source/WTF/wtf/ListDump.h (156306 => 156307)
--- trunk/Source/WTF/wtf/ListDump.h 2013-09-23 23:26:23 UTC (rev 156306)
+++ trunk/Source/WTF/wtf/ListDump.h 2013-09-23 23:53:28 UTC (rev 156307)
@@ -94,15 +94,9 @@
}
template<typename T>
-inline bool lessThan(const T& a, const T& b)
-{
- return a < b;
-}
-
-template<typename T>
CString sortedListDump(const T& list, const char* comma = ", ")
{
- return sortedListDump(list, lessThan<typename T::ValueType>, comma);
+ return sortedListDump(list, std::less<typename T::ValueType>(), comma);
}
template<typename T>
Modified: trunk/Source/WebCore/ChangeLog (156306 => 156307)
--- trunk/Source/WebCore/ChangeLog 2013-09-23 23:26:23 UTC (rev 156306)
+++ trunk/Source/WebCore/ChangeLog 2013-09-23 23:53:28 UTC (rev 156307)
@@ -1,3 +1,19 @@
+2013-09-23 Anders Carlsson <[email protected]>
+
+ Test the waters and begin using lambdas
+ https://bugs.webkit.org/show_bug.cgi?id=121809
+
+ Reviewed by Andreas Kling.
+
+ Use lambdas instead of static functions and function objects.
+
+ * css/MediaQuery.cpp:
+ (WebCore::MediaQuery::MediaQuery):
+ * dom/MutationObserver.cpp:
+ (WebCore::MutationObserver::deliverAllMutations):
+ * page/CaptionUserPreferences.cpp:
+ (WebCore::CaptionUserPreferences::sortedTrackListForMenu):
+
2013-09-23 Patrick Gansterer <[email protected]>
[WIN] Add implementation for WebCore::readFromFile()
Modified: trunk/Source/WebCore/css/MediaQuery.cpp (156306 => 156307)
--- trunk/Source/WebCore/css/MediaQuery.cpp 2013-09-23 23:26:23 UTC (rev 156306)
+++ trunk/Source/WebCore/css/MediaQuery.cpp 2013-09-23 23:53:28 UTC (rev 156307)
@@ -72,11 +72,6 @@
return result.toString();
}
-static bool expressionCompare(const OwnPtr<MediaQueryExp>& a, const OwnPtr<MediaQueryExp>& b)
-{
- return codePointCompare(a->serialize(), b->serialize()) < 0;
-}
-
MediaQuery::MediaQuery(Restrictor r, const String& mediaType, PassOwnPtr<ExpressionVector> exprs)
: m_restrictor(r)
, m_mediaType(mediaType.lower())
@@ -88,7 +83,9 @@
return;
}
- std::sort(m_expressions->begin(), m_expressions->end(), expressionCompare);
+ std::sort(m_expressions->begin(), m_expressions->end(), [](const OwnPtr<MediaQueryExp>& a, const OwnPtr<MediaQueryExp>& b) {
+ return codePointCompare(a->serialize(), b->serialize()) < 0;
+ });
// remove all duplicated expressions
String key;
Modified: trunk/Source/WebCore/dom/MutationObserver.cpp (156306 => 156307)
--- trunk/Source/WebCore/dom/MutationObserver.cpp 2013-09-23 23:26:23 UTC (rev 156306)
+++ trunk/Source/WebCore/dom/MutationObserver.cpp 2013-09-23 23:53:28 UTC (rev 156307)
@@ -48,13 +48,6 @@
static unsigned s_observerPriority = 0;
-struct MutationObserver::ObserverLessThan {
- bool operator()(const RefPtr<MutationObserver>& lhs, const RefPtr<MutationObserver>& rhs)
- {
- return lhs->m_priority < rhs->m_priority;
- }
-};
-
PassRefPtr<MutationObserver> MutationObserver::create(PassRefPtr<MutationCallback> callback)
{
ASSERT(isMainThread());
@@ -231,7 +224,10 @@
Vector<RefPtr<MutationObserver> > observers;
copyToVector(activeMutationObservers(), observers);
activeMutationObservers().clear();
- std::sort(observers.begin(), observers.end(), ObserverLessThan());
+ std::sort(observers.begin(), observers.end(), [](const RefPtr<MutationObserver>& lhs, const RefPtr<MutationObserver>& rhs) {
+ return lhs->m_priority < rhs->m_priority;
+ });
+
for (size_t i = 0; i < observers.size(); ++i) {
if (observers[i]->canDeliver())
observers[i]->deliver();
Modified: trunk/Source/WebCore/page/CaptionUserPreferences.cpp (156306 => 156307)
--- trunk/Source/WebCore/page/CaptionUserPreferences.cpp 2013-09-23 23:26:23 UTC (rev 156306)
+++ trunk/Source/WebCore/page/CaptionUserPreferences.cpp 2013-09-23 23:53:28 UTC (rev 156307)
@@ -173,11 +173,6 @@
return trackDisplayName(track);
}
-static bool textTrackCompare(const RefPtr<TextTrack>& a, const RefPtr<TextTrack>& b)
-{
- return codePointCompare(trackDisplayName(a.get()), trackDisplayName(b.get())) < 0;
-}
-
Vector<RefPtr<TextTrack>> CaptionUserPreferences::sortedTrackListForMenu(TextTrackList* trackList)
{
ASSERT(trackList);
@@ -187,7 +182,9 @@
for (unsigned i = 0, length = trackList->length(); i < length; ++i)
tracksForMenu.append(trackList->item(i));
- std::sort(tracksForMenu.begin(), tracksForMenu.end(), textTrackCompare);
+ std::sort(tracksForMenu.begin(), tracksForMenu.end(), [](const RefPtr<TextTrack>& a, const RefPtr<TextTrack>& b) {
+ return codePointCompare(trackDisplayName(a.get()), trackDisplayName(b.get())) < 0;
+ });
tracksForMenu.insert(0, TextTrack::captionMenuOffItem());
tracksForMenu.insert(1, TextTrack::captionMenuAutomaticItem());