Bug 198844

Summary: Cloning a MediaStreamTrack does not clone the logger
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebRTCAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, darin, eric.carlson, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description youenn fablet 2019-06-13 16:39:59 PDT
Cloning a MediaStreamTrack does not clone the logger
Comment 1 youenn fablet 2019-06-13 16:50:01 PDT
Created attachment 372082 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2019-06-13 17:13:33 PDT
<rdar://problem/51729128>
Comment 3 WebKit Commit Bot 2019-06-14 10:14:53 PDT
Comment on attachment 372082 [details]
Patch

Clearing flags on attachment: 372082

Committed r246436: <https://trac.webkit.org/changeset/246436>
Comment 4 WebKit Commit Bot 2019-06-14 10:14:55 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Darin Adler 2019-06-14 15:19:03 PDT
Comment on attachment 372082 [details]
Patch

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

Oops, had a comment, but forgot to get it to you before you landed this.

> Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:48
> +static inline Ref<const Logger> loggerFromContext(ScriptExecutionContext& context)
> +{
> +    return downcast<Document>(context).logger();
> +}

I’m not sure that a function for this is a good idea. This expression seems not much longer than the function call. I suggest just doing this work inline. It’s good to be able to see the code assuming the context is a document, I think, rather than encapsulating that in a helper.

> Source/WebCore/Modules/mediastream/MediaStream.cpp:54
> +static inline Ref<const Logger> loggerFromContext(ScriptExecutionContext& context)
> +{
> +    return downcast<Document>(context).logger();
> +}

Ditto.
Comment 6 youenn fablet 2019-06-14 17:07:15 PDT
(In reply to Darin Adler from comment #5)
> Comment on attachment 372082 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=372082&action=review
> 
> Oops, had a comment, but forgot to get it to you before you landed this.
> 
> > Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:48
> > +static inline Ref<const Logger> loggerFromContext(ScriptExecutionContext& context)
> > +{
> > +    return downcast<Document>(context).logger();
> > +}
> 
> I’m not sure that a function for this is a good idea. This expression seems
> not much longer than the function call. I suggest just doing this work
> inline. It’s good to be able to see the code assuming the context is a
> document, I think, rather than encapsulating that in a helper.
> 
> > Source/WebCore/Modules/mediastream/MediaStream.cpp:54
> > +static inline Ref<const Logger> loggerFromContext(ScriptExecutionContext& context)
> > +{
> > +    return downcast<Document>(context).logger();
> > +}
> 
> Ditto.

OK, let's make MediaStream take a Document& instead of a ScriptExecutionContext& since code is expecting that elsewhere anyway.
Filed https://bugs.webkit.org/show_bug.cgi?id=198873
Comment 7 youenn fablet 2019-06-15 21:17:27 PDT
It seems we should move logger to ScriptExecutionContext since we might want to do release logging in workers, especially service workers.