[WebRTC] Limit libwebrtc logging in Debug build
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Feb 2017 21:13:46 +0000 (21:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Feb 2017 21:13:46 +0000 (21:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=168974

Patch by Youenn Fablet <youenn@apple.com> on 2017-02-28
Reviewed by Alex Christensen.

Source/WebCore:

Covered by manual testing..

* platform/Logging.h:
* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):

Source/WebKit2:

* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::NetworkRTCProvider):
* Platform/Logging.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213167 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/Logging.h
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/webrtc/NetworkRTCProvider.cpp
Source/WebKit2/Platform/Logging.h

index c1c6f4e..f0f1f59 100644 (file)
@@ -1,3 +1,16 @@
+2017-02-28  Youenn Fablet  <youenn@apple.com>
+
+        [WebRTC] Limit libwebrtc logging in Debug build
+        https://bugs.webkit.org/show_bug.cgi?id=168974
+
+        Reviewed by Alex Christensen.
+
+        Covered by manual testing..
+
+        * platform/Logging.h:
+        * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
+        (WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):
+
 2017-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [macOS] Migrate off of CTFontCreateForCSS
 2017-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [macOS] Migrate off of CTFontCreateForCSS
index a3ccce1..ba577eb 100644 (file)
@@ -87,6 +87,7 @@ namespace WebCore {
     M(URLParser) \
     M(WebAudio) \
     M(WebGL) \
     M(URLParser) \
     M(WebAudio) \
     M(WebGL) \
+    M(WebRTC) \
     M(WebReplay) \
     M(WheelEventTestTriggers) \
 
     M(WebReplay) \
     M(WheelEventTestTriggers) \
 
index 40b36d1..8ed5a5a 100644 (file)
@@ -29,6 +29,7 @@
 #if USE(LIBWEBRTC)
 
 #include "LibWebRTCAudioModule.h"
 #if USE(LIBWEBRTC)
 
 #include "LibWebRTCAudioModule.h"
+#include "Logging.h"
 #include <webrtc/api/peerconnectionfactory.h>
 #include <webrtc/api/peerconnectionfactoryproxy.h>
 #include <webrtc/base/physicalsocketserver.h>
 #include <webrtc/api/peerconnectionfactory.h>
 #include <webrtc/api/peerconnectionfactoryproxy.h>
 #include <webrtc/base/physicalsocketserver.h>
@@ -86,6 +87,9 @@ static void initializePeerConnectionFactoryAndThreads()
 {
 #if defined(NDEBUG)
     rtc::LogMessage::LogToDebug(rtc::LS_NONE);
 {
 #if defined(NDEBUG)
     rtc::LogMessage::LogToDebug(rtc::LS_NONE);
+#else
+    if (LogWebRTC.state != WTFLogChannelOn)
+        rtc::LogMessage::LogToDebug(rtc::LS_WARNING);
 #endif
     auto& factoryAndThreads = staticFactoryAndThreads();
 
 #endif
     auto& factoryAndThreads = staticFactoryAndThreads();
 
index f0c7631..6495efb 100644 (file)
@@ -1,5 +1,16 @@
 2017-02-28  Youenn Fablet  <youenn@apple.com>
 
 2017-02-28  Youenn Fablet  <youenn@apple.com>
 
+        [WebRTC] Limit libwebrtc logging in Debug build
+        https://bugs.webkit.org/show_bug.cgi?id=168974
+
+        Reviewed by Alex Christensen.
+
+        * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
+        (WebKit::NetworkRTCProvider::NetworkRTCProvider):
+        * Platform/Logging.h:
+
+2017-02-28  Youenn Fablet  <youenn@apple.com>
+
         [WebRTC] NetworkRTCProvider should stop the network thread from the main thread
         https://bugs.webkit.org/show_bug.cgi?id=168972
 
         [WebRTC] NetworkRTCProvider should stop the network thread from the main thread
         https://bugs.webkit.org/show_bug.cgi?id=168972
 
index 99b6eb9..024fc97 100644 (file)
@@ -28,6 +28,7 @@
 
 #if USE(LIBWEBRTC)
 
 
 #if USE(LIBWEBRTC)
 
+#include "Logging.h"
 #include "NetworkConnectionToWebProcess.h"
 #include "NetworkProcess.h"
 #include "NetworkRTCSocket.h"
 #include "NetworkConnectionToWebProcess.h"
 #include "NetworkProcess.h"
 #include "NetworkRTCSocket.h"
@@ -55,6 +56,12 @@ NetworkRTCProvider::NetworkRTCProvider(NetworkConnectionToWebProcess& connection
     , m_rtcNetworkThread(createThread())
     , m_packetSocketFactory(makeUniqueRef<rtc::BasicPacketSocketFactory>(m_rtcNetworkThread.get()))
 {
     , m_rtcNetworkThread(createThread())
     , m_packetSocketFactory(makeUniqueRef<rtc::BasicPacketSocketFactory>(m_rtcNetworkThread.get()))
 {
+#if defined(NDEBUG)
+    rtc::LogMessage::LogToDebug(rtc::LS_NONE);
+#else
+    if (WebKit2LogWebRTC.state != WTFLogChannelOn)
+        rtc::LogMessage::LogToDebug(rtc::LS_WARNING);
+#endif
 }
 
 void NetworkRTCProvider::close()
 }
 
 void NetworkRTCProvider::close()
index 76ee680..e75b8aa 100644 (file)
@@ -72,6 +72,7 @@ extern "C" {
     M(ViewState) \
     M(VirtualMemory) \
     M(VisibleRects) \
     M(ViewState) \
     M(VirtualMemory) \
     M(VisibleRects) \
+    M(WebRTC) \
 
 WEBKIT2_LOG_CHANNELS(DECLARE_LOG_CHANNEL)
 
 
 WEBKIT2_LOG_CHANNELS(DECLARE_LOG_CHANNEL)