Bug 199271 - Avoid using WTF::Function for passing local function pointers and closures in URLHelpers.cpp
Summary: Avoid using WTF::Function for passing local function pointers and closures in...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Konstantin Tokarev
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-06-27 06:29 PDT by Konstantin Tokarev
Modified: 2019-06-27 14:37 PDT (History)
10 users (show)

See Also:


Attachments
Patch (1.46 KB, patch)
2019-06-27 06:30 PDT, Konstantin Tokarev
no flags Details | Formatted Diff | Diff
Patch (1.48 KB, patch)
2019-06-27 11:53 PDT, Konstantin Tokarev
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>