Bug 173660

Summary: Allow constructing a WTF:Function from a function pointer
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Web Template FrameworkAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, buildbot, commit-queue, darin, kling, koivisto, ryanhaddad, sam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Chris Dumez
Reported 2017-06-21 10:02:42 PDT
Allow constructing a WTF:Function from a function pointer.
Attachments
Patch (6.04 KB, patch)
2017-06-21 10:05 PDT, Chris Dumez
no flags
Patch (6.99 KB, patch)
2017-06-21 10:46 PDT, Chris Dumez
no flags
Patch (6.99 KB, patch)
2017-06-21 10:58 PDT, Chris Dumez
no flags
Patch (10.94 KB, patch)
2017-06-21 12:06 PDT, Chris Dumez
no flags
Patch (11.00 KB, patch)
2017-06-21 14:37 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2017-06-21 10:05:26 PDT
Chris Dumez
Comment 2 2017-06-21 10:46:08 PDT
Chris Dumez
Comment 3 2017-06-21 10:58:17 PDT
Darin Adler
Comment 4 2017-06-21 11:26:33 PDT
Comment on attachment 313531 [details] Patch Looks great. I remember one example from one of the std::function patches that was taking a bool that I don’t see you changing back here.
Darin Adler
Comment 5 2017-06-21 11:26:59 PDT
Could add a unit test for this too since we have Function.cpp now.
Chris Dumez
Comment 6 2017-06-21 11:27:48 PDT
(In reply to Darin Adler from comment #4) > Comment on attachment 313531 [details] > Patch > > Looks great. I remember one example from one of the std::function patches > that was taking a bool that I don’t see you changing back here. networkStateChanged. Found it. Will fix as well, thanks.
Chris Dumez
Comment 7 2017-06-21 11:28:03 PDT
(In reply to Darin Adler from comment #5) > Could add a unit test for this too since we have Function.cpp now. Good idea. Will do.
Chris Dumez
Comment 8 2017-06-21 12:06:34 PDT
Darin Adler
Comment 9 2017-06-21 13:44:29 PDT
Comment on attachment 313538 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=313538&action=review > Source/WebCore/page/Page.cpp:284 > - networkStateNotifier().addNetworkStateChangeListener([] (bool isOnLine) { networkStateChanged(isOnLine); }); > + networkStateNotifier().addNetworkStateChangeListener(networkStateChanged); My fault you added this, but it’s not compiling on Windows, maybe due to the different flavors of function pointer that exist on Windows. > Source/WebCore/workers/Worker.cpp:62 > - networkStateNotifier().addNetworkStateChangeListener([] (bool isOnLine) { networkStateChanged(isOnLine); }); > + networkStateNotifier().addNetworkStateChangeListener(networkStateChanged); Same here.
Chris Dumez
Comment 10 2017-06-21 14:37:28 PDT
Build Bot
Comment 11 2017-06-21 14:39:14 PDT
Attachment 313552 [details] did not pass style-queue: ERROR: Source/WebCore/workers/Worker.cpp:62: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WebCore/page/Page.cpp:284: Extra space before ( in function call [whitespace/parens] [4] Total errors found: 2 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Chris Dumez
Comment 12 2017-06-21 15:25:09 PDT
Comment on attachment 313552 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=313552&action=review > Source/WebCore/page/Page.cpp:284 > + networkStateNotifier().addNetworkStateChangeListener(WTF::Function<void (bool)> { networkStateChanged }); Somehow Windows requires the explicit WTF::Function<void (bool)> { } here.
WebKit Commit Bot
Comment 13 2017-06-21 15:53:17 PDT
Comment on attachment 313552 [details] Patch Clearing flags on attachment: 313552 Committed r218660: <http://trac.webkit.org/changeset/218660>
WebKit Commit Bot
Comment 14 2017-06-21 15:53:19 PDT
All reviewed patches have been landed. Closing bug.
Ryan Haddad
Comment 15 2017-06-21 17:41:18 PDT
(In reply to WebKit Commit Bot from comment #13) > Comment on attachment 313552 [details] > Patch > > Clearing flags on attachment: 313552 > > Committed r218660: <http://trac.webkit.org/changeset/218660> This change broke the Windows Debug build: https://build.webkit.org/builders/Apple%20Win%20Debug%20%28Build%29/builds/2230
Chris Dumez
Comment 16 2017-06-21 18:22:08 PDT
(In reply to Ryan Haddad from comment #15) > (In reply to WebKit Commit Bot from comment #13) > > Comment on attachment 313552 [details] > > Patch > > > > Clearing flags on attachment: 313552 > > > > Committed r218660: <http://trac.webkit.org/changeset/218660> > > This change broke the Windows Debug build: > https://build.webkit.org/builders/Apple%20Win%20Debug%20%28Build%29/builds/ > 2230 Will fix now, thanks.
Chris Dumez
Comment 17 2017-06-21 18:26:18 PDT
(In reply to Chris Dumez from comment #16) > (In reply to Ryan Haddad from comment #15) > > (In reply to WebKit Commit Bot from comment #13) > > > Comment on attachment 313552 [details] > > > Patch > > > > > > Clearing flags on attachment: 313552 > > > > > > Committed r218660: <http://trac.webkit.org/changeset/218660> > > > > This change broke the Windows Debug build: > > https://build.webkit.org/builders/Apple%20Win%20Debug%20%28Build%29/builds/ > > 2230 > > Will fix now, thanks. <http://trac.webkit.org/changeset/218671>
Chris Dumez
Comment 18 2017-06-21 18:32:22 PDT
Comment on attachment 313552 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=313552&action=review >> Source/WebCore/page/Page.cpp:284 >> + networkStateNotifier().addNetworkStateChangeListener(WTF::Function<void (bool)> { networkStateChanged }); > > Somehow Windows requires the explicit WTF::Function<void (bool)> { } here. I really need to find a way to make Window build without this. This is ugly :/
Note You need to log in before you can comment on or make changes to this bug.