Changeset 155198 in webkit


Ignore:
Timestamp:
Sep 6, 2013, 11:21:35 AM (12 years ago)
Author:
andersca@apple.com
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):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r155195 r155198  
     12013-09-06  Anders Carlsson  <andersca@apple.com>
     2
     3        Stop using fastNew/fastDelete in WebCore
     4        https://bugs.webkit.org/show_bug.cgi?id=120867
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Using fastNew/fastDelete can be dangerous, especially when put into a smart pointer
     9        such as OwnPtr which uses regular delete. Because of this I'd like to remove fastNew/fastDelete.
     10        Turns out it's only used in a couple of places in WebCore, so just use new/delete here instead.
     11
     12        * platform/audio/FFTFrame.h:
     13        * platform/audio/gstreamer/FFTFrameGStreamer.cpp:
     14        (WebCore::FFTFrame::FFTFrame):
     15        (WebCore::FFTFrame::~FFTFrame):
     16        (WebCore::FFTFrame::doFFT):
     17        (WebCore::FFTFrame::doInverseFFT):
     18        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
     19        (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
     20        (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
     21        * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
     22        (webkitVideoSinkDispose):
     23
    1242013-09-06  Anders Carlsson  <andersca@apple.com>
    225
  • trunk/Source/WebCore/platform/audio/FFTFrame.h

    r148921 r155198  
    6969
    7070#include <wtf/Forward.h>
     71#include <wtf/PassOwnArrayPtr.h>
    7172#include <wtf/PassOwnPtr.h>
    7273#include <wtf/Threading.h>
     
    164165    GstFFTF32* m_fft;
    165166    GstFFTF32* m_inverseFft;
    166     GstFFTF32Complex* m_complexData;
     167    OwnArrayPtr<GstFFTF32Complex> m_complexData;
    167168    AudioFloatArray m_realData;
    168169    AudioFloatArray m_imagData;
  • trunk/Source/WebCore/platform/audio/gstreamer/FFTFrameGStreamer.cpp

    r106795 r155198  
    4343    : m_FFTSize(fftSize)
    4444    , m_log2FFTSize(static_cast<unsigned>(log2(fftSize)))
     45    , m_complexData(adoptArrayPtr(new GstFFTF32Complex[unpackedFFTDataSize(m_FFTSize)]))
    4546    , m_realData(unpackedFFTDataSize(m_FFTSize))
    4647    , m_imagData(unpackedFFTDataSize(m_FFTSize))
    4748{
    48     m_complexData = WTF::fastNewArray<GstFFTF32Complex>(unpackedFFTDataSize(m_FFTSize));
    49 
    5049    int fftLength = gst_fft_next_fast_length(m_FFTSize);
    5150    m_fft = gst_fft_f32_new(fftLength, FALSE);
     
    5756    : m_FFTSize(0)
    5857    , m_log2FFTSize(0)
    59     , m_complexData(0)
    6058{
    6159    int fftLength = gst_fft_next_fast_length(m_FFTSize);
     
    6866    : m_FFTSize(frame.m_FFTSize)
    6967    , m_log2FFTSize(frame.m_log2FFTSize)
     68    , m_complexData(adoptArrayPtr(new GstFFTF32Complex[unpackedFFTDataSize(m_FFTSize)]))
    7069    , m_realData(unpackedFFTDataSize(frame.m_FFTSize))
    7170    , m_imagData(unpackedFFTDataSize(frame.m_FFTSize))
    7271{
    73     m_complexData = WTF::fastNewArray<GstFFTF32Complex>(unpackedFFTDataSize(m_FFTSize));
    74 
    7572    int fftLength = gst_fft_next_fast_length(m_FFTSize);
    7673    m_fft = gst_fft_f32_new(fftLength, FALSE);
     
    10097    gst_fft_f32_free(m_inverseFft);
    10198    m_inverseFft = 0;
    102 
    103     WTF::fastDeleteArray(m_complexData);
    10499}
    105100
     
    129124void FFTFrame::doFFT(const float* data)
    130125{
    131     gst_fft_f32_fft(m_fft, data, m_complexData);
     126    gst_fft_f32_fft(m_fft, data, m_complexData.get());
    132127
    133128    // Scale the frequency domain data to match vecLib's scale factor
     
    157152    }
    158153
    159     gst_fft_f32_inverse_fft(m_inverseFft, m_complexData, data);
     154    gst_fft_f32_inverse_fft(m_inverseFft, m_complexData.get(), data);
    160155
    161156    // Scale so that a forward then inverse FFT yields exactly the original data.
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp

    r154970 r155198  
    119119{
    120120#if GLIB_CHECK_VERSION(2, 31, 0)
    121     m_bufferMutex = WTF::fastNew<GMutex>();
     121    m_bufferMutex = new GMutex;
    122122    g_mutex_init(m_bufferMutex);
    123123#else
     
    132132#if GLIB_CHECK_VERSION(2, 31, 0)
    133133    g_mutex_clear(m_bufferMutex);
    134     WTF::fastDelete(m_bufferMutex);
     134    delete m_bufferMutex;
    135135#else
    136136    g_mutex_free(m_bufferMutex);
  • trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp

    r152710 r155198  
    3939#include <gst/video/gstvideopool.h>
    4040#endif
    41 #include <wtf/FastAllocBase.h>
     41#include <wtf/OwnPtr.h>
    4242
    4343// CAIRO_FORMAT_RGB24 used to render the video buffers is little/big endian dependant.
     
    118118    sink->priv = G_TYPE_INSTANCE_GET_PRIVATE(sink, WEBKIT_TYPE_VIDEO_SINK, WebKitVideoSinkPrivate);
    119119#if GLIB_CHECK_VERSION(2, 31, 0)
    120     sink->priv->dataCondition = WTF::fastNew<GCond>();
     120    sink->priv->dataCondition = new GCond;
    121121    g_cond_init(sink->priv->dataCondition);
    122     sink->priv->bufferMutex = WTF::fastNew<GMutex>();
     122    sink->priv->bufferMutex = new GMutex;
    123123    g_mutex_init(sink->priv->bufferMutex);
    124124#else
     
    280280#if GLIB_CHECK_VERSION(2, 31, 0)
    281281        g_cond_clear(priv->dataCondition);
    282         WTF::fastDelete(priv->dataCondition);
     282        delete priv->dataCondition;
    283283#else
    284284        g_cond_free(priv->dataCondition);
     
    290290#if GLIB_CHECK_VERSION(2, 31, 0)
    291291        g_mutex_clear(priv->bufferMutex);
    292         WTF::fastDelete(priv->bufferMutex);
     292        delete priv->bufferMutex;
    293293#else
    294294        g_mutex_free(priv->bufferMutex);
Note: See TracChangeset for help on using the changeset viewer.