Use WTF::Function instead of std::function in WTF/ to avoid copying.
Created attachment 313219 [details] Patch
Attachment 313219 [details] did not pass style-queue: ERROR: Source/WTF/wtf/MemoryPressureHandler.h:175: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WTF/wtf/MemoryPressureHandler.h:182: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WTF/wtf/RefCounter.h:62: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp:102: Extra space before ( in function call [whitespace/parens] [4] Total errors found: 4 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 313219 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=313219&action=review > Source/WTF/wtf/text/WTFString.h:370 > + using SplitFunctor = WTF::Function<void(const StringView&)>; > + WTF_EXPORT_STRING_API void split(UChar separator, bool allowEmptyEntries, const SplitFunctor&) const; This kind of basic algorithm seems like it should a template function and take the functor as a template parameter.
(In reply to Sam Weinig from comment #3) > Comment on attachment 313219 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=313219&action=review > > > Source/WTF/wtf/text/WTFString.h:370 > > + using SplitFunctor = WTF::Function<void(const StringView&)>; > > + WTF_EXPORT_STRING_API void split(UChar separator, bool allowEmptyEntries, const SplitFunctor&) const; > > This kind of basic algorithm seems like it should a template function and > take the functor as a template parameter. Agreed. Should I do it in this patch or a follow-up?
Comment on attachment 313219 [details] Patch Will do in a follow-up.
Comment on attachment 313219 [details] Patch Clearing flags on attachment: 313219 Committed r218464: <http://trac.webkit.org/changeset/218464>
All reviewed patches have been landed. Closing bug.
(In reply to Chris Dumez from comment #4) > (In reply to Sam Weinig from comment #3) > > Comment on attachment 313219 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=313219&action=review > > > > > Source/WTF/wtf/text/WTFString.h:370 > > > + using SplitFunctor = WTF::Function<void(const StringView&)>; > > > + WTF_EXPORT_STRING_API void split(UChar separator, bool allowEmptyEntries, const SplitFunctor&) const; > > > > This kind of basic algorithm seems like it should a template function and > > take the functor as a template parameter. > > Agreed. Should I do it in this patch or a follow-up? Follow-up probably.
Comment on attachment 313219 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=313219&action=review >>>> Source/WTF/wtf/text/WTFString.h:370 >>>> + WTF_EXPORT_STRING_API void split(UChar separator, bool allowEmptyEntries, const SplitFunctor&) const; >>> >>> This kind of basic algorithm seems like it should a template function and take the functor as a template parameter. >> >> Agreed. Should I do it in this patch or a follow-up? > > Follow-up probably. Note that in this case though, it would force us to move the implementation in the header (it is currently in the cpp).