Bug 122698

Summary: Change callOnMainThread to take an std::function
Product: WebKit Reporter: Anders Carlsson <andersca>
Component: New BugsAssignee: Anders Carlsson <andersca>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cmarcelo, commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch darin: review+, buildbot: commit-queue-

Description Anders Carlsson 2013-10-12 11:58:16 PDT
Change callOnMainThread to take an std::function
Comment 1 Anders Carlsson 2013-10-12 12:01:01 PDT
Created attachment 214061 [details]
Patch
Comment 2 WebKit Commit Bot 2013-10-12 12:02:04 PDT
Attachment 214061 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/ChangeLog', u'Source/WTF/wtf/MainThread.cpp', u'Source/WTF/wtf/MainThread.h']" exit_code: 1
Source/WTF/wtf/MainThread.h:48:  Extra space before ( in function call  [whitespace/parens] [4]
Source/WTF/wtf/MainThread.cpp:233:  Extra space before ( in function call  [whitespace/parens] [4]
Source/WTF/wtf/MainThread.cpp:235:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Source/WTF/wtf/MainThread.cpp:236:  Extra space before ( in function call  [whitespace/parens] [4]
Source/WTF/wtf/MainThread.cpp:240:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 5 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Build Bot 2013-10-12 12:41:40 PDT
Comment on attachment 214061 [details]
Patch

Attachment 214061 [details] did not pass win-ews (win):
Output: http://webkit-queues.appspot.com/results/3582033
Comment 4 Anders Carlsson 2013-10-12 13:20:18 PDT
Created attachment 214063 [details]
Patch
Comment 5 WebKit Commit Bot 2013-10-12 13:22:24 PDT
Attachment 214063 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/ChangeLog', u'Source/WTF/wtf/MainThread.cpp', u'Source/WTF/wtf/MainThread.h']" exit_code: 1
Source/WTF/wtf/MainThread.h:48:  Extra space before ( in function call  [whitespace/parens] [4]
Source/WTF/wtf/MainThread.cpp:233:  Extra space before ( in function call  [whitespace/parens] [4]
Source/WTF/wtf/MainThread.cpp:235:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Source/WTF/wtf/MainThread.cpp:236:  Extra space before ( in function call  [whitespace/parens] [4]
Source/WTF/wtf/MainThread.cpp:240:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 5 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Build Bot 2013-10-12 14:59:39 PDT
Comment on attachment 214063 [details]
Patch

Attachment 214063 [details] did not pass win-ews (win):
Output: http://webkit-queues.appspot.com/results/3788079
Comment 7 Darin Adler 2013-10-12 16:25:37 PDT
Comment on attachment 214063 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=214063&action=review

>> Source/WTF/wtf/MainThread.cpp:240
>> +    callOnMainThread(+callFunctionObject, std::make_unique<std::function<void ()>>(std::move(function)).release());
> 
> Extra space before ( in function call  [whitespace/parens] [4]

What does the "+" here mean? Whatever it means, it seems that Windows does not understand it:

     1>..\wtf\MainThread.cpp(240): error C2675: unary '+' : 'WTF::`anonymous-namespace'::<lambda0>' does not define this operator or a conversion to a type acceptable to the predefined operator
Comment 8 Anders Carlsson 2013-10-13 09:07:01 PDT
(In reply to comment #7)
> (From update of attachment 214063 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=214063&action=review
> 
> >> Source/WTF/wtf/MainThread.cpp:240
> >> +    callOnMainThread(+callFunctionObject, std::make_unique<std::function<void ()>>(std::move(function)).release());
> > 
> > Extra space before ( in function call  [whitespace/parens] [4]
> 
> What does the "+" here mean? Whatever it means, it seems that Windows does not understand it:
> 
>      1>..\wtf\MainThread.cpp(240): error C2675: unary '+' : 'WTF::`anonymous-namespace'::<lambda0>' does not define this operator or a conversion to a type acceptable to the predefined operator

It explictly converts the lambda to a function pointer. Looks like MSVC doesn't support converting lambdas to function pointers, so I'm going to have to use a regular function instead.
Comment 9 Anders Carlsson 2013-10-13 09:11:46 PDT
Committed r157374: <http://trac.webkit.org/changeset/157374>