Bug 178681

Summary: Remove scopeguard from platform
Product: WebKit Reporter: Christopher Reid <chris.reid>
Component: PlatformAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, alecflett, beidson, benjamin, buildbot, cdumez, chris.reid, cmarcelo, commit-queue, dbates, don.olmstead, jsbell, mmaxfield, sam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Christopher Reid 2017-10-23 14:18:58 PDT
FileSystem uses scopeguard so filesystem can't be moved into PAL while scopeguard is in WebCore.
Comment 1 Christopher Reid 2017-10-23 16:01:27 PDT
Created attachment 324604 [details]
Patch
Comment 2 Build Bot 2017-10-23 16:05:10 PDT
Attachment 324604 [details] did not pass style-queue:


ERROR: Source/WebCore/Modules/indexeddb/IDBRequest.h:40:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
ERROR: Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:31:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 3 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Christopher Reid 2017-10-23 16:13:04 PDT
Created attachment 324606 [details]
Patch

Fixing style issues
Comment 4 Christopher Reid 2017-10-23 16:41:29 PDT
Created attachment 324610 [details]
Patch

Patch - Fixing a poorly merged line
Comment 5 Brady Eidson 2017-10-23 22:44:54 PDT
I'm surprised so few places use this.

Regardless, there's nothing "Platform" about this class - It belongs in WTF
Comment 6 Sam Weinig 2017-10-24 05:37:49 PDT
WTF already has ScopeExit, which looks similar. Maybe we can just remove ScopeGuard.
Comment 7 Christopher Reid 2017-10-24 17:12:05 PDT
Created attachment 324764 [details]
patch

Here's a patch replacing Webcore::ScopeGuard with WTF::ScopeExit
Comment 8 Build Bot 2017-10-24 17:14:08 PDT
Attachment 324764 [details] did not pass style-queue:


ERROR: Source/WebCore/workers/service/ServiceWorkerContainer.cpp:45:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebKit/Shared/mac/ChildProcessMac.mm:39:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/platform/FileSystem.cpp:31:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp:48:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/platform/network/BlobRegistryImpl.cpp:44:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:31:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 6 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Christopher Reid 2017-10-24 17:21:07 PDT
Created attachment 324765 [details]
Patch

Fixing style issues for scopeguard removal patch
Comment 10 Christopher Reid 2017-10-24 17:21:56 PDT
Created attachment 324766 [details]
Patch

Accidentally uploaded an older patch
Comment 11 Alex Christensen 2017-10-25 15:27:34 PDT
Comment on attachment 324766 [details]
Patch

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

> Source/WebCore/Modules/indexeddb/IDBRequest.h:174
> +    std::unique_ptr<WTF::ScopeExit<std::function<void()>>> m_cursorRequestNotifier;

Is there a reason this needs to be std::function?  We're trying to use WTF::Function instead because it's non-copyable.
Comment 12 Christopher Reid 2017-10-25 15:47:14 PDT
(In reply to Alex Christensen from comment #11)
> Comment on attachment 324766 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=324766&action=review
> 
> > Source/WebCore/Modules/indexeddb/IDBRequest.h:174
> > +    std::unique_ptr<WTF::ScopeExit<std::function<void()>>> m_cursorRequestNotifier;
> 
> Is there a reason this needs to be std::function?  We're trying to use
> WTF::Function instead because it's non-copyable.

For some reason I thought ScopeGuard was using std::function, but I was mistaken. I'll change it to WTF::Function.
Comment 13 Christopher Reid 2017-10-25 18:07:44 PDT
Created attachment 324932 [details]
Patch

Using WTF::Function instead of std::function
Comment 14 Build Bot 2017-10-25 18:10:34 PDT
Attachment 324932 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 12 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 15 Christopher Reid 2017-10-25 18:15:23 PDT
Created attachment 324934 [details]
Patch

Using WTF::Function instead of std::function - Fixing style issue
Comment 16 Christopher Reid 2017-10-25 18:38:55 PDT
Created attachment 324938 [details]
Patch

Using WTF::Function instead of std::function -- Missed a new scope guard that was added today :(
Comment 17 Brady Eidson 2017-10-25 20:20:57 PDT
Comment on attachment 324938 [details]
Patch

LGTM once EWS is all green.
Comment 18 WebKit Commit Bot 2017-10-26 07:06:30 PDT
Comment on attachment 324938 [details]
Patch

Clearing flags on attachment: 324938

Committed r224018: <https://trac.webkit.org/changeset/224018>
Comment 19 WebKit Commit Bot 2017-10-26 07:06:32 PDT
All reviewed patches have been landed.  Closing bug.
Comment 20 Radar WebKit Bug Importer 2017-11-15 13:03:03 PST
<rdar://problem/35568687>