Title: [104857] trunk/Source/WebCore
Revision
104857
Author
[email protected]
Date
2012-01-12 14:11:52 -0800 (Thu, 12 Jan 2012)

Log Message

WebAudio: Use Logging instead of printf.
https://bugs.webkit.org/show_bug.cgi?id=74322

Reviewed by Darin Adler.

No new tests; no net change in functionality.

Add a new WebCoreLogLevel for WebAudio, and use this new log level instead of
printf statements in webaudio classes.

* platform/Logging.cpp:
(WebCore::getChannelFromName):
* platform/Logging.h:
* platform/mac/LoggingMac.mm:
(WebCore::InitializeLoggingChannelsIfNecessary):
* platform/audio/FFTFrame.cpp:
(WebCore::FFTFrame::print):
* webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::initialize):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (104856 => 104857)


--- trunk/Source/WebCore/ChangeLog	2012-01-12 22:08:41 UTC (rev 104856)
+++ trunk/Source/WebCore/ChangeLog	2012-01-12 22:11:52 UTC (rev 104857)
@@ -1,3 +1,25 @@
+2011-12-12  Jer Noble  <[email protected]>
+
+        WebAudio: Use Logging instead of printf.
+        https://bugs.webkit.org/show_bug.cgi?id=74322
+
+        Reviewed by Darin Adler.
+
+        No new tests; no net change in functionality.
+
+        Add a new WebCoreLogLevel for WebAudio, and use this new log level instead of 
+        printf statements in webaudio classes.
+
+        * platform/Logging.cpp:
+        (WebCore::getChannelFromName):
+        * platform/Logging.h:
+        * platform/mac/LoggingMac.mm:
+        (WebCore::InitializeLoggingChannelsIfNecessary):
+        * platform/audio/FFTFrame.cpp:
+        (WebCore::FFTFrame::print):
+        * webaudio/DefaultAudioDestinationNode.cpp:
+        (WebCore::DefaultAudioDestinationNode::initialize):
+
 2012-01-12  Anders Carlsson  <[email protected]>
 
         Make ScrollElasticityController members private

Modified: trunk/Source/WebCore/platform/Logging.cpp (104856 => 104857)


--- trunk/Source/WebCore/platform/Logging.cpp	2012-01-12 22:08:41 UTC (rev 104856)
+++ trunk/Source/WebCore/platform/Logging.cpp	2012-01-12 22:11:52 UTC (rev 104857)
@@ -61,6 +61,8 @@
 
 WTFLogChannel LogFileAPI =           { 0x10000000, "WebCoreLogLevel", WTFLogChannelOff };
 
+WTFLogChannel LogWebAudio =          { 0x20000000, "WebCoreLogLevel", WTFLogChannelOff };
+
 WTFLogChannel* getChannelFromName(const String& channelName)
 {
     if (!(channelName.length() >= 2))
@@ -135,6 +137,9 @@
     if (equalIgnoringCase(channelName, String("FileAPI")))
         return &LogFileAPI;
 
+    if (equalIgnoringCase(channelName, String("WebAudio")))
+        return &LogWebAudio;
+
     return 0;
 }
 

Modified: trunk/Source/WebCore/platform/Logging.h (104856 => 104857)


--- trunk/Source/WebCore/platform/Logging.h	2012-01-12 22:08:41 UTC (rev 104856)
+++ trunk/Source/WebCore/platform/Logging.h	2012-01-12 22:11:52 UTC (rev 104857)
@@ -59,6 +59,7 @@
     extern WTFLogChannel LogArchives;
     extern WTFLogChannel LogProgress;
     extern WTFLogChannel LogFileAPI;
+    extern WTFLogChannel LogWebAudio;
 
     void initializeLoggingChannelsIfNecessary();
     WTFLogChannel* getChannelFromName(const String& channelName);

Modified: trunk/Source/WebCore/platform/audio/FFTFrame.cpp (104856 => 104857)


--- trunk/Source/WebCore/platform/audio/FFTFrame.cpp	2012-01-12 22:08:41 UTC (rev 104856)
+++ trunk/Source/WebCore/platform/audio/FFTFrame.cpp	2012-01-12 22:11:52 UTC (rev 104857)
@@ -36,6 +36,7 @@
 #include <stdio.h>
 #endif
 
+#include "Logging.h"
 #include <wtf/Complex.h>
 #include <wtf/MathExtras.h>
 #include <wtf/OwnPtr.h>
@@ -253,8 +254,8 @@
     FFTFrame& frame = *this;
     float* realP = frame.realData();
     float* imagP = frame.imagData();
-    printf("**** \n");
-    printf("DC = %f : nyquist = %f\n", realP[0], imagP[0]);
+    LOG(WebAudio, "**** \n");
+    LOG(WebAudio, "DC = %f : nyquist = %f\n", realP[0], imagP[0]);
 
     int n = m_FFTSize / 2;
 
@@ -262,9 +263,9 @@
         double mag = sqrt(realP[i] * realP[i] + imagP[i] * imagP[i]);
         double phase = atan2(realP[i], imagP[i]);
 
-        printf("[%d] (%f %f)\n", i, mag, phase);
+        LOG(WebAudio, "[%d] (%f %f)\n", i, mag, phase);
     }
-    printf("****\n");
+    LOG(WebAudio, "****\n");
 }
 #endif // NDEBUG
 

Modified: trunk/Source/WebCore/platform/mac/LoggingMac.mm (104856 => 104857)


--- trunk/Source/WebCore/platform/mac/LoggingMac.mm	2012-01-12 22:08:41 UTC (rev 104856)
+++ trunk/Source/WebCore/platform/mac/LoggingMac.mm	2012-01-12 22:11:52 UTC (rev 104857)
@@ -72,6 +72,7 @@
     initializeWithUserDefault(LogMedia);
     initializeWithUserDefault(LogPlugins);
     initializeWithUserDefault(LogArchives);
+    initializeWithUserDefault(LogWebAudio);
 }
 
 }

Modified: trunk/Source/WebCore/webaudio/DefaultAudioDestinationNode.cpp (104856 => 104857)


--- trunk/Source/WebCore/webaudio/DefaultAudioDestinationNode.cpp	2012-01-12 22:08:41 UTC (rev 104856)
+++ trunk/Source/WebCore/webaudio/DefaultAudioDestinationNode.cpp	2012-01-12 22:11:52 UTC (rev 104857)
@@ -28,9 +28,7 @@
 
 #include "DefaultAudioDestinationNode.h"
 
-#ifndef NDEBUG
-#include <stdio.h>
-#endif
+#include "Logging.h"
 
 namespace WebCore {
     
@@ -51,9 +49,7 @@
         return;
 
     float hardwareSampleRate = AudioDestination::hardwareSampleRate();
-#ifndef NDEBUG    
-    fprintf(stderr, ">>>> hardwareSampleRate = %f\n", hardwareSampleRate);
-#endif
+    LOG(WebAudio, ">>>> hardwareSampleRate = %f\n", hardwareSampleRate);
     
     m_destination = AudioDestination::create(*this, hardwareSampleRate);
     
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to