Changeset 148566 in webkit


Ignore:
Timestamp:
Apr 16, 2013 4:17:54 PM (11 years ago)
Author:
jer.noble@apple.com
Message:

Repeated use of decodeAudioData() causes leak
https://bugs.webkit.org/show_bug.cgi?id=114709

Reviewed by Geoffrey Garen.

Report the correct size of the AudioBuffer to the garbage collector so that creating
these large buffers will trigger garbage collection.

  • Modules/webaudio/AudioBuffer.cpp:

(WebCore::AudioBuffer::memoryCost): Added; simple sum of the buffer sizes in m_channels;

  • Modules/webaudio/AudioBuffer.h:
  • Modules/webaudio/AudioBuffer.idl: Add the CustomToJSObject flag.
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSAudioBufferCustom.cpp: Added.

(WebCore::toJS): Added; report the extra size of an AudioBuffer when the wrapper

is created.

Location:
trunk/Source/WebCore
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r148564 r148566  
     12013-04-16  Jer Noble  <jer.noble@apple.com>
     2
     3        Repeated use of decodeAudioData() causes leak
     4        https://bugs.webkit.org/show_bug.cgi?id=114709
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Report the correct size of the AudioBuffer to the garbage collector so that creating
     9        these large buffers will trigger garbage collection.
     10
     11        * Modules/webaudio/AudioBuffer.cpp:
     12        (WebCore::AudioBuffer::memoryCost): Added; simple sum of the buffer sizes in m_channels;
     13        * Modules/webaudio/AudioBuffer.h:
     14        * Modules/webaudio/AudioBuffer.idl: Add the CustomToJSObject flag.
     15        * WebCore.xcodeproj/project.pbxproj:
     16        * bindings/js/JSAudioBufferCustom.cpp: Added.
     17        (WebCore::toJS): Added; report the extra size of an AudioBuffer when the wrapper
     18            is created.
     19
    1202013-04-16  Beth Dakin  <bdakin@apple.com>
    221
  • trunk/Source/WebCore/Modules/webaudio/AudioBuffer.cpp

    r123996 r148566  
    117117}
    118118
     119size_t AudioBuffer::memoryCost() const
     120{
     121    size_t cost = 0;
     122    for (unsigned i = 0; i < m_channels.size() ; ++i)
     123        cost += m_channels[i]->byteLength();
     124    return cost;
     125}
     126
    119127} // namespace WebCore
    120128
  • trunk/Source/WebCore/Modules/webaudio/AudioBuffer.h

    r123996 r148566  
    6868    // Careful! Only call this when the page unloads, after the AudioContext is no longer processing.
    6969    void releaseMemory();
     70
     71    size_t memoryCost() const;
    7072   
    7173protected:
  • trunk/Source/WebCore/Modules/webaudio/AudioBuffer.idl

    r141034 r148566  
    2929[
    3030    Conditional=WEB_AUDIO,
     31    CustomToJSObject,
    3132    ImplementationLacksVTable
    3233] interface AudioBuffer {
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r148467 r148566  
    52375237                CDC69DDB16371FD4007C38DF /* WebCoreFullScreenPlaceholderView.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC69DD916371FD3007C38DF /* WebCoreFullScreenPlaceholderView.mm */; };
    52385238                CDD525D7145B6DD0008D204D /* JSHTMLMediaElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDF65CCC145B6AFE00C4C7AA /* JSHTMLMediaElementCustom.cpp */; };
     5239                CDDE691F171DFAD000A44D89 /* JSAudioBufferCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDDE691D171DF89100A44D89 /* JSAudioBufferCustom.cpp */; };
    52395240                CDEA763014608A53008B31F1 /* PlatformClockCA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEA762E146084DE008B31F1 /* PlatformClockCA.cpp */; };
    52405241                CDEA76341460B56F008B31F1 /* ClockGeneric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEA76321460AE29008B31F1 /* ClockGeneric.cpp */; };
     
    1199711998                CDCE5CD014633BC900D47CCA /* EventTargetFactory.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventTargetFactory.in; sourceTree = "<group>"; };
    1199811999                CDD1E525167BA56400CE820B /* TextTrackRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextTrackRepresentation.h; sourceTree = "<group>"; };
     12000                CDDE691D171DF89100A44D89 /* JSAudioBufferCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSAudioBufferCustom.cpp; sourceTree = "<group>"; };
    1199912001                CDEA762C14608224008B31F1 /* Clock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Clock.h; sourceTree = "<group>"; };
    1200012002                CDEA762E146084DE008B31F1 /* PlatformClockCA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformClockCA.cpp; sourceTree = "<group>"; };
     
    1880518807                                BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */,
    1880618808                                FDEAAAEF12B02EE400DCF33B /* JSAudioBufferSourceNodeCustom.cpp */,
     18809                                CDDE691D171DF89100A44D89 /* JSAudioBufferCustom.cpp */,
    1880718810                                FDEAAAF012B02EE400DCF33B /* JSAudioContextCustom.cpp */,
    1880818811                                FD8AA63B1695148E00D2EA68 /* JSBiquadFilterNodeCustom.cpp */,
     
    2546625469                                A80A9423149F225E00989291 /* JSDOMWindowWebAudioCustom.cpp in Sources */,
    2546725470                                A80A9425149F227100989291 /* JSDOMWindowWebSocketCustom.cpp in Sources */,
     25471                                CDDE691F171DFAD000A44D89 /* JSAudioBufferCustom.cpp in Sources */,
    2546825472                                FD7868B9136B999200D403DF /* JSDynamicsCompressorNode.cpp in Sources */,
    2546925473                                65DF31F909D1CC60000BE325 /* JSElement.cpp in Sources */,
Note: See TracChangeset for help on using the changeset viewer.