<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[246436] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/246436">246436</a></dd>
<dt>Author</dt> <dd>youenn@apple.com</dd>
<dt>Date</dt> <dd>2019-06-14 10:14:47 -0700 (Fri, 14 Jun 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Cloning a MediaStreamTrack does not clone the logger
https://bugs.webkit.org/show_bug.cgi?id=198844

Reviewed by Eric Carlson.

Source/WebCore:

Make MediaStream and MediaStreamTrack rely on their private versions for logging.
Move from a RefPtr version to a Ref so as to forbid nullptr crashes.
Make sure that RealtimeIncomingAudioSource and RealtimeIncomingVideoSource check for their logger before logging.
Covered by existing tests and updated test.

* Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
(WebCore::loggerFromContext):
(WebCore::CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack):
* Modules/mediastream/MediaStream.cpp:
(WebCore::loggerFromContext):
(WebCore::MediaStream::create):
(WebCore::MediaStream::MediaStream):
* Modules/mediastream/MediaStream.h:
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::MediaStreamTrack):
* Modules/mediastream/MediaStreamTrack.h:
* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::allow):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::LibWebRTCPeerConnectionBackend::createReceiverForSource):
* Modules/webaudio/MediaStreamAudioDestinationNode.cpp:
(WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode):
* platform/mediastream/MediaStreamPrivate.cpp:
(WebCore::MediaStreamPrivate::create):
(WebCore::MediaStreamPrivate::MediaStreamPrivate):
(WebCore::MediaStreamPrivate::setLogger): Deleted.
* platform/mediastream/MediaStreamPrivate.h:
* platform/mediastream/MediaStreamTrackPrivate.cpp:
(WebCore::MediaStreamTrackPrivate::create):
(WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate):
(WebCore::MediaStreamTrackPrivate::clone):
(WebCore::MediaStreamTrackPrivate::setLogger): Deleted.
* platform/mediastream/MediaStreamTrackPrivate.h:
* platform/mediastream/RealtimeMediaSourceCenter.cpp:
(WebCore::RealtimeMediaSourceCenter::createMediaStream):
* platform/mediastream/RealtimeMediaSourceCenter.h:
* platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
(WebCore::RealtimeIncomingAudioSourceCocoa::OnData):
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
(WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferPool):
(WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
(WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):

LayoutTests:

* fast/mediastream/MediaStreamTrack-clone-expected.txt:
* fast/mediastream/MediaStreamTrack-clone.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastmediastreamMediaStreamTrackcloneexpectedtxt">trunk/LayoutTests/fast/mediastream/MediaStreamTrack-clone-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmediastreamMediaStreamTrackclonehtml">trunk/LayoutTests/fast/mediastream/MediaStreamTrack-clone.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamCanvasCaptureMediaStreamTrackcpp">trunk/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaStreamcpp">trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaStreamh">trunk/Source/WebCore/Modules/mediastream/MediaStream.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaStreamTrackcpp">trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaStreamTrackh">trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamUserMediaRequestcpp">trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamlibwebrtcLibWebRTCMediaEndpointcpp">trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamlibwebrtcLibWebRTCPeerConnectionBackendcpp">trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioMediaStreamAudioDestinationNodecpp">trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamPrivatecpp">trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamPrivateh">trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivatecpp">trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivateh">trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeMediaSourceCentercpp">trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeMediaSourceCenterh">trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacRealtimeIncomingAudioSourceCocoacpp">trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacRealtimeIncomingVideoSourceCocoamm">trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/LayoutTests/ChangeLog 2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2019-06-14  Youenn Fablet  <youenn@apple.com>
+
+        Cloning a MediaStreamTrack does not clone the logger
+        https://bugs.webkit.org/show_bug.cgi?id=198844
+
+        Reviewed by Eric Carlson.
+
+        * fast/mediastream/MediaStreamTrack-clone-expected.txt:
+        * fast/mediastream/MediaStreamTrack-clone.html:
+
</ins><span class="cx"> 2019-06-14  Shawn Roberts  <sroberts@apple.com>
</span><span class="cx"> 
</span><span class="cx">         webgpu/compute-squares.html test was deleted in https://trac.webkit.org/changeset/246427
</span></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamMediaStreamTrackcloneexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/mediastream/MediaStreamTrack-clone-expected.txt (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/MediaStreamTrack-clone-expected.txt   2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/LayoutTests/fast/mediastream/MediaStreamTrack-clone-expected.txt      2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -20,6 +20,7 @@
</span><span class="cx"> PASS videoTrack.onended is not videoTrack2.onended
</span><span class="cx"> PASS videoTrack.onoverconstrained is not videoTrack2.onoverconstrained
</span><span class="cx"> PASS videoTrack.readyState is not videoTrack2.readyState
</span><ins>+PASS videoTrack.readyState is videoTrack3.readyState
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamMediaStreamTrackclonehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/mediastream/MediaStreamTrack-clone.html (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/MediaStreamTrack-clone.html   2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/LayoutTests/fast/mediastream/MediaStreamTrack-clone.html      2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -7,6 +7,7 @@
</span><span class="cx">             var mediaStream;
</span><span class="cx">             var videoTrack;
</span><span class="cx">             var videoTrack2;
</span><ins>+            var videoTrack3;
</ins><span class="cx">             var audioTrack;
</span><span class="cx"> 
</span><span class="cx">             function gotStream(stream) {
</span><span class="lines">@@ -40,6 +41,9 @@
</span><span class="cx">                 videoTrack.stop();
</span><span class="cx">                 shouldNotBe('videoTrack.readyState', 'videoTrack2.readyState');
</span><span class="cx"> 
</span><ins>+                videoTrack3 = videoTrack.clone();
+                shouldBe('videoTrack.readyState', 'videoTrack3.readyState');
+
</ins><span class="cx">                 finishJSTest();
</span><span class="cx">             }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/ChangeLog      2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2019-06-14  Youenn Fablet  <youenn@apple.com>
+
+        Cloning a MediaStreamTrack does not clone the logger
+        https://bugs.webkit.org/show_bug.cgi?id=198844
+
+        Reviewed by Eric Carlson.
+
+        Make MediaStream and MediaStreamTrack rely on their private versions for logging.
+        Move from a RefPtr version to a Ref so as to forbid nullptr crashes.
+        Make sure that RealtimeIncomingAudioSource and RealtimeIncomingVideoSource check for their logger before logging.
+        Covered by existing tests and updated test.
+
+        * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
+        (WebCore::loggerFromContext):
+        (WebCore::CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack):
+        * Modules/mediastream/MediaStream.cpp:
+        (WebCore::loggerFromContext):
+        (WebCore::MediaStream::create):
+        (WebCore::MediaStream::MediaStream):
+        * Modules/mediastream/MediaStream.h:
+        * Modules/mediastream/MediaStreamTrack.cpp:
+        (WebCore::MediaStreamTrack::MediaStreamTrack):
+        * Modules/mediastream/MediaStreamTrack.h:
+        * Modules/mediastream/UserMediaRequest.cpp:
+        (WebCore::UserMediaRequest::allow):
+        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+        (WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
+        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
+        (WebCore::LibWebRTCPeerConnectionBackend::createReceiverForSource):
+        * Modules/webaudio/MediaStreamAudioDestinationNode.cpp:
+        (WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode):
+        * platform/mediastream/MediaStreamPrivate.cpp:
+        (WebCore::MediaStreamPrivate::create):
+        (WebCore::MediaStreamPrivate::MediaStreamPrivate):
+        (WebCore::MediaStreamPrivate::setLogger): Deleted.
+        * platform/mediastream/MediaStreamPrivate.h:
+        * platform/mediastream/MediaStreamTrackPrivate.cpp:
+        (WebCore::MediaStreamTrackPrivate::create):
+        (WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate):
+        (WebCore::MediaStreamTrackPrivate::clone):
+        (WebCore::MediaStreamTrackPrivate::setLogger): Deleted.
+        * platform/mediastream/MediaStreamTrackPrivate.h:
+        * platform/mediastream/RealtimeMediaSourceCenter.cpp:
+        (WebCore::RealtimeMediaSourceCenter::createMediaStream):
+        * platform/mediastream/RealtimeMediaSourceCenter.h:
+        * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
+        (WebCore::RealtimeIncomingAudioSourceCocoa::OnData):
+        * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
+        (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferPool):
+        (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
+        (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
+
</ins><span class="cx"> 2019-06-14  Ali Juma  <ajuma@chromium.org>
</span><span class="cx"> 
</span><span class="cx">         IntersectionObserver rootMargin detection fails when `root` is an element
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamCanvasCaptureMediaStreamTrackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp       2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp  2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -42,8 +42,13 @@
</span><span class="cx">     return adoptRef(*new CanvasCaptureMediaStreamTrack(context, WTFMove(canvas), WTFMove(source)));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline Ref<const Logger> loggerFromContext(ScriptExecutionContext& context)
+{
+    return downcast<Document>(context).logger();
+}
+
</ins><span class="cx"> CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack(ScriptExecutionContext& context, Ref<HTMLCanvasElement>&& canvas, Ref<CanvasCaptureMediaStreamTrack::Source>&& source)
</span><del>-    : MediaStreamTrack(context, MediaStreamTrackPrivate::create(source.copyRef()))
</del><ins>+    : MediaStreamTrack(context, MediaStreamTrackPrivate::create(loggerFromContext(context), source.copyRef()))
</ins><span class="cx">     , m_canvas(WTFMove(canvas))
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaStreamcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp 2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp    2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -48,9 +48,14 @@
</span><span class="cx"> 
</span><span class="cx"> WTF_MAKE_ISO_ALLOCATED_IMPL(MediaStream);
</span><span class="cx"> 
</span><ins>+static inline Ref<const Logger> loggerFromContext(ScriptExecutionContext& context)
+{
+    return downcast<Document>(context).logger();
+}
+
</ins><span class="cx"> Ref<MediaStream> MediaStream::create(ScriptExecutionContext& context)
</span><span class="cx"> {
</span><del>-    return MediaStream::create(context, MediaStreamPrivate::create({ }));
</del><ins>+    return MediaStream::create(context, MediaStreamPrivate::create(loggerFromContext(context), { }));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Ref<MediaStream> MediaStream::create(ScriptExecutionContext& context, MediaStream& stream)
</span><span class="lines">@@ -79,21 +84,12 @@
</span><span class="cx"> 
</span><span class="cx"> MediaStream::MediaStream(ScriptExecutionContext& context, const MediaStreamTrackVector& tracks)
</span><span class="cx">     : ActiveDOMObject(&context)
</span><del>-    , m_private(MediaStreamPrivate::create(createTrackPrivateVector(tracks)))
</del><ins>+    , m_private(MediaStreamPrivate::create(document()->logger(), createTrackPrivateVector(tracks)))
</ins><span class="cx">     , m_mediaSession(PlatformMediaSession::create(*this))
</span><del>-#if !RELEASE_LOG_DISABLED
-    , m_logger(document()->logger())
-    , m_logIdentifier(uniqueLogIdentifier())
-#endif
</del><span class="cx"> {
</span><span class="cx">     // This constructor preserves MediaStreamTrack instances and must be used by calls originating
</span><span class="cx">     // from the JavaScript MediaStream constructor.
</span><span class="cx"> 
</span><del>-#if !RELEASE_LOG_DISABLED
-    ALWAYS_LOG(LOGIDENTIFIER);
-    m_private->setLogger(logger(), logIdentifier());
-#endif
-
</del><span class="cx">     for (auto& track : tracks) {
</span><span class="cx">         track->addObserver(*this);
</span><span class="cx">         m_trackSet.add(track->id(), track);
</span><span class="lines">@@ -109,15 +105,9 @@
</span><span class="cx">     : ActiveDOMObject(&context)
</span><span class="cx">     , m_private(WTFMove(streamPrivate))
</span><span class="cx">     , m_mediaSession(PlatformMediaSession::create(*this))
</span><del>-#if !RELEASE_LOG_DISABLED
-    , m_logger(document()->logger())
-    , m_logIdentifier(uniqueLogIdentifier())
-#endif
</del><span class="cx"> {
</span><del>-#if !RELEASE_LOG_DISABLED
</del><span class="cx">     ALWAYS_LOG(LOGIDENTIFIER);
</span><del>-    m_private->setLogger(logger(), logIdentifier());
-#endif
</del><ins>+
</ins><span class="cx">     setIsActive(m_private->active());
</span><span class="cx">     m_private->addObserver(*this);
</span><span class="cx">     MediaStreamRegistry::shared().registerStream(*this);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaStreamh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaStream.h (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaStream.h   2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStream.h      2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -125,8 +125,8 @@
</span><span class="cx">     MediaStream(ScriptExecutionContext&, Ref<MediaStreamPrivate>&&);
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><del>-    const Logger& logger() const final { return m_logger.get(); }
-    const void* logIdentifier() const final { return m_logIdentifier; }
</del><ins>+    const Logger& logger() const final { return m_private->logger(); }
+    const void* logIdentifier() const final { return m_private->logIdentifier(); }
</ins><span class="cx">     WTFLogChannel& logChannel() const final;
</span><span class="cx">     const char* logClassName() const final { return "MediaStream"; }
</span><span class="cx"> #endif
</span><span class="lines">@@ -187,11 +187,6 @@
</span><span class="cx"> 
</span><span class="cx">     MediaProducer::MediaStateFlags m_state { MediaProducer::IsNotPlaying };
</span><span class="cx"> 
</span><del>-#if !RELEASE_LOG_DISABLED
-    Ref<Logger> m_logger;
-    const void* m_logIdentifier;
-#endif
-
</del><span class="cx">     bool m_isActive { false };
</span><span class="cx">     bool m_isProducingData { false };
</span><span class="cx">     bool m_isWaitingUntilMediaCanStart { false };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaStreamTrackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp    2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp       2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -58,10 +58,6 @@
</span><span class="cx"> MediaStreamTrack::MediaStreamTrack(ScriptExecutionContext& context, Ref<MediaStreamTrackPrivate>&& privateTrack)
</span><span class="cx">     : ActiveDOMObject(&context)
</span><span class="cx">     , m_private(WTFMove(privateTrack))
</span><del>-#if !RELEASE_LOG_DISABLED
-    , m_logger(document()->logger())
-    , m_logIdentifier(uniqueLogIdentifier())
-#endif
</del><span class="cx">     , m_taskQueue(context)
</span><span class="cx">     , m_isCaptureTrack(m_private->isCaptureTrack())
</span><span class="cx"> {
</span><span class="lines">@@ -68,9 +64,6 @@
</span><span class="cx">     ALWAYS_LOG(LOGIDENTIFIER);
</span><span class="cx">     suspendIfNeeded();
</span><span class="cx"> 
</span><del>-#if !RELEASE_LOG_DISABLED
-    m_private->setLogger(logger(), logIdentifier());
-#endif
</del><span class="cx">     m_private->addObserver(*this);
</span><span class="cx"> 
</span><span class="cx">     if (auto document = this->document()) {
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaStreamTrackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h      2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h 2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -151,8 +151,8 @@
</span><span class="cx">     void setIdForTesting(String&& id) { m_private->setIdForTesting(WTFMove(id)); }
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><del>-    const Logger& logger() const final { return m_logger.get(); }
-    const void* logIdentifier() const final { return m_logIdentifier; }
</del><ins>+    const Logger& logger() const final { return m_private->logger(); }
+    const void* logIdentifier() const final { return m_private->logIdentifier(); }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="lines">@@ -189,9 +189,6 @@
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     const char* logClassName() const final { return "MediaStreamTrack"; }
</span><span class="cx">     WTFLogChannel& logChannel() const final;
</span><del>-    
-    Ref<const Logger> m_logger;
-    const void* m_logIdentifier;
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     Vector<Observer*> m_observers;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamUserMediaRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp    2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp       2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -246,7 +246,7 @@
</span><span class="cx">     auto& document = downcast<Document>(*scriptExecutionContext());
</span><span class="cx">     document.setDeviceIDHashSalt(deviceIdentifierHashSalt);
</span><span class="cx"> 
</span><del>-    RealtimeMediaSourceCenter::singleton().createMediaStream(WTFMove(callback), WTFMove(deviceIdentifierHashSalt), WTFMove(audioDevice), WTFMove(videoDevice), m_request);
</del><ins>+    RealtimeMediaSourceCenter::singleton().createMediaStream(document.logger(), WTFMove(callback), WTFMove(deviceIdentifierHashSalt), WTFMove(audioDevice), WTFMove(videoDevice), m_request);
</ins><span class="cx"> 
</span><span class="cx">     if (!m_scriptExecutionContext)
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamlibwebrtcLibWebRTCMediaEndpointcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp    2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp       2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -354,7 +354,8 @@
</span><span class="cx"> {
</span><span class="cx">     auto label = fromStdString(rtcStream.id());
</span><span class="cx">     auto mediaStream = m_remoteStreamsById.ensure(label, [label, this]() mutable {
</span><del>-        return MediaStream::create(*m_peerConnectionBackend.connection().scriptExecutionContext(), MediaStreamPrivate::create({ }, WTFMove(label)));
</del><ins>+        auto& document = downcast<Document>(*m_peerConnectionBackend.connection().scriptExecutionContext());
+        return MediaStream::create(document, MediaStreamPrivate::create(document.logger(), { }, WTFMove(label)));
</ins><span class="cx">     });
</span><span class="cx">     return *mediaStream.iterator->value;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamlibwebrtcLibWebRTCPeerConnectionBackendcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp    2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp       2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -269,9 +269,10 @@
</span><span class="cx"> 
</span><span class="cx"> Ref<RTCRtpReceiver> LibWebRTCPeerConnectionBackend::createReceiverForSource(Ref<RealtimeMediaSource>&& source, std::unique_ptr<RTCRtpReceiverBackend>&& backend)
</span><span class="cx"> {
</span><del>-    String trackID = source->persistentID();
-    auto remoteTrackPrivate = MediaStreamTrackPrivate::create(WTFMove(source), WTFMove(trackID));
-    auto remoteTrack = MediaStreamTrack::create(*m_peerConnection.scriptExecutionContext(), WTFMove(remoteTrackPrivate));
</del><ins>+    auto& document = downcast<Document>(*m_peerConnection.scriptExecutionContext());
+    auto trackID = source->persistentID();
+    auto remoteTrackPrivate = MediaStreamTrackPrivate::create(document.logger(), WTFMove(source), WTFMove(trackID));
+    auto remoteTrack = MediaStreamTrack::create(document, WTFMove(remoteTrackPrivate));
</ins><span class="cx"> 
</span><span class="cx">     return RTCRtpReceiver::create(*this, WTFMove(remoteTrack), WTFMove(backend));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioMediaStreamAudioDestinationNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp        2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp   2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx"> MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AudioContext& context, size_t numberOfChannels)
</span><span class="cx">     : AudioBasicInspectorNode(context, context.sampleRate(), numberOfChannels)
</span><span class="cx">     , m_source(MediaStreamAudioSource::create(context.sampleRate()))
</span><del>-    , m_stream(MediaStream::create(*context.document(), MediaStreamPrivate::create(m_source.copyRef())))
</del><ins>+    , m_stream(MediaStream::create(*context.document(), MediaStreamPrivate::create(context.document()->logger(), m_source.copyRef())))
</ins><span class="cx"> {
</span><span class="cx">     setNodeType(NodeTypeMediaStreamAudioDestination);
</span><span class="cx">     initialize();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamPrivatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp 2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp    2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -45,28 +45,34 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-Ref<MediaStreamPrivate> MediaStreamPrivate::create(Ref<RealtimeMediaSource>&& source)
</del><ins>+Ref<MediaStreamPrivate> MediaStreamPrivate::create(Ref<const Logger>&& logger, Ref<RealtimeMediaSource>&& source)
</ins><span class="cx"> {
</span><del>-    return MediaStreamPrivate::create(MediaStreamTrackPrivateVector::from(MediaStreamTrackPrivate::create(WTFMove(source))));
</del><ins>+    auto loggerCopy = logger.copyRef();
+    return MediaStreamPrivate::create(WTFMove(logger), MediaStreamTrackPrivateVector::from(MediaStreamTrackPrivate::create(WTFMove(loggerCopy), WTFMove(source))));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref<MediaStreamPrivate> MediaStreamPrivate::create(const Vector<Ref<RealtimeMediaSource>>& audioSources, const Vector<Ref<RealtimeMediaSource>>& videoSources)
</del><ins>+Ref<MediaStreamPrivate> MediaStreamPrivate::create(Ref<const Logger>&& logger, const Vector<Ref<RealtimeMediaSource>>& audioSources, const Vector<Ref<RealtimeMediaSource>>& videoSources)
</ins><span class="cx"> {
</span><span class="cx">     MediaStreamTrackPrivateVector tracks;
</span><span class="cx">     tracks.reserveInitialCapacity(audioSources.size() + videoSources.size());
</span><span class="cx"> 
</span><span class="cx">     for (auto& source : audioSources)
</span><del>-        tracks.uncheckedAppend(MediaStreamTrackPrivate::create(source.copyRef()));
</del><ins>+        tracks.uncheckedAppend(MediaStreamTrackPrivate::create(logger.copyRef(), source.copyRef()));
</ins><span class="cx"> 
</span><span class="cx">     for (auto& source : videoSources)
</span><del>-        tracks.uncheckedAppend(MediaStreamTrackPrivate::create(source.copyRef()));
</del><ins>+        tracks.uncheckedAppend(MediaStreamTrackPrivate::create(logger.copyRef(), source.copyRef()));
</ins><span class="cx"> 
</span><del>-    return MediaStreamPrivate::create(tracks);
</del><ins>+    return MediaStreamPrivate::create(WTFMove(logger), tracks);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaStreamPrivate::MediaStreamPrivate(const MediaStreamTrackPrivateVector& tracks, String&& id)
</del><ins>+MediaStreamPrivate::MediaStreamPrivate(Ref<const Logger>&& logger, const MediaStreamTrackPrivateVector& tracks, String&& id)
</ins><span class="cx">     : m_id(WTFMove(id))
</span><ins>+#if !RELEASE_LOG_DISABLED
+    , m_logger(WTFMove(logger))
+    , m_logIdentifier(uniqueLogIdentifier())
+#endif
</ins><span class="cx"> {
</span><ins>+    UNUSED_PARAM(logger);
</ins><span class="cx">     ASSERT(!m_id.isEmpty());
</span><span class="cx"> 
</span><span class="cx">     for (auto& track : tracks) {
</span><span class="lines">@@ -345,13 +351,6 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><del>-void MediaStreamPrivate::setLogger(const Logger& newLogger, const void* newLogIdentifier)
-{
-    m_logger = &newLogger;
-    m_logIdentifier = newLogIdentifier;
-    ALWAYS_LOG(LOGIDENTIFIER);
-}
-
</del><span class="cx"> WTFLogChannel& MediaStreamPrivate::logChannel() const
</span><span class="cx"> {
</span><span class="cx">     return LogWebRTC;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h   2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h      2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -73,9 +73,9 @@
</span><span class="cx">         virtual void didRemoveTrack(MediaStreamTrackPrivate&) { }
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    static Ref<MediaStreamPrivate> create(Ref<RealtimeMediaSource>&&);
-    static Ref<MediaStreamPrivate> create(const Vector<Ref<RealtimeMediaSource>>& audioSources, const Vector<Ref<RealtimeMediaSource>>& videoSources);
-    static Ref<MediaStreamPrivate> create(const MediaStreamTrackPrivateVector& tracks, String&& id = createCanonicalUUIDString()) { return adoptRef(*new MediaStreamPrivate(tracks, WTFMove(id))); }
</del><ins>+    static Ref<MediaStreamPrivate> create(Ref<const Logger>&&, Ref<RealtimeMediaSource>&&);
+    static Ref<MediaStreamPrivate> create(Ref<const Logger>&&, const Vector<Ref<RealtimeMediaSource>>& audioSources, const Vector<Ref<RealtimeMediaSource>>& videoSources);
+    static Ref<MediaStreamPrivate> create(Ref<const Logger>&& logger, const MediaStreamTrackPrivateVector& tracks, String&& id = createCanonicalUUIDString()) { return adoptRef(*new MediaStreamPrivate(WTFMove(logger), tracks, WTFMove(id))); }
</ins><span class="cx"> 
</span><span class="cx">     virtual ~MediaStreamPrivate();
</span><span class="cx"> 
</span><span class="lines">@@ -111,11 +111,12 @@
</span><span class="cx">     void monitorOrientation(OrientationNotifier&);
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><del>-    void setLogger(const Logger&, const void*);
</del><ins>+    const Logger& logger() const final { return m_logger; }
+    const void* logIdentifier() const final { return m_logIdentifier; }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    MediaStreamPrivate(const MediaStreamTrackPrivateVector&, String&&);
</del><ins>+    MediaStreamPrivate(Ref<const Logger>&&, const MediaStreamTrackPrivateVector&, String&&);
</ins><span class="cx"> 
</span><span class="cx">     // MediaStreamTrackPrivate::Observer
</span><span class="cx">     void trackStarted(MediaStreamTrackPrivate&) override;
</span><span class="lines">@@ -131,13 +132,8 @@
</span><span class="cx">     void forEachObserver(const WTF::Function<void(Observer&)>&) const;
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><del>-    const Logger& logger() const final { ASSERT(m_logger); return *m_logger.get(); }
-    const void* logIdentifier() const final { return m_logIdentifier; }
</del><span class="cx">     const char* logClassName() const final { return "MediaStreamPrivate"; }
</span><span class="cx">     WTFLogChannel& logChannel() const final;
</span><del>-
-    RefPtr<const Logger> m_logger;
-    const void* m_logIdentifier;
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     HashSet<Observer*> m_observers;
</span><span class="lines">@@ -145,6 +141,10 @@
</span><span class="cx">     MediaStreamTrackPrivate* m_activeVideoTrack { nullptr };
</span><span class="cx">     HashMap<String, RefPtr<MediaStreamTrackPrivate>> m_trackSet;
</span><span class="cx">     bool m_isActive { false };
</span><ins>+#if !RELEASE_LOG_DISABLED
+    Ref<const Logger> m_logger;
+    const void* m_logIdentifier;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> typedef Vector<RefPtr<MediaStreamPrivate>> MediaStreamPrivateVector;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp    2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp       2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -44,20 +44,28 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-Ref<MediaStreamTrackPrivate> MediaStreamTrackPrivate::create(Ref<RealtimeMediaSource>&& source)
</del><ins>+Ref<MediaStreamTrackPrivate> MediaStreamTrackPrivate::create(Ref<const Logger>&& logger, Ref<RealtimeMediaSource>&& source)
</ins><span class="cx"> {
</span><del>-    return create(WTFMove(source), createCanonicalUUIDString());
</del><ins>+    return create(WTFMove(logger), WTFMove(source), createCanonicalUUIDString());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref<MediaStreamTrackPrivate> MediaStreamTrackPrivate::create(Ref<RealtimeMediaSource>&& source, String&& id)
</del><ins>+Ref<MediaStreamTrackPrivate> MediaStreamTrackPrivate::create(Ref<const Logger>&& logger, Ref<RealtimeMediaSource>&& source, String&& id)
</ins><span class="cx"> {
</span><del>-    return adoptRef(*new MediaStreamTrackPrivate(WTFMove(source), WTFMove(id)));
</del><ins>+    return adoptRef(*new MediaStreamTrackPrivate(WTFMove(logger), WTFMove(source), WTFMove(id)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaStreamTrackPrivate::MediaStreamTrackPrivate(Ref<RealtimeMediaSource>&& source, String&& id)
</del><ins>+MediaStreamTrackPrivate::MediaStreamTrackPrivate(Ref<const Logger>&& logger, Ref<RealtimeMediaSource>&& source, String&& id)
</ins><span class="cx">     : m_source(WTFMove(source))
</span><span class="cx">     , m_id(WTFMove(id))
</span><ins>+    , m_logger(WTFMove(logger))
+#if !RELEASE_LOG_DISABLED
+    , m_logIdentifier(uniqueLogIdentifier())
+#endif
</ins><span class="cx"> {
</span><ins>+    UNUSED_PARAM(logger);
+#if !RELEASE_LOG_DISABLED
+    m_source->setLogger(m_logger.copyRef(), m_logIdentifier);
+#endif
</ins><span class="cx">     m_source->addObserver(*this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -147,7 +155,8 @@
</span><span class="cx"> 
</span><span class="cx"> Ref<MediaStreamTrackPrivate> MediaStreamTrackPrivate::clone()
</span><span class="cx"> {
</span><del>-    auto clonedMediaStreamTrackPrivate = create(m_source.copyRef());
</del><ins>+    auto clonedMediaStreamTrackPrivate = create(m_logger.copyRef(), m_source.copyRef());
+
</ins><span class="cx">     clonedMediaStreamTrackPrivate->m_isEnabled = this->m_isEnabled;
</span><span class="cx">     clonedMediaStreamTrackPrivate->m_isEnded = this->m_isEnded;
</span><span class="cx">     clonedMediaStreamTrackPrivate->m_contentHint = this->m_contentHint;
</span><span class="lines">@@ -279,14 +288,6 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><del>-void MediaStreamTrackPrivate::setLogger(const Logger& newLogger, const void* newLogIdentifier)
-{
-    m_logger = &newLogger;
-    m_logIdentifier = newLogIdentifier;
-    ALWAYS_LOG(LOGIDENTIFIER);
-    m_source->setLogger(newLogger, newLogIdentifier);
-}
-
</del><span class="cx"> WTFLogChannel& MediaStreamTrackPrivate::logChannel() const
</span><span class="cx"> {
</span><span class="cx">     return LogWebRTC;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h      2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h 2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -64,8 +64,8 @@
</span><span class="cx">         virtual void audioSamplesAvailable(MediaStreamTrackPrivate&, const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) { };
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    static Ref<MediaStreamTrackPrivate> create(Ref<RealtimeMediaSource>&&);
-    static Ref<MediaStreamTrackPrivate> create(Ref<RealtimeMediaSource>&&, String&& id);
</del><ins>+    static Ref<MediaStreamTrackPrivate> create(Ref<const Logger>&&, Ref<RealtimeMediaSource>&&);
+    static Ref<MediaStreamTrackPrivate> create(Ref<const Logger>&&, Ref<RealtimeMediaSource>&&, String&& id);
</ins><span class="cx"> 
</span><span class="cx">     virtual ~MediaStreamTrackPrivate();
</span><span class="cx"> 
</span><span class="lines">@@ -117,13 +117,12 @@
</span><span class="cx">     void setIdForTesting(String&& id) { m_id = WTFMove(id); }
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><del>-    void setLogger(const Logger&, const void*);
-    const Logger& logger() const final { ASSERT(m_logger); return *m_logger.get(); }
</del><ins>+    const Logger& logger() const final { return m_logger; }
</ins><span class="cx">     const void* logIdentifier() const final { return m_logIdentifier; }
</span><span class="cx"> #endif
</span><del>-    
</del><ins>+
</ins><span class="cx"> private:
</span><del>-    MediaStreamTrackPrivate(Ref<RealtimeMediaSource>&&, String&& id);
</del><ins>+    MediaStreamTrackPrivate(Ref<const Logger>&&, Ref<RealtimeMediaSource>&&, String&& id);
</ins><span class="cx"> 
</span><span class="cx">     // RealtimeMediaSourceObserver
</span><span class="cx">     void sourceStarted() final;
</span><span class="lines">@@ -141,9 +140,6 @@
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     const char* logClassName() const final { return "MediaStreamTrackPrivate"; }
</span><span class="cx">     WTFLogChannel& logChannel() const final;
</span><del>-
-    RefPtr<const Logger> m_logger;
-    const void* m_logIdentifier;
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     mutable RecursiveLock m_observersLock;
</span><span class="lines">@@ -157,6 +153,10 @@
</span><span class="cx">     bool m_haveProducedData { false };
</span><span class="cx">     HintValue m_contentHint { HintValue::Empty };
</span><span class="cx">     RefPtr<WebAudioSourceProvider> m_audioSourceProvider;
</span><ins>+    Ref<const Logger> m_logger;
+#if !RELEASE_LOG_DISABLED
+    const void* m_logIdentifier;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> typedef Vector<RefPtr<MediaStreamTrackPrivate>> MediaStreamTrackPrivateVector;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeMediaSourceCentercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp  2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp     2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx"> 
</span><span class="cx"> RealtimeMediaSourceCenter::~RealtimeMediaSourceCenter() = default;
</span><span class="cx"> 
</span><del>-void RealtimeMediaSourceCenter::createMediaStream(NewMediaStreamHandler&& completionHandler, String&& hashSalt, CaptureDevice&& audioDevice, CaptureDevice&& videoDevice, const MediaStreamRequest& request)
</del><ins>+void RealtimeMediaSourceCenter::createMediaStream(Ref<const Logger>&& logger, NewMediaStreamHandler&& completionHandler, String&& hashSalt, CaptureDevice&& audioDevice, CaptureDevice&& videoDevice, const MediaStreamRequest& request)
</ins><span class="cx"> {
</span><span class="cx">     Vector<Ref<RealtimeMediaSource>> audioSources;
</span><span class="cx">     Vector<Ref<RealtimeMediaSource>> videoSources;
</span><span class="lines">@@ -102,7 +102,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    completionHandler(MediaStreamPrivate::create(audioSources, videoSources));
</del><ins>+    completionHandler(MediaStreamPrivate::create(WTFMove(logger), audioSources, videoSources));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Vector<CaptureDevice> RealtimeMediaSourceCenter::getMediaStreamDevices()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeMediaSourceCenterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h    2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h       2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -59,12 +59,12 @@
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT static RealtimeMediaSourceCenter& singleton();
</span><span class="cx"> 
</span><del>-    using ValidConstraintsHandler = WTF::Function<void(Vector<CaptureDevice>&& audioDeviceUIDs, Vector<CaptureDevice>&& videoDeviceUIDs, String&&)>;
-    using InvalidConstraintsHandler = WTF::Function<void(const String& invalidConstraint)>;
</del><ins>+    using ValidConstraintsHandler = Function<void(Vector<CaptureDevice>&& audioDeviceUIDs, Vector<CaptureDevice>&& videoDeviceUIDs, String&&)>;
+    using InvalidConstraintsHandler = Function<void(const String& invalidConstraint)>;
</ins><span class="cx">     WEBCORE_EXPORT void validateRequestConstraints(ValidConstraintsHandler&&, InvalidConstraintsHandler&&, const MediaStreamRequest&, String&&);
</span><span class="cx"> 
</span><del>-    using NewMediaStreamHandler = WTF::Function<void(RefPtr<MediaStreamPrivate>&&)>;
-    void createMediaStream(NewMediaStreamHandler&&, String&&, CaptureDevice&& audioDevice, CaptureDevice&& videoDevice, const MediaStreamRequest&);
</del><ins>+    using NewMediaStreamHandler = Function<void(RefPtr<MediaStreamPrivate>&&)>;
+    void createMediaStream(Ref<const Logger>&&, NewMediaStreamHandler&&, String&&, CaptureDevice&& audioDevice, CaptureDevice&& videoDevice, const MediaStreamRequest&);
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT Vector<CaptureDevice> getMediaStreamDevices();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacRealtimeIncomingAudioSourceCocoacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp       2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp  2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     if (!(++m_chunksReceived % 200))
</span><del>-        ALWAYS_LOG(LOGIDENTIFIER, "chunk ", m_chunksReceived);
</del><ins>+        ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "chunk ", m_chunksReceived);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     audioSamplesAvailable(mediaTime, audioBufferList, CAAudioStreamDescription(newDescription), numberOfFrames);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacRealtimeIncomingVideoSourceCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm (246435 => 246436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm        2019-06-14 17:12:07 UTC (rev 246435)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm   2019-06-14 17:14:47 UTC (rev 246436)
</span><span class="lines">@@ -113,7 +113,7 @@
</span><span class="cx">         auto status = CVPixelBufferPoolCreate(kCFAllocatorDefault, nullptr, (__bridge CFDictionaryRef)pixelAttributes, &pool);
</span><span class="cx"> 
</span><span class="cx">         if (status != kCVReturnSuccess) {
</span><del>-            ERROR_LOG(LOGIDENTIFIER, "Failed creating a pixel buffer pool with error ", status);
</del><ins>+            ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "Failed creating a pixel buffer pool with error ", status);
</ins><span class="cx">             return nullptr;
</span><span class="cx">         }
</span><span class="cx">         m_pixelBufferPool = adoptCF(pool);
</span><span class="lines">@@ -144,7 +144,7 @@
</span><span class="cx">         auto status = CVPixelBufferPoolCreatePixelBuffer(kCFAllocatorDefault, m_pixelBufferPool.get(), &pixelBuffer);
</span><span class="cx"> 
</span><span class="cx">         if (status != kCVReturnSuccess) {
</span><del>-            ERROR_LOG(LOGIDENTIFIER, "Failed creating a pixel buffer with error ", status);
</del><ins>+            ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "Failed creating a pixel buffer with error ", status);
</ins><span class="cx">             return nullptr;
</span><span class="cx">         }
</span><span class="cx">         newPixelBuffer = adoptCF(pixelBuffer);
</span><span class="lines">@@ -159,12 +159,12 @@
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     if (!(++m_numberOfFrames % 60))
</span><del>-        ALWAYS_LOG(LOGIDENTIFIER, "frame ", m_numberOfFrames);
</del><ins>+        ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "frame ", m_numberOfFrames);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     auto pixelBuffer = pixelBufferFromVideoFrame(frame);
</span><span class="cx">     if (!pixelBuffer) {
</span><del>-        ERROR_LOG(LOGIDENTIFIER, "Failed to get a pixel buffer from a frame");
</del><ins>+        ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "Failed to get a pixel buffer from a frame");
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -178,7 +178,7 @@
</span><span class="cx">     CMVideoFormatDescriptionRef formatDescription;
</span><span class="cx">     OSStatus ostatus = CMVideoFormatDescriptionCreateForImageBuffer(kCFAllocatorDefault, (CVImageBufferRef)pixelBuffer, &formatDescription);
</span><span class="cx">     if (ostatus != noErr) {
</span><del>-        ERROR_LOG(LOGIDENTIFIER, "Failed to initialize CMVideoFormatDescription with error ", static_cast<int>(ostatus));
</del><ins>+        ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "Failed to initialize CMVideoFormatDescription with error ", static_cast<int>(ostatus));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -186,7 +186,7 @@
</span><span class="cx">     ostatus = CMSampleBufferCreateReadyWithImageBuffer(kCFAllocatorDefault, (CVImageBufferRef)pixelBuffer, formatDescription, &timingInfo, &sampleBuffer);
</span><span class="cx">     CFRelease(formatDescription);
</span><span class="cx">     if (ostatus != noErr) {
</span><del>-        ERROR_LOG(LOGIDENTIFIER, "Failed to create the sample buffer with error ", static_cast<int>(ostatus));
</del><ins>+        ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "Failed to create the sample buffer with error ", static_cast<int>(ostatus));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>