Bug 74322

Summary: WebAudio: Use Logging instead of printf.
Product: WebKit Reporter: Jer Noble <jer.noble>
Component: Web AudioAssignee: Jer Noble <jer.noble>
Status: RESOLVED FIXED    
Severity: Normal CC: crogers, darin, eric.carlson
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch darin: review+

Description Jer Noble 2011-12-12 12:59:12 PST
WebAudio should use Logging instead of printf.
Comment 1 Jer Noble 2011-12-12 13:03:03 PST
Created attachment 118828 [details]
Patch
Comment 2 Jer Noble 2011-12-12 15:57:47 PST
Created attachment 118897 [details]
Patch

Rebased patch against ToT.
Comment 3 Sam Weinig 2011-12-12 16:45:56 PST
Comment on attachment 118897 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=118897&action=review

> Source/WebCore/webaudio/AudioContext.cpp:184
>  #if DEBUG_AUDIONODE_REFERENCES
> -    printf("%p: AudioContext::~AudioContext()\n", this);
> +    LOG(WebAudio, "%p: AudioContext::~AudioContext()\n", this);
>  #endif

If this is only for debugging, I don't think you should use printf.

> Source/WebCore/webaudio/AudioNode.cpp:314
>  void AudioNode::printNodeCounts()

Who calls this? If it is only for debugging (from a debugger) I think printf is probably more idiomatic.

> Source/WebCore/webaudio/DefaultAudioDestinationNode.cpp:54
>  #ifndef NDEBUG    
> -    fprintf(stderr, ">>>> hardwareSampleRate = %f\n", hardwareSampleRate);
> +    LOG(WebAudio, ">>>> hardwareSampleRate = %f\n", hardwareSampleRate);
>  #endif

This #ifndef is no longer needed.
Comment 4 Jer Noble 2011-12-12 17:01:00 PST
(In reply to comment #3)
> (From update of attachment 118897 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=118897&action=review
> 
> > Source/WebCore/webaudio/AudioContext.cpp:184
> >  #if DEBUG_AUDIONODE_REFERENCES
> > -    printf("%p: AudioContext::~AudioContext()\n", this);
> > +    LOG(WebAudio, "%p: AudioContext::~AudioContext()\n", this);
> >  #endif
> 
> If this is only for debugging, I don't think you should use printf.

Do you mean, "I don't think you should use LOG", or "I [do] think you should use printf"?

> > Source/WebCore/webaudio/AudioNode.cpp:314
> >  void AudioNode::printNodeCounts()
> 
> Who calls this? If it is only for debugging (from a debugger) I think printf is probably more idiomatic.

This is called by the AudioNode constructor, provided DEBUG_AUDIONODE_REFERENCES is enabled.

> > Source/WebCore/webaudio/DefaultAudioDestinationNode.cpp:54
> >  #ifndef NDEBUG    
> > -    fprintf(stderr, ">>>> hardwareSampleRate = %f\n", hardwareSampleRate);
> > +    LOG(WebAudio, ">>>> hardwareSampleRate = %f\n", hardwareSampleRate);
> >  #endif
> 
> This #ifndef is no longer needed.

I'll delete it.
Comment 5 Jer Noble 2011-12-12 17:20:12 PST
Created attachment 118918 [details]
Patch
Comment 6 Jer Noble 2012-01-12 14:12:06 PST
Committed r104857: <http://trac.webkit.org/changeset/104857>