Bug 1367578: Don't use PR_LogPrint() for logging now that we use LazyLog r=drno
authorRandell Jesup <rjesup@jesup.org>
Fri, 02 Jun 2017 15:50:05 -0400
changeset 410267 064c3ee69168a2ca6ba6926cc9a38c6e5c686db8
parent 410266 e2877b8f412c2517005a9616a5dd2cf0178e4845
child 410268 acf2c7b496d5fbe24c77069911d7097e44429cd0
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno
bugs1367578
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1367578: Don't use PR_LogPrint() for logging now that we use LazyLog r=drno MozReview-Commit-ID: K1KVCtpEPTZ
dom/media/tests/mochitest/dataChannel.js
netwerk/sctp/datachannel/DataChannel.cpp
--- a/dom/media/tests/mochitest/dataChannel.js
+++ b/dom/media/tests/mochitest/dataChannel.js
@@ -42,25 +42,27 @@ var commandsWaitForDataChannel = [
     return test.pcRemote.nextDataChannel.then(channel => channel.opened);
   },
 ];
 
 var commandsCheckDataChannel = [
   function SEND_MESSAGE(test) {
     var message = "Lorem ipsum dolor sit amet";
 
+    info("Sending message:" + message);
     return test.send(message).then(result => {
       is(result.data, message, "Message correctly transmitted from pcLocal to pcRemote.");
     });
   },
 
   function SEND_BLOB(test) {
     var contents = "At vero eos et accusam et justo duo dolores et ea rebum.";
     var blob = new Blob([contents], { "type" : "text/plain" });
 
+    info("Sending blob");
     return test.send(blob).then(result => {
       ok(result.data instanceof Blob, "Received data is of instance Blob");
       is(result.data.size, blob.size, "Received data has the correct size.");
 
       return getBlobContent(result.data);
     }).then(recv_contents =>
             is(recv_contents, contents, "Received data has the correct content."));
   },
@@ -75,44 +77,47 @@ var commandsCheckDataChannel = [
       is(targetChannel.binaryType, "blob", targetChannel + " is of binary type 'blob'");
     });
   },
 
   function SEND_MESSAGE_THROUGH_LAST_OPENED_CHANNEL(test) {
     var channels = test.pcRemote.dataChannels;
     var message = "I am the Omega";
 
+    info("Sending message:" + message);
     return test.send(message).then(result => {
       is(channels.indexOf(result.channel), channels.length - 1, "Last channel used");
       is(result.data, message, "Received message has the correct content.");
     });
   },
 
 
   function SEND_MESSAGE_THROUGH_FIRST_CHANNEL(test) {
     var message = "Message through 1st channel";
     var options = {
       sourceChannel: test.pcLocal.dataChannels[0],
       targetChannel: test.pcRemote.dataChannels[0]
     };
 
+    info("Sending message:" + message);
     return test.send(message, options).then(result => {
       is(test.pcRemote.dataChannels.indexOf(result.channel), 0, "1st channel used");
       is(result.data, message, "Received message has the correct content.");
     });
   },
 
 
   function SEND_MESSAGE_BACK_THROUGH_FIRST_CHANNEL(test) {
     var message = "Return a message also through 1st channel";
     var options = {
       sourceChannel: test.pcRemote.dataChannels[0],
       targetChannel: test.pcLocal.dataChannels[0]
     };
 
+    info("Sending message:" + message);
     return test.send(message, options).then(result => {
       is(test.pcLocal.dataChannels.indexOf(result.channel), 0, "1st channel used");
       is(result.data, message, "Return message has the correct content.");
     });
   },
 
   function CREATE_NEGOTIATED_DATA_CHANNEL(test) {
     var options = {
@@ -156,16 +161,17 @@ var commandsCheckDataChannel = [
       */
     });
   },
 
   function SEND_MESSAGE_THROUGH_LAST_OPENED_CHANNEL2(test) {
     var channels = test.pcRemote.dataChannels;
     var message = "I am the walrus; Goo goo g'joob";
 
+    info("Sending message:" + message);
     return test.send(message).then(result => {
       is(channels.indexOf(result.channel), channels.length - 1, "Last channel used");
       is(result.data, message, "Received message has the correct content.");
     });
   },
 
   function CREATE_NEGOTIATED_MAXPACKET_LIFE_DATA_CHANNEL(test) {
     var options = {
@@ -182,30 +188,32 @@ var commandsCheckDataChannel = [
 
     });
   },
 
   function SEND_MESSAGE_THROUGH_LAST_OPENED_CHANNEL3(test) {
     var channels = test.pcRemote.dataChannels;
     var message = "Nice to see you working maxPacketLifeTime";
 
+    info("Sending message:" + message);
     return test.send(message).then(result => {
       is(channels.indexOf(result.channel), channels.length - 1, "Last channel used");
       is(result.data, message, "Received message has the correct content.");
     });
   }
 ];
 
 var commandsCheckLargeXfer = [
   function SEND_BIG_BUFFER(test) {
     var size = 512*1024; // SCTP internal buffer is 256K, so we'll have ~256K queued
     var buffer = new ArrayBuffer(size);
     // note: type received is always blob for binary data
     var options = {};
     options.bufferedAmountLowThreshold = 64*1024;
+    info("Sending arraybuffer");
     return test.send(buffer, options).then(result => {
       ok(result.data instanceof Blob, "Received data is of instance Blob");
       is(result.data.size, size, "Received data has the correct size.");
     });
   },
 ];
 
 function addInitialDataChannel(chain) {
--- a/netwerk/sctp/datachannel/DataChannel.cpp
+++ b/netwerk/sctp/datachannel/DataChannel.cpp
@@ -63,16 +63,18 @@
 
 static bool sctp_initialized;
 
 namespace mozilla {
 
 LazyLogModule gDataChannelLog("DataChannel");
 static LazyLogModule gSCTPLog("SCTP");
 
+#define SCTP_LOG(args) MOZ_LOG(mozilla::gSCTPLog, mozilla::LogLevel::Debug, args)
+
 class DataChannelShutdown : public nsIObserver
 {
 public:
   // This needs to be tied to some form object that is guaranteed to be
   // around (singleton likely) unless we want to shutdown sctp whenever
   // we're not using it (and in which case we'd keep a refcnt'd object
   // ref'd by each DataChannelConnection to release the SCTP usrlib via
   // sctp_finish). Right now, the single instance of this class is
@@ -195,17 +197,17 @@ debug_printf(const char *format, ...)
 
   if (MOZ_LOG_TEST(gSCTPLog, LogLevel::Debug)) {
     va_start(ap, format);
 #ifdef _WIN32
     if (vsnprintf_s(buffer, sizeof(buffer), _TRUNCATE, format, ap) > 0) {
 #else
     if (VsprintfLiteral(buffer, format, ap) > 0) {
 #endif
-      PR_LogPrint("%s", buffer);
+      SCTP_LOG(("%s", buffer));
     }
     va_end(ap);
   }
 }
 
 DataChannelConnection::DataChannelConnection(DataConnectionListener *listener) :
    mLock("netwerk::sctp::DataChannelConnection")
 {
@@ -636,17 +638,17 @@ DataChannelConnection::ProcessQueuedOpen
 void
 DataChannelConnection::SctpDtlsInput(TransportFlow *flow,
                                      const unsigned char *data, size_t len)
 {
   if (MOZ_LOG_TEST(gSCTPLog, LogLevel::Debug)) {
     char *buf;
 
     if ((buf = usrsctp_dumppacket((void *)data, len, SCTP_DUMP_INBOUND)) != nullptr) {
-      PR_LogPrint("%s", buf);
+      SCTP_LOG(("%s", buf));
       usrsctp_freedumpbuffer(buf);
     }
   }
   // Pass the data to SCTP
   usrsctp_conninput(static_cast<void *>(this), data, len, 0);
 }
 
 int
@@ -666,17 +668,17 @@ DataChannelConnection::SctpDtlsOutput(vo
 {
   DataChannelConnection *peer = static_cast<DataChannelConnection *>(addr);
   int res;
 
   if (MOZ_LOG_TEST(gSCTPLog, LogLevel::Debug)) {
     char *buf;
 
     if ((buf = usrsctp_dumppacket(buffer, length, SCTP_DUMP_OUTBOUND)) != nullptr) {
-      PR_LogPrint("%s", buf);
+      SCTP_LOG(("%s", buf));
       usrsctp_freedumpbuffer(buf);
     }
   }
   // We're async proxying even if on the STSThread because this is called
   // with internal SCTP locks held in some cases (such as in usrsctp_connect()).
   // SCTP has an option for Apple, on IP connections only, to release at least
   // one of the locks before calling a packet output routine; with changes to
   // the underlying SCTP stack this might remove the need to use an async proxy.