Title: [231512] trunk/Source/WebCore
- Revision
- 231512
- Author
- [email protected]
- Date
- 2018-05-08 14:22:30 -0700 (Tue, 08 May 2018)
Log Message
Log rtcstats as JSON
https://bugs.webkit.org/show_bug.cgi?id=185437
<rdar://problem/40065332>
Reviewed by Youenn Fablet.
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::RTCStatsLogger::RTCStatsLogger): Create a wrapper class so we don't have to add a
toJSONString method to libwebrtc.
(WebCore::RTCStatsLogger::toJSONString const): Log stats as JSON.
(WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): Don't use the LOGIDENTIFIER macro because
it doesn't work well inside of a lambda.
(WTF::LogArgument<WebCore::RTCStatsLogger>::toString): Move into .cpp file because it is only
used here.
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
(WTF::LogArgument<webrtc::RTCStats>::toString): Deleted. Move to .cpp file.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (231511 => 231512)
--- trunk/Source/WebCore/ChangeLog 2018-05-08 21:19:36 UTC (rev 231511)
+++ trunk/Source/WebCore/ChangeLog 2018-05-08 21:22:30 UTC (rev 231512)
@@ -1,3 +1,22 @@
+2018-05-08 Eric Carlson <[email protected]>
+
+ Log rtcstats as JSON
+ https://bugs.webkit.org/show_bug.cgi?id=185437
+ <rdar://problem/40065332>
+
+ Reviewed by Youenn Fablet.
+
+ * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+ (WebCore::RTCStatsLogger::RTCStatsLogger): Create a wrapper class so we don't have to add a
+ toJSONString method to libwebrtc.
+ (WebCore::RTCStatsLogger::toJSONString const): Log stats as JSON.
+ (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): Don't use the LOGIDENTIFIER macro because
+ it doesn't work well inside of a lambda.
+ (WTF::LogArgument<WebCore::RTCStatsLogger>::toString): Move into .cpp file because it is only
+ used here.
+ * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
+ (WTF::LogArgument<webrtc::RTCStats>::toString): Deleted. Move to .cpp file.
+
2018-05-08 Dean Jackson <[email protected]>
System Preview links should trigger a download
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (231511 => 231512)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2018-05-08 21:19:36 UTC (rev 231511)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2018-05-08 21:22:30 UTC (rev 231512)
@@ -1043,6 +1043,19 @@
});
}
+class RTCStatsLogger {
+public:
+ explicit RTCStatsLogger(const webrtc::RTCStats& stats)
+ : m_stats(stats)
+ {
+ }
+
+ String toJSONString() const { return String(m_stats.ToJson().c_str()); }
+
+private:
+ const webrtc::RTCStats& m_stats;
+};
+
void LibWebRTCMediaEndpoint::OnStatsDelivered(const rtc::scoped_refptr<const webrtc::RTCStatsReport>& report)
{
#if !RELEASE_LOG_DISABLED
@@ -1060,7 +1073,7 @@
if (iterator->type() == webrtc::RTCCodecStats::kType)
continue;
- ALWAYS_LOG(LOGIDENTIFIER, "WebRTC stats for :", *iterator);
+ ALWAYS_LOG(Logger::LogSiteIdentifier("LibWebRTCMediaEndpoint", "OnStatsDelivered", logIdentifier()), RTCStatsLogger { *iterator });
}
});
#else
@@ -1102,4 +1115,20 @@
} // namespace WebCore
+namespace WTF {
+
+template<typename Type>
+struct LogArgument;
+
+template <>
+struct LogArgument<WebCore::RTCStatsLogger> {
+ static String toString(const WebCore::RTCStatsLogger& logger)
+ {
+ return String(logger.toJSONString());
+ }
+};
+
+}; // namespace WTF
+
+
#endif // USE(LIBWEBRTC)
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h (231511 => 231512)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h 2018-05-08 21:19:36 UTC (rev 231511)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h 2018-05-08 21:22:30 UTC (rev 231512)
@@ -223,19 +223,4 @@
} // namespace WebCore
-namespace WTF {
-
-template<typename Type>
-struct LogArgument;
-
-template <>
-struct LogArgument<webrtc::RTCStats> {
- static String toString(const webrtc::RTCStats& stats)
- {
- return WTF::String(stats.ToJson().c_str());
- }
-};
-
-}; // namespace WTF
-
#endif // USE(LIBWEBRTC)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes