[webkit-reviews] review denied: [Bug 51424] Add WebKitClient::createAudioDevice() for Chromium port of web audio API : [Attachment 77154] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 21 15:46:23 PST 2010


Darin Fisher (:fishd, Google) <fishd at chromium.org> has denied Chris Rogers
<crogers at google.com>'s request for review:
Bug 51424: Add WebKitClient::createAudioDevice() for Chromium port of web audio
API
https://bugs.webkit.org/show_bug.cgi?id=51424

Attachment 77154: Patch
https://bugs.webkit.org/attachment.cgi?id=77154&action=review

------- Additional Comments from Darin Fisher (:fishd, Google)
<fishd at chromium.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=77154&action=review

> WebKit/chromium/public/WebAudioDevice.h:45
> +    typedef void (*RenderCallback)(std::vector<float*>& audioData, size_t
numberOfFrames, void* userData);

note: we do not use STL types in the WebKit API.  please use WebVector, or just
use a raw float* here.	do you need the callee to allocate the audioData
buffer, or will it be preallocated to the maximum size by the caller?  if it
will be preallocated, then passing a raw float* would seem fine.

> WebKit/chromium/public/WebKitClient.h:282
> +    // Audio --------------------------------------------------------------
> +    virtual WebAudioDevice* createAudioDevice(size_t bufferSize, unsigned
numberOfChannels, double sampleRate, WebAudioDevice::RenderCallback, void*
userData) { return 0; }

nit: add a new line below the section header.

The C++ way of passing user data to a function pointer is to define an
interface
that folks can subclass.  Why not do that here?

class WebAudioRenderCallback {
public:
    virtual void renderFrames(float* audioData, size_t numberOfFrames) = 0;
protected:
    virtual ~WebAudioRenderCallback() {}
};

or you could also do this as an inner class:

class WebAudioDevice {
public:
    class RenderCallback {
    public:
	...
    };
};

however the downside to it being an inner class is that you force
WebKitClient.h
to also #include WebAudioDevice.h.  it would be nice to avoid that.

> WebKit/chromium/src/AudioDestinationChromium.cpp:40
> +using namespace std;

please avoid using the "std" namespace for container types in webkit code.

> WebKit/chromium/src/AudioDestinationChromium.cpp:41
> +using WebKit::webKitClient;

it is more commonplace to just do "using namespace WebKit" in WebKit code.

> WebKit/chromium/src/AudioDestinationChromium.cpp:102
> +void AudioDestinationChromium::renderDispatch(vector<float*>& audioData,
size_t numberOfFrames, void* userData)

if you define an interface for the render callback function, then you would
not need to implement this thunk function yourself.


More information about the webkit-reviews mailing list