2011-01-21 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jan 2011 19:33:41 +0000 (19:33 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jan 2011 19:33:41 +0000 (19:33 +0000)
commitcdd2f7f6f93e52f6578acd8f09191968a9503b2b
tree58e35a84833caf90a94a22bdb784b6d0e7dc5891
parent9cf0b0a624d041a0cacc70e35bb2a269d86d84f2
2011-01-21  Simon Fraser  <simon.fraser@apple.com>

        Reviewed by Sam Weinig.

        Report the sized used by canvases and types arrays
        https://bugs.webkit.org/show_bug.cgi?id=52856

        Report the memory cost associated with canvas elements,
        and typed arrays to JavaScript as extraCost, so that it
        can figure this into its GC behavior.

        * bindings/js/JSArrayBufferViewHelper.h:
        (WebCore::toJSArrayBufferView): New templatized function, similar
        to getDOMObjectWrapper() but calls reportExtraMemoryCost() with
        the byteLength of the array.

        * bindings/js/JSFloat32ArrayCustom.cpp:
        (WebCore::toJS): Use toJSArrayBufferView.
        * bindings/js/JSInt16ArrayCustom.cpp:
        (WebCore::toJS): Use toJSArrayBufferView.
        * bindings/js/JSInt32ArrayCustom.cpp:
        (WebCore::toJS): Use toJSArrayBufferView.
        * bindings/js/JSInt8ArrayCustom.cpp:
        (WebCore::toJS): Use toJSArrayBufferView.
        * bindings/js/JSUint16ArrayCustom.cpp:
        (WebCore::toJS): Use toJSArrayBufferView.
        * bindings/js/JSUint32ArrayCustom.cpp:
        (WebCore::toJS): Use toJSArrayBufferView.
        * bindings/js/JSUint8ArrayCustom.cpp:
        (WebCore::toJS): Use toJSArrayBufferView.

        * html/HTMLCanvasElement.cpp:
        (WebCore::HTMLCanvasElement::createImageBuffer): Call heap.reportExtraMemoryCost()
        with the size of the canvas backing store.

        * html/canvas/TypedArrayBase.h:
        (WebCore::TypedArrayBase::byteLength): byteLength needs to
        be public.

        * platform/graphics/ImageBuffer.h: Add dataSize() method.

        * platform/graphics/cairo/ImageBufferCairo.cpp:
        (WebCore::ImageBuffer::dataSize): Implement dataSize().
        * platform/graphics/cg/ImageBufferCG.cpp:
        (WebCore::ImageBuffer::dataSize): Implement dataSize().
        * platform/graphics/haiku/ImageBufferHaiku.cpp:
        (WebCore::ImageBuffer::dataSize): Implement dataSize().
        * platform/graphics/qt/ImageBufferQt.cpp:
        (WebCore::ImageBuffer::dataSize): Implement dataSize().
        * platform/graphics/skia/ImageBufferSkia.cpp:
        (WebCore::ImageBuffer::dataSize): Implement dataSize().
        * platform/graphics/wince/ImageBufferWinCE.cpp:
        (WebCore::ImageBuffer::dataSize): Implement dataSize().
        * platform/graphics/wx/ImageBufferWx.cpp:
        (WebCore::ImageBuffer::dataSize): Implement dataSize().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@76371 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSArrayBufferViewHelper.h
Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp
Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp
Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp
Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp
Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp
Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/html/canvas/TypedArrayBase.h
Source/WebCore/platform/graphics/ImageBuffer.h
Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
Source/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp
Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp
Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp
Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp