Bug 158187

Summary: Make ScriptExecutionContext::Task work in terms of wtf::NoncopyableFunction instead of std::function
Product: WebKit Reporter: Brady Eidson <beidson>
Component: WebCore Misc.Assignee: Brady Eidson <beidson>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue, esprehn+autocc, kangil.han
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 158173    
Attachments:
Description Flags
Patch
none
Patch none

Description Brady Eidson 2016-05-28 22:03:41 PDT
Make ScriptExecutionContext::Task work in terms of wtf::NoncopyableFunction instead of std::function
Comment 1 Brady Eidson 2016-05-28 22:15:11 PDT
Created attachment 280054 [details]
Patch
Comment 2 WebKit Commit Bot 2016-05-28 22:17:00 PDT
Attachment 280054 [details] did not pass style-queue:


ERROR: Source/WebCore/dom/ScriptExecutionContext.h:136:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebCore/dom/ScriptExecutionContext.h:143:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebCore/dom/ScriptExecutionContext.h:149:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebCore/dom/ScriptExecutionContext.h:166:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 4 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Brady Eidson 2016-05-28 22:33:37 PDT
Created attachment 280055 [details]
Patch
Comment 4 WebKit Commit Bot 2016-05-28 22:35:49 PDT
Attachment 280055 [details] did not pass style-queue:


ERROR: Source/WebCore/dom/ScriptExecutionContext.h:136:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebCore/dom/ScriptExecutionContext.h:143:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebCore/dom/ScriptExecutionContext.h:149:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebCore/dom/ScriptExecutionContext.h:166:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 4 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Chris Dumez 2016-05-28 22:52:59 PDT
Comment on attachment 280055 [details]
Patch

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

> Source/WebCore/dom/ScriptExecutionContext.h:143
> +        Task(std::function<void ()> task)

How about this one? Shouldn't this be a NoncopyableFunction<void ()>&& task?

Note that would require updating TaskDispatcher::postTask() as well probably, in GenericTaskQueue.h.
Comment 6 Chris Dumez 2016-05-28 22:54:48 PDT
Comment on attachment 280055 [details]
Patch

Are you planning to clean up the lambda captures at the postTask() call sites in a separate patch? Using NoncopyableFunction in Task, should allow a decent amount of clean up (including getting rid of some StringCapture uses).
Comment 7 Brady Eidson 2016-05-29 11:39:32 PDT
(In reply to comment #5)
> Comment on attachment 280055 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=280055&action=review
> 
> > Source/WebCore/dom/ScriptExecutionContext.h:143
> > +        Task(std::function<void ()> task)
> 
> How about this one? Shouldn't this be a NoncopyableFunction<void ()>&& task?
> 
> Note that would require updating TaskDispatcher::postTask() as well
> probably, in GenericTaskQueue.h.

Right - I plan on moving iteratively on this so each patch is more targeted..  There should be 3 or 4 steps - This is just the first.

Making that change here blows up the patch a lot.(In reply to comment #6)

> Are you planning to clean up the lambda captures at the postTask() call
> sites in a separate patch? Using NoncopyableFunction in Task, should allow a
> decent amount of clean up (including getting rid of some StringCapture uses).

Yes - That's in progress locally. Again, plan on moving in smaller steps :P
Comment 8 Chris Dumez 2016-05-29 12:02:16 PDT
Comment on attachment 280055 [details]
Patch

R=me, definitely a step in the right direction.
Comment 9 WebKit Commit Bot 2016-05-29 21:29:07 PDT
Comment on attachment 280055 [details]
Patch

Clearing flags on attachment: 280055

Committed r201496: <http://trac.webkit.org/changeset/201496>
Comment 10 WebKit Commit Bot 2016-05-29 21:29:12 PDT
All reviewed patches have been landed.  Closing bug.