Title: [140145] trunk/Source/WebCore
Revision
140145
Author
[email protected]
Date
2013-01-18 07:19:55 -0800 (Fri, 18 Jan 2013)

Log Message

[EFL][WebGL] Fix Memory leaks in EGL and GLX surface.
https://bugs.webkit.org/show_bug.cgi?id=107100

Patch by Kondapally Kalyan <[email protected]> on 2013-01-18
Reviewed by Laszlo Gombos.

GLX and EGL surface don't release GL resources created by them.
This patch ensures that the leaks are fixed and
native display is not closed before releasing the current
context and surface.

* platform/graphics/efl/GraphicsContext3DPrivate.cpp:
(GraphicsContext3DPrivate::releaseResources):
* platform/graphics/surfaces/egl/EGLSurface.cpp:
(WebCore::EGLWindowTransportSurface::destroy): Call base class to free any allocated GL resources.
* platform/graphics/surfaces/glx/GLXContext.cpp:
(WebCore::GLXOffScreenContext::platformReleaseCurrent):
(WebCore::GLXOffScreenContext::freeResources): Don't reset the display to null.
* platform/graphics/surfaces/glx/GLXSurface.cpp:
(WebCore::GLXTransportSurface::destroy): Call base class to free any allocated GL resources.
(WebCore::GLXPBuffer::freeResources): Call base class to free any allocated GL resources.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (140144 => 140145)


--- trunk/Source/WebCore/ChangeLog	2013-01-18 15:19:43 UTC (rev 140144)
+++ trunk/Source/WebCore/ChangeLog	2013-01-18 15:19:55 UTC (rev 140145)
@@ -1,3 +1,26 @@
+2013-01-18  Kondapally Kalyan  <[email protected]>
+
+        [EFL][WebGL] Fix Memory leaks in EGL and GLX surface.
+        https://bugs.webkit.org/show_bug.cgi?id=107100
+
+        Reviewed by Laszlo Gombos.
+
+        GLX and EGL surface don't release GL resources created by them.
+        This patch ensures that the leaks are fixed and
+        native display is not closed before releasing the current
+        context and surface.
+
+        * platform/graphics/efl/GraphicsContext3DPrivate.cpp:
+        (GraphicsContext3DPrivate::releaseResources):
+        * platform/graphics/surfaces/egl/EGLSurface.cpp:
+        (WebCore::EGLWindowTransportSurface::destroy): Call base class to free any allocated GL resources.
+        * platform/graphics/surfaces/glx/GLXContext.cpp:
+        (WebCore::GLXOffScreenContext::platformReleaseCurrent):
+        (WebCore::GLXOffScreenContext::freeResources): Don't reset the display to null.
+        * platform/graphics/surfaces/glx/GLXSurface.cpp:
+        (WebCore::GLXTransportSurface::destroy): Call base class to free any allocated GL resources.
+        (WebCore::GLXPBuffer::freeResources): Call base class to free any allocated GL resources.
+
 2013-01-18  Andrey Adaikin  <[email protected]>
 
         Web Inspector: [Canvas] introduce Resource.toDataURL

Modified: trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp (140144 => 140145)


--- trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp	2013-01-18 15:19:43 UTC (rev 140144)
+++ trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp	2013-01-18 15:19:55 UTC (rev 140145)
@@ -74,14 +74,13 @@
 void GraphicsContext3DPrivate::releaseResources()
 {
     // Release the current context and drawable only after destroying any associated gl resources.
-    if (m_platformContext)
-        m_platformContext->destroy();
-
     if (m_platformSurface)
         m_platformSurface->destroy();
 
-    if (m_platformContext)
+    if (m_platformContext) {
+        m_platformContext->destroy();
         m_platformContext->releaseCurrent();
+    }
 }
 
 bool GraphicsContext3DPrivate::createSurface(PageClientEfl*, bool)

Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp (140144 => 140145)


--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp	2013-01-18 15:19:43 UTC (rev 140144)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp	2013-01-18 15:19:55 UTC (rev 140145)
@@ -108,10 +108,9 @@
 
 void EGLWindowTransportSurface::destroy()
 {
+    GLPlatformSurface::destroy();
     m_nativeResource->destroyWindow(m_bufferHandle);
     freeEGLResources();
-    m_nativeResource = nullptr;
-    m_configSelector = nullptr;
     m_bufferHandle = 0;
 }
 

Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.cpp (140144 => 140145)


--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.cpp	2013-01-18 15:19:43 UTC (rev 140144)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.cpp	2013-01-18 15:19:55 UTC (rev 140145)
@@ -110,6 +110,7 @@
 void GLXOffScreenContext::platformReleaseCurrent()
 {
     glXMakeCurrent(m_display, 0, 0);
+    m_display = 0;
 }
 
 void GLXOffScreenContext::freeResources()
@@ -118,7 +119,6 @@
         glXDestroyContext(m_display, m_contextHandle);
 
     m_contextHandle = 0;
-    m_display = 0;
 }
 
 void GLXOffScreenContext::destroy()

Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp (140144 => 140145)


--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp	2013-01-18 15:19:43 UTC (rev 140144)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp	2013-01-18 15:19:55 UTC (rev 140145)
@@ -96,13 +96,14 @@
 
 void GLXTransportSurface::destroy()
 {
+    GLPlatformSurface::destroy();
+
     if (m_bufferHandle) {
         m_nativeResource->destroyWindow(m_bufferHandle);
         m_bufferHandle = 0;
         m_drawable = 0;
     }
 
-    m_nativeResource = nullptr;
     m_configSelector = nullptr;
 }
 
@@ -168,7 +169,6 @@
     }
 
     m_configSelector = nullptr;
-    m_nativeResource = nullptr;
 }
 
 void GLXPBuffer::setGeometry(const IntRect& newRect)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to