Bug 199271

Summary: Avoid using WTF::Function for passing local function pointers and closures in URLHelpers.cpp
Product: WebKit Reporter: Konstantin Tokarev <annulen>
Component: Web Template FrameworkAssignee: Konstantin Tokarev <annulen>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, darin, dbates, ews-watchlist, keith_miller, mark.lam, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Konstantin Tokarev 2019-06-27 06:29:03 PDT
WTF::Function allocates memory on heap, which is totally redundant in this case.

I've also tried using ScopedLambda, however its constructor doesn't allow conversion from non-lambda functions.
Comment 1 Konstantin Tokarev 2019-06-27 06:30:07 PDT
Created attachment 373026 [details]
Patch
Comment 2 Keith Miller 2019-06-27 11:13:25 PDT
Comment on attachment 373026 [details]
Patch

Why not change ScopedLambda to allow a function pointer?
Comment 3 Konstantin Tokarev 2019-06-27 11:34:54 PDT
I thought about that, but it won't be Scoped*Lambda* anymore...
Comment 4 Konstantin Tokarev 2019-06-27 11:53:37 PDT
Created attachment 373041 [details]
Patch
Comment 5 Konstantin Tokarev 2019-06-27 11:54:32 PDT
Yusuke adviced me to change it to template (to avoid indirect call in a loop)
Comment 6 Yusuke Suzuki 2019-06-27 12:14:34 PDT
Comment on attachment 373041 [details]
Patch

r=me
Comment 7 Konstantin Tokarev 2019-06-27 14:36:14 PDT
Comment on attachment 373041 [details]
Patch

Clearing flags on attachment: 373041

Committed r246906: <https://trac.webkit.org/changeset/246906>
Comment 8 Konstantin Tokarev 2019-06-27 14:36:19 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2019-06-27 14:37:28 PDT
<rdar://problem/52285454>