- Revision
- 155198
- Author
- [email protected]
- Date
- 2013-09-06 11:21:35 -0700 (Fri, 06 Sep 2013)
Log Message
Stop using fastNew/fastDelete in WebCore
https://bugs.webkit.org/show_bug.cgi?id=120867
Reviewed by Geoffrey Garen.
Using fastNew/fastDelete can be dangerous, especially when put into a smart pointer
such as OwnPtr which uses regular delete. Because of this I'd like to remove fastNew/fastDelete.
Turns out it's only used in a couple of places in WebCore, so just use new/delete here instead.
* platform/audio/FFTFrame.h:
* platform/audio/gstreamer/FFTFrameGStreamer.cpp:
(WebCore::FFTFrame::FFTFrame):
(WebCore::FFTFrame::~FFTFrame):
(WebCore::FFTFrame::doFFT):
(WebCore::FFTFrame::doInverseFFT):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
(WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
* platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
(webkitVideoSinkDispose):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (155197 => 155198)
--- trunk/Source/WebCore/ChangeLog 2013-09-06 18:19:45 UTC (rev 155197)
+++ trunk/Source/WebCore/ChangeLog 2013-09-06 18:21:35 UTC (rev 155198)
@@ -1,5 +1,28 @@
2013-09-06 Anders Carlsson <[email protected]>
+ Stop using fastNew/fastDelete in WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=120867
+
+ Reviewed by Geoffrey Garen.
+
+ Using fastNew/fastDelete can be dangerous, especially when put into a smart pointer
+ such as OwnPtr which uses regular delete. Because of this I'd like to remove fastNew/fastDelete.
+ Turns out it's only used in a couple of places in WebCore, so just use new/delete here instead.
+
+ * platform/audio/FFTFrame.h:
+ * platform/audio/gstreamer/FFTFrameGStreamer.cpp:
+ (WebCore::FFTFrame::FFTFrame):
+ (WebCore::FFTFrame::~FFTFrame):
+ (WebCore::FFTFrame::doFFT):
+ (WebCore::FFTFrame::doInverseFFT):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+ (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
+ (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
+ * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
+ (webkitVideoSinkDispose):
+
+2013-09-06 Anders Carlsson <[email protected]>
+
Fix fastMalloc/delete mismatches in CSS parser
https://bugs.webkit.org/show_bug.cgi?id=120864
Modified: trunk/Source/WebCore/platform/audio/FFTFrame.h (155197 => 155198)
--- trunk/Source/WebCore/platform/audio/FFTFrame.h 2013-09-06 18:19:45 UTC (rev 155197)
+++ trunk/Source/WebCore/platform/audio/FFTFrame.h 2013-09-06 18:21:35 UTC (rev 155198)
@@ -68,6 +68,7 @@
#endif // USE(WEBAUDIO_IPP)
#include <wtf/Forward.h>
+#include <wtf/PassOwnArrayPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/Threading.h>
@@ -163,7 +164,7 @@
#if USE(WEBAUDIO_GSTREAMER)
GstFFTF32* m_fft;
GstFFTF32* m_inverseFft;
- GstFFTF32Complex* m_complexData;
+ OwnArrayPtr<GstFFTF32Complex> m_complexData;
AudioFloatArray m_realData;
AudioFloatArray m_imagData;
#endif // USE(WEBAUDIO_GSTREAMER)
Modified: trunk/Source/WebCore/platform/audio/gstreamer/FFTFrameGStreamer.cpp (155197 => 155198)
--- trunk/Source/WebCore/platform/audio/gstreamer/FFTFrameGStreamer.cpp 2013-09-06 18:19:45 UTC (rev 155197)
+++ trunk/Source/WebCore/platform/audio/gstreamer/FFTFrameGStreamer.cpp 2013-09-06 18:21:35 UTC (rev 155198)
@@ -42,11 +42,10 @@
FFTFrame::FFTFrame(unsigned fftSize)
: m_FFTSize(fftSize)
, m_log2FFTSize(static_cast<unsigned>(log2(fftSize)))
+ , m_complexData(adoptArrayPtr(new GstFFTF32Complex[unpackedFFTDataSize(m_FFTSize)]))
, m_realData(unpackedFFTDataSize(m_FFTSize))
, m_imagData(unpackedFFTDataSize(m_FFTSize))
{
- m_complexData = WTF::fastNewArray<GstFFTF32Complex>(unpackedFFTDataSize(m_FFTSize));
-
int fftLength = gst_fft_next_fast_length(m_FFTSize);
m_fft = gst_fft_f32_new(fftLength, FALSE);
m_inverseFft = gst_fft_f32_new(fftLength, TRUE);
@@ -56,7 +55,6 @@
FFTFrame::FFTFrame()
: m_FFTSize(0)
, m_log2FFTSize(0)
- , m_complexData(0)
{
int fftLength = gst_fft_next_fast_length(m_FFTSize);
m_fft = gst_fft_f32_new(fftLength, FALSE);
@@ -67,11 +65,10 @@
FFTFrame::FFTFrame(const FFTFrame& frame)
: m_FFTSize(frame.m_FFTSize)
, m_log2FFTSize(frame.m_log2FFTSize)
+ , m_complexData(adoptArrayPtr(new GstFFTF32Complex[unpackedFFTDataSize(m_FFTSize)]))
, m_realData(unpackedFFTDataSize(frame.m_FFTSize))
, m_imagData(unpackedFFTDataSize(frame.m_FFTSize))
{
- m_complexData = WTF::fastNewArray<GstFFTF32Complex>(unpackedFFTDataSize(m_FFTSize));
-
int fftLength = gst_fft_next_fast_length(m_FFTSize);
m_fft = gst_fft_f32_new(fftLength, FALSE);
m_inverseFft = gst_fft_f32_new(fftLength, TRUE);
@@ -99,8 +96,6 @@
gst_fft_f32_free(m_inverseFft);
m_inverseFft = 0;
-
- WTF::fastDeleteArray(m_complexData);
}
void FFTFrame::multiply(const FFTFrame& frame)
@@ -128,7 +123,7 @@
void FFTFrame::doFFT(const float* data)
{
- gst_fft_f32_fft(m_fft, data, m_complexData);
+ gst_fft_f32_fft(m_fft, data, m_complexData.get());
// Scale the frequency domain data to match vecLib's scale factor
// on the Mac. FIXME: if we change the definition of FFTFrame to
@@ -156,7 +151,7 @@
m_complexData[i].r = realData[i];
}
- gst_fft_f32_inverse_fft(m_inverseFft, m_complexData, data);
+ gst_fft_f32_inverse_fft(m_inverseFft, m_complexData.get(), data);
// Scale so that a forward then inverse FFT yields exactly the original data.
const float scaleFactor = 1.0 / (2 * m_FFTSize);
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (155197 => 155198)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2013-09-06 18:19:45 UTC (rev 155197)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2013-09-06 18:21:35 UTC (rev 155198)
@@ -118,7 +118,7 @@
, m_muteSignalHandler(0)
{
#if GLIB_CHECK_VERSION(2, 31, 0)
- m_bufferMutex = WTF::fastNew<GMutex>();
+ m_bufferMutex = new GMutex;
g_mutex_init(m_bufferMutex);
#else
m_bufferMutex = g_mutex_new();
@@ -131,7 +131,7 @@
#if GLIB_CHECK_VERSION(2, 31, 0)
g_mutex_clear(m_bufferMutex);
- WTF::fastDelete(m_bufferMutex);
+ delete m_bufferMutex;
#else
g_mutex_free(m_bufferMutex);
#endif
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp (155197 => 155198)
--- trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp 2013-09-06 18:19:45 UTC (rev 155197)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp 2013-09-06 18:21:35 UTC (rev 155198)
@@ -38,7 +38,7 @@
#include <gst/video/gstvideometa.h>
#include <gst/video/gstvideopool.h>
#endif
-#include <wtf/FastAllocBase.h>
+#include <wtf/OwnPtr.h>
// CAIRO_FORMAT_RGB24 used to render the video buffers is little/big endian dependant.
#ifdef GST_API_VERSION_1
@@ -117,9 +117,9 @@
{
sink->priv = G_TYPE_INSTANCE_GET_PRIVATE(sink, WEBKIT_TYPE_VIDEO_SINK, WebKitVideoSinkPrivate);
#if GLIB_CHECK_VERSION(2, 31, 0)
- sink->priv->dataCondition = WTF::fastNew<GCond>();
+ sink->priv->dataCondition = new GCond;
g_cond_init(sink->priv->dataCondition);
- sink->priv->bufferMutex = WTF::fastNew<GMutex>();
+ sink->priv->bufferMutex = new GMutex;
g_mutex_init(sink->priv->bufferMutex);
#else
sink->priv->dataCondition = g_cond_new();
@@ -279,7 +279,7 @@
if (priv->dataCondition) {
#if GLIB_CHECK_VERSION(2, 31, 0)
g_cond_clear(priv->dataCondition);
- WTF::fastDelete(priv->dataCondition);
+ delete priv->dataCondition;
#else
g_cond_free(priv->dataCondition);
#endif
@@ -289,7 +289,7 @@
if (priv->bufferMutex) {
#if GLIB_CHECK_VERSION(2, 31, 0)
g_mutex_clear(priv->bufferMutex);
- WTF::fastDelete(priv->bufferMutex);
+ delete priv->bufferMutex;
#else
g_mutex_free(priv->bufferMutex);
#endif