Changeset 156307 in webkit
- Timestamp:
- Sep 23, 2013 4:53:28 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r156305 r156307 1 2013-09-23 Anders Carlsson <andersca@apple.com> 2 3 Test the waters and begin using lambdas 4 https://bugs.webkit.org/show_bug.cgi?id=121809 5 6 Reviewed by Andreas Kling. 7 8 * wtf/ListDump.h: 9 (WTF::sortedListDump): 10 Use std::less instead of a custom lessThan function. 11 1 12 2013-09-23 Anders Carlsson <andersca@apple.com> 2 13 -
trunk/Source/WTF/wtf/ListDump.h
r153294 r156307 95 95 96 96 template<typename T> 97 inline bool lessThan(const T& a, const T& b)98 {99 return a < b;100 }101 102 template<typename T>103 97 CString sortedListDump(const T& list, const char* comma = ", ") 104 98 { 105 return sortedListDump(list, lessThan<typename T::ValueType>, comma);99 return sortedListDump(list, std::less<typename T::ValueType>(), comma); 106 100 } 107 101 -
trunk/Source/WebCore/ChangeLog
r156306 r156307 1 2013-09-23 Anders Carlsson <andersca@apple.com> 2 3 Test the waters and begin using lambdas 4 https://bugs.webkit.org/show_bug.cgi?id=121809 5 6 Reviewed by Andreas Kling. 7 8 Use lambdas instead of static functions and function objects. 9 10 * css/MediaQuery.cpp: 11 (WebCore::MediaQuery::MediaQuery): 12 * dom/MutationObserver.cpp: 13 (WebCore::MutationObserver::deliverAllMutations): 14 * page/CaptionUserPreferences.cpp: 15 (WebCore::CaptionUserPreferences::sortedTrackListForMenu): 16 1 17 2013-09-23 Patrick Gansterer <paroga@webkit.org> 2 18 -
trunk/Source/WebCore/css/MediaQuery.cpp
r155277 r156307 73 73 } 74 74 75 static bool expressionCompare(const OwnPtr<MediaQueryExp>& a, const OwnPtr<MediaQueryExp>& b)76 {77 return codePointCompare(a->serialize(), b->serialize()) < 0;78 }79 80 75 MediaQuery::MediaQuery(Restrictor r, const String& mediaType, PassOwnPtr<ExpressionVector> exprs) 81 76 : m_restrictor(r) … … 89 84 } 90 85 91 std::sort(m_expressions->begin(), m_expressions->end(), expressionCompare); 86 std::sort(m_expressions->begin(), m_expressions->end(), [](const OwnPtr<MediaQueryExp>& a, const OwnPtr<MediaQueryExp>& b) { 87 return codePointCompare(a->serialize(), b->serialize()) < 0; 88 }); 92 89 93 90 // remove all duplicated expressions -
trunk/Source/WebCore/dom/MutationObserver.cpp
r153447 r156307 49 49 static unsigned s_observerPriority = 0; 50 50 51 struct MutationObserver::ObserverLessThan {52 bool operator()(const RefPtr<MutationObserver>& lhs, const RefPtr<MutationObserver>& rhs)53 {54 return lhs->m_priority < rhs->m_priority;55 }56 };57 58 51 PassRefPtr<MutationObserver> MutationObserver::create(PassRefPtr<MutationCallback> callback) 59 52 { … … 232 225 copyToVector(activeMutationObservers(), observers); 233 226 activeMutationObservers().clear(); 234 std::sort(observers.begin(), observers.end(), ObserverLessThan()); 227 std::sort(observers.begin(), observers.end(), [](const RefPtr<MutationObserver>& lhs, const RefPtr<MutationObserver>& rhs) { 228 return lhs->m_priority < rhs->m_priority; 229 }); 230 235 231 for (size_t i = 0; i < observers.size(); ++i) { 236 232 if (observers[i]->canDeliver()) -
trunk/Source/WebCore/page/CaptionUserPreferences.cpp
r155277 r156307 174 174 } 175 175 176 static bool textTrackCompare(const RefPtr<TextTrack>& a, const RefPtr<TextTrack>& b)177 {178 return codePointCompare(trackDisplayName(a.get()), trackDisplayName(b.get())) < 0;179 }180 181 176 Vector<RefPtr<TextTrack>> CaptionUserPreferences::sortedTrackListForMenu(TextTrackList* trackList) 182 177 { … … 188 183 tracksForMenu.append(trackList->item(i)); 189 184 190 std::sort(tracksForMenu.begin(), tracksForMenu.end(), textTrackCompare); 185 std::sort(tracksForMenu.begin(), tracksForMenu.end(), [](const RefPtr<TextTrack>& a, const RefPtr<TextTrack>& b) { 186 return codePointCompare(trackDisplayName(a.get()), trackDisplayName(b.get())) < 0; 187 }); 191 188 192 189 tracksForMenu.insert(0, TextTrack::captionMenuOffItem());
Note: See TracChangeset
for help on using the changeset viewer.