2013-01-24  Sharath Kamath  <kamath.sharath@gmail.com>

        WebCLMemoryObject must store a WebCLContext object as member.
        Issue #90

        Reviewed by Antonio.

        WebCLMemoryObject, WebCLBuffer, WebCLImage, WebCLMemoryObjectList needs change to
        store WebCLContext object.
        WebCLContext needs to modify create calls to above interface with "this" object.

        No new tests (OOPS!).

        * Modules/webcl/WebCLBuffer.cpp:
        (WebCore::WebCLBuffer::create):
        (WebCore::WebCLBuffer::WebCLBuffer):
        * Modules/webcl/WebCLBuffer.h:
        (WebCLBuffer):
        * Modules/webcl/WebCLContext.cpp:
        (WebCore::WebCLContext::createBuffer):
        (WebCore::WebCLContext::createImage2DBaseMemory):
        (WebCore::WebCLContext::createImage2DBaseImage):
        (WebCore::WebCLContext::createFromGLBuffer):
        (WebCore::WebCLContext::createFromGLRenderBuffer):
        (WebCore::WebCLContext::createFromGLTexture2D):
        * Modules/webcl/WebCLImage.cpp:
        (WebCore::WebCLImage::create):
        (WebCore::WebCLImage::WebCLImage):
        * Modules/webcl/WebCLImage.h:
        (WebCLImage):
        * Modules/webcl/WebCLMemoryObject.cpp:
        (WebCore::WebCLMemoryObject::create):
        (WebCore::WebCLMemoryObject::WebCLMemoryObject):
        * Modules/webcl/WebCLMemoryObject.h:
        (WebCore):
        (WebCLMemoryObject):
        * Modules/webcl/WebCLMemoryObjectList.cpp:
        (WebCore::WebCLMemoryObjectList::create):
        (WebCore::WebCLMemoryObjectList::WebCLMemoryObjectList):
        * Modules/webcl/WebCLMemoryObjectList.h:
        (WebCore):
        (WebCLMemoryObjectList):
2013-01-24  Sharath Kamath  <kamath.sharath@gmail.com>

        Memory leak in WebCL causing crash of safari.
        Issue #79
        Reviewed by Antonio.

        Since WebCLMemoryObject is base class and contains the cl_mem object, when we create a
        WebCLImage or a WebCLBuffer object the destructor in WebCLMemoryObject needs to be
        invoked to release the cl_mem object it holds.
        Without virtual destructor in the base classes, this cannot be achieved.
        Thus before this patch the memory objects created using createBuffer or createImage
        were not destroyed in the right way. Thus when we ran application that uses large
        number of memory objects ( eg the firework application, where position velocity and
        lifetime of thousands of particles are calculated in each time interval) the application
        crashes due to improper memory handling
        Making base class destructor virtual will call the base class destructor when a derived
        object is out of scope, destroying the cl_mem object calling opencl API.

        * Modules/webcl/WebCLBuffer.h:
        (WebCLBuffer):
        * Modules/webcl/WebCLImage.h:
        (WebCLImage):
        * Modules/webcl/WebCLMemoryObject.h:
        (WebCLMemoryObject):