Bug 201333

Summary: Introduce WorkerMessagePortChannelRegistry
Product: WebKit Reporter: youenn fablet <youennf>
Component: Page LoadingAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, cdumez, commit-queue, dbates, esprehn+autocc, ews-watchlist, kangil.han, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=205357
https://bugs.webkit.org/show_bug.cgi?id=205414
Bug Depends on:    
Bug Blocks: 201299    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch for landing none

Description youenn fablet 2019-08-30 00:41:16 PDT
Introduce WorkerMessagePortChannelRegistry
Comment 1 youenn fablet 2019-08-30 01:48:17 PDT
Created attachment 377689 [details]
Patch
Comment 2 youenn fablet 2019-08-30 02:04:28 PDT
Created attachment 377690 [details]
Patch
Comment 3 Alex Christensen 2019-08-30 08:53:23 PDT
Comment on attachment 377690 [details]
Patch

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

> Source/WebCore/dom/MessagePort.cpp:252
> +        auto scopeExit = makeScopeExit([&completionCallback] {
> +            completionCallback();
> +        });

Why make a lambda that calls the Function instead of just using the Function itself?  Why no WTFMove? Also, this seems like it should be a CompletionHandler.

> Source/WebCore/dom/MessagePort.cpp:315
> +        callOnMainThread([remoteIdentifier = m_remoteIdentifier, weakThis = makeWeakPtr(const_cast<MessagePort*>(this)), workerThread = WTFMove(workerThread)]() mutable {

makeWeakPtr should take const T& instead of non-const T& and this const_cast shouldn't be necessary. Same with const T*
Comment 4 youenn fablet 2019-09-01 13:21:38 PDT
Created attachment 377829 [details]
Patch
Comment 5 youenn fablet 2019-09-01 22:51:08 PDT
Created attachment 377839 [details]
Patch for landing
Comment 6 youenn fablet 2019-09-01 22:53:55 PDT
(In reply to Alex Christensen from comment #3)
> Comment on attachment 377690 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=377690&action=review
> 
> > Source/WebCore/dom/MessagePort.cpp:252
> > +        auto scopeExit = makeScopeExit([&completionCallback] {
> > +            completionCallback();
> > +        });
> 
> Why make a lambda that calls the Function instead of just using the Function
> itself?  Why no WTFMove? Also, this seems like it should be a
> CompletionHandler.

Right.

> > Source/WebCore/dom/MessagePort.cpp:315
> > +        callOnMainThread([remoteIdentifier = m_remoteIdentifier, weakThis = makeWeakPtr(const_cast<MessagePort*>(this)), workerThread = WTFMove(workerThread)]() mutable {
> 
> makeWeakPtr should take const T& instead of non-const T& and this const_cast
> shouldn't be necessary. Same with const T*

makeWeakPtr can take a const pointer as input but it will create a WeakPtr of a const pointer.
In that case, we want to have a non const weakThis to call updateActivity.
Comment 7 WebKit Commit Bot 2019-09-02 02:31:21 PDT
Comment on attachment 377839 [details]
Patch for landing

Clearing flags on attachment: 377839

Committed r249378: <https://trac.webkit.org/changeset/249378>
Comment 8 WebKit Commit Bot 2019-09-02 02:31:23 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2019-09-02 02:32:18 PDT
<rdar://problem/54945252>