<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[188522] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/188522">188522</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-08-17 08:36:16 -0700 (Mon, 17 Aug 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix possible EGL and GLX makeCurrent problem of GLPlatformContext and GLPlatformSurface
https://bugs.webkit.org/show_bug.cgi?id=147695

Patch by Jinyoung Hur &lt;hur.ims@navercorp.com&gt; on 2015-08-17
Reviewed by Gyuyoung Kim.

GLPLatformContext::makeCurrent is implemented to do no-op when it thinks, comparing with a static
variable declared in GLPlatformContext.cpp, there is no changes. This can lead to not-working
makeCurrent when other part of codes, e.g., Cairo-gl, change EGL or GLX current context by calling
something like eglMakeCurrent. So modify GLPLatformContext::makeCurrent to use the return value of
eglGetCurrentContext or glXGetCurrentContext as a comparing target rather than a static variable.
In addition, GLPlatformSurface::isCurrentDrawable is also modified to use eglGetCurrentSurface or
glXGetCurrentDrawable rather than a static variable.

There are no tests because already existing GL tests will verify this change.

* platform/graphics/opengl/GLPlatformContext.cpp:
(WebCore::GLPlatformContext::makeCurrent):
(WebCore::GLPlatformContext::releaseCurrent):
(WebCore::GLCurrentContextWrapper::GLCurrentContextWrapper): Deleted.
(WebCore::GLPlatformContext::~GLPlatformContext): Deleted.
(WebCore::GLPlatformContext::isCurrentContext): Deleted.
(WebCore::GLPlatformContext::getCurrent): Deleted.
* platform/graphics/opengl/GLPlatformContext.h:
* platform/graphics/opengl/GLPlatformSurface.cpp:
(WebCore::GLPlatformSurface::~GLPlatformSurface): Deleted.
(WebCore::GLPlatformSurface::isCurrentDrawable): Deleted.
(WebCore::GLPlatformSurface::onMakeCurrent): Deleted.
(WebCore::GLPlatformSurface::destroy): Deleted.
* platform/graphics/opengl/GLPlatformSurface.h:
* platform/graphics/surfaces/egl/EGLSurface.cpp:
(WebCore::EGLTransportSurface::isCurrentDrawable):
(WebCore::EGLOffScreenSurface::isCurrentDrawable):
* platform/graphics/surfaces/egl/EGLSurface.h:
* platform/graphics/surfaces/glx/GLXSurface.cpp:
(WebCore::GLXTransportSurface::isCurrentContext):
(WebCore::GLXOffScreenSurface::isCurrentContext):
* platform/graphics/surfaces/glx/GLXSurface.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGLPlatformContextcpp">trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGLPlatformContexth">trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGLPlatformSurfacecpp">trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGLPlatformSurfaceh">trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicssurfaceseglEGLSurfacecpp">trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicssurfaceseglEGLSurfaceh">trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicssurfacesglxGLXSurfacecpp">trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicssurfacesglxGLXSurfaceh">trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (188521 => 188522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-08-17 00:52:50 UTC (rev 188521)
+++ trunk/Source/WebCore/ChangeLog        2015-08-17 15:36:16 UTC (rev 188522)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2015-08-17  Jinyoung Hur  &lt;hur.ims@navercorp.com&gt;
+
+        Fix possible EGL and GLX makeCurrent problem of GLPlatformContext and GLPlatformSurface
+        https://bugs.webkit.org/show_bug.cgi?id=147695
+
+        Reviewed by Gyuyoung Kim.
+
+        GLPLatformContext::makeCurrent is implemented to do no-op when it thinks, comparing with a static
+        variable declared in GLPlatformContext.cpp, there is no changes. This can lead to not-working 
+        makeCurrent when other part of codes, e.g., Cairo-gl, change EGL or GLX current context by calling
+        something like eglMakeCurrent. So modify GLPLatformContext::makeCurrent to use the return value of
+        eglGetCurrentContext or glXGetCurrentContext as a comparing target rather than a static variable.
+        In addition, GLPlatformSurface::isCurrentDrawable is also modified to use eglGetCurrentSurface or
+        glXGetCurrentDrawable rather than a static variable.
+
+        There are no tests because already existing GL tests will verify this change.
+
+        * platform/graphics/opengl/GLPlatformContext.cpp:
+        (WebCore::GLPlatformContext::makeCurrent):
+        (WebCore::GLPlatformContext::releaseCurrent):
+        (WebCore::GLCurrentContextWrapper::GLCurrentContextWrapper): Deleted.
+        (WebCore::GLPlatformContext::~GLPlatformContext): Deleted.
+        (WebCore::GLPlatformContext::isCurrentContext): Deleted.
+        (WebCore::GLPlatformContext::getCurrent): Deleted.
+        * platform/graphics/opengl/GLPlatformContext.h:
+        * platform/graphics/opengl/GLPlatformSurface.cpp:
+        (WebCore::GLPlatformSurface::~GLPlatformSurface): Deleted.
+        (WebCore::GLPlatformSurface::isCurrentDrawable): Deleted.
+        (WebCore::GLPlatformSurface::onMakeCurrent): Deleted.
+        (WebCore::GLPlatformSurface::destroy): Deleted.
+        * platform/graphics/opengl/GLPlatformSurface.h:
+        * platform/graphics/surfaces/egl/EGLSurface.cpp:
+        (WebCore::EGLTransportSurface::isCurrentDrawable):
+        (WebCore::EGLOffScreenSurface::isCurrentDrawable):
+        * platform/graphics/surfaces/egl/EGLSurface.h:
+        * platform/graphics/surfaces/glx/GLXSurface.cpp:
+        (WebCore::GLXTransportSurface::isCurrentContext):
+        (WebCore::GLXOffScreenSurface::isCurrentContext):
+        * platform/graphics/surfaces/glx/GLXSurface.h:
+
</ins><span class="cx"> 2015-08-15  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Refactor HTMLCollection to be as fast as CachedLiveNodeList
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGLPlatformContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp (188521 => 188522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp        2015-08-17 00:52:50 UTC (rev 188521)
+++ trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp        2015-08-17 15:36:16 UTC (rev 188522)
</span><span class="lines">@@ -43,7 +43,6 @@
</span><span class="cx"> #else
</span><span class="cx"> static PFNGLGETGRAPHICSRESETSTATUSARBPROC glGetGraphicsResetStatus = 0;
</span><span class="cx"> #endif
</span><del>-static GLPlatformContext* m_currentContext = 0;
</del><span class="cx"> 
</span><span class="cx"> class GLCurrentContextWrapper : public GLPlatformContext {
</span><span class="cx"> 
</span><span class="lines">@@ -56,11 +55,14 @@
</span><span class="cx"> #elif USE(EGL)
</span><span class="cx">         m_contextHandle = eglGetCurrentContext();
</span><span class="cx"> #endif
</span><del>-        if (m_contextHandle)
-            m_currentContext = this;
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     virtual ~GLCurrentContextWrapper() { }
</span><ins>+
+    bool isCurrentContext() const override
+    {
+        return true;
+    }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> static std::unique_ptr&lt;GLPlatformContext&gt; createOffScreenContext()
</span><span class="lines">@@ -185,23 +187,21 @@
</span><span class="cx"> 
</span><span class="cx"> GLPlatformContext::~GLPlatformContext()
</span><span class="cx"> {
</span><del>-    if (this == m_currentContext)
-        m_currentContext = 0;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool GLPlatformContext::makeCurrent(GLPlatformSurface* surface)
</span><span class="cx"> {
</span><span class="cx">     m_contextLost = false;
</span><span class="cx"> 
</span><del>-    if (m_currentContext == this &amp;&amp; (!surface || surface-&gt;isCurrentDrawable()))
</del><ins>+    if (isCurrentContext() &amp;&amp; (!surface || surface-&gt;isCurrentDrawable()))
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    m_currentContext = 0;
</del><ins>+    GLPlatformContext* currentContext = 0;
</ins><span class="cx"> 
</span><span class="cx">     if (!surface || (surface &amp;&amp; !surface-&gt;drawable()))
</span><span class="cx">         platformReleaseCurrent();
</span><span class="cx">     else if (platformMakeCurrent(surface)) {
</span><del>-        m_currentContext = this;
</del><ins>+        currentContext = this;
</ins><span class="cx">         surface-&gt;onMakeCurrent();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -228,7 +228,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return m_currentContext;
</del><ins>+    return currentContext;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool GLPlatformContext::isValid() const
</span><span class="lines">@@ -238,10 +238,8 @@
</span><span class="cx"> 
</span><span class="cx"> void GLPlatformContext::releaseCurrent()
</span><span class="cx"> {
</span><del>-    if (this == m_currentContext) {
-        m_currentContext = 0;
</del><ins>+    if (isCurrentContext())
</ins><span class="cx">         platformReleaseCurrent();
</span><del>-    }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PlatformContext GLPlatformContext::handle() const
</span><span class="lines">@@ -249,21 +247,11 @@
</span><span class="cx">     return m_contextHandle;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool GLPlatformContext::isCurrentContext() const
-{
-    return true;
-}
-
</del><span class="cx"> bool GLPlatformContext::initialize(GLPlatformSurface*, PlatformContext)
</span><span class="cx"> {
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLPlatformContext* GLPlatformContext::getCurrent()
-{
-    return m_currentContext;
-}
-
</del><span class="cx"> bool GLPlatformContext::platformMakeCurrent(GLPlatformSurface*)
</span><span class="cx"> {
</span><span class="cx">     return true;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGLPlatformContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.h (188521 => 188522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.h        2015-08-17 00:52:50 UTC (rev 188521)
+++ trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.h        2015-08-17 15:36:16 UTC (rev 188522)
</span><span class="lines">@@ -73,15 +73,13 @@
</span><span class="cx"> 
</span><span class="cx">     virtual PlatformContext handle() const;
</span><span class="cx"> 
</span><del>-    virtual bool isCurrentContext() const;
</del><ins>+    virtual bool isCurrentContext() const = 0;
</ins><span class="cx"> 
</span><span class="cx">     bool isValid() const;
</span><span class="cx"> 
</span><span class="cx">     // Destroys any GL resources associated with this context.
</span><span class="cx">     virtual void destroy();
</span><span class="cx"> 
</span><del>-    static GLPlatformContext* getCurrent();
-
</del><span class="cx"> protected:
</span><span class="cx">     GLPlatformContext();
</span><span class="cx">     virtual bool platformMakeCurrent(GLPlatformSurface*);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGLPlatformSurfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp (188521 => 188522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp        2015-08-17 00:52:50 UTC (rev 188521)
+++ trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp        2015-08-17 15:36:16 UTC (rev 188522)
</span><span class="lines">@@ -40,8 +40,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static GLPlatformSurface* m_currentDrawable = 0;
-
</del><span class="cx"> std::unique_ptr&lt;GLPlatformSurface&gt; GLPlatformSurface::createOffScreenSurface(SurfaceAttributes attributes)
</span><span class="cx"> {
</span><span class="cx">     std::unique_ptr&lt;GLPlatformSurface&gt; surface;
</span><span class="lines">@@ -68,8 +66,6 @@
</span><span class="cx"> 
</span><span class="cx"> GLPlatformSurface::~GLPlatformSurface()
</span><span class="cx"> {
</span><del>-    if (m_currentDrawable == this)
-        m_currentDrawable = 0;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PlatformBufferHandle GLPlatformSurface::handle() const
</span><span class="lines">@@ -97,14 +93,8 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool GLPlatformSurface::isCurrentDrawable() const
-{
-    return m_currentDrawable == this;
-}
-
</del><span class="cx"> void GLPlatformSurface::onMakeCurrent()
</span><span class="cx"> {
</span><del>-    m_currentDrawable = this;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GLPlatformSurface::updateContents(const uint32_t)
</span><span class="lines">@@ -117,8 +107,6 @@
</span><span class="cx"> 
</span><span class="cx"> void GLPlatformSurface::destroy()
</span><span class="cx"> {
</span><del>-    if (m_currentDrawable == this)
-        m_currentDrawable = 0;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> GLPlatformSurface::SurfaceAttributes GLPlatformSurface::attributes() const
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGLPlatformSurfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h (188521 => 188522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h        2015-08-17 00:52:50 UTC (rev 188521)
+++ trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h        2015-08-17 15:36:16 UTC (rev 188522)
</span><span class="lines">@@ -63,7 +63,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void swapBuffers();
</span><span class="cx"> 
</span><del>-    virtual bool isCurrentDrawable() const;
</del><ins>+    virtual bool isCurrentDrawable() const = 0;
+
</ins><span class="cx">     virtual void onMakeCurrent();
</span><span class="cx"> 
</span><span class="cx">     // Convenience Function to update surface backbuffer with texture contents.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicssurfaceseglEGLSurfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp (188521 => 188522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp        2015-08-17 00:52:50 UTC (rev 188521)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp        2015-08-17 15:36:16 UTC (rev 188522)
</span><span class="lines">@@ -86,6 +86,11 @@
</span><span class="cx">     return m_configSelector-&gt;attributes();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool EGLTransportSurface::isCurrentDrawable() const
+{
+    return m_drawable == eglGetCurrentSurface(EGL_DRAW);
+}
+
</ins><span class="cx"> EGLTransportSurface::~EGLTransportSurface()
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -138,6 +143,11 @@
</span><span class="cx">     return m_configSelector-&gt;attributes();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool EGLOffScreenSurface::isCurrentDrawable() const
+{
+    return m_drawable == eglGetCurrentSurface(EGL_DRAW);
+}
+
</ins><span class="cx"> PlatformSurfaceConfig EGLOffScreenSurface::configuration()
</span><span class="cx"> {
</span><span class="cx">     return m_configSelector-&gt;pixmapContextConfig();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicssurfaceseglEGLSurfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.h (188521 => 188522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.h        2015-08-17 00:52:50 UTC (rev 188521)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.h        2015-08-17 15:36:16 UTC (rev 188522)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx">     virtual PlatformSurfaceConfig configuration() override;
</span><span class="cx">     virtual void destroy() override;
</span><span class="cx">     virtual GLPlatformSurface::SurfaceAttributes attributes() const override;
</span><ins>+    virtual bool isCurrentDrawable() const override;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     EGLTransportSurface(const IntSize&amp;, SurfaceAttributes);
</span><span class="lines">@@ -57,6 +58,7 @@
</span><span class="cx">     virtual PlatformSurfaceConfig configuration() override;
</span><span class="cx">     virtual void destroy() override;
</span><span class="cx">     virtual GLPlatformSurface::SurfaceAttributes attributes() const override;
</span><ins>+    virtual bool isCurrentDrawable() const override;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     EGLOffScreenSurface(SurfaceAttributes);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicssurfacesglxGLXSurfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp (188521 => 188522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp        2015-08-17 00:52:50 UTC (rev 188521)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp        2015-08-17 15:36:16 UTC (rev 188522)
</span><span class="lines">@@ -128,6 +128,11 @@
</span><span class="cx">     return m_configSelector-&gt;attributes();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool GLXTransportSurface::isCurrentDrawable() const
+{
+    return m_drawable == glXGetCurrentDrawable();
+}
+
</ins><span class="cx"> GLXOffScreenSurface::GLXOffScreenSurface(SurfaceAttributes surfaceAttributes)
</span><span class="cx">     : GLPlatformSurface(surfaceAttributes)
</span><span class="cx">     , m_pixmap(0)
</span><span class="lines">@@ -167,6 +172,11 @@
</span><span class="cx">     return m_configSelector-&gt;pixmapContextConfig();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool GLXOffScreenSurface::isCurrentDrawable() const
+{
+    return m_drawable == glXGetCurrentDrawable();
+}
+
</ins><span class="cx"> void GLXOffScreenSurface::destroy()
</span><span class="cx"> {
</span><span class="cx">     freeResources();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicssurfacesglxGLXSurfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.h (188521 => 188522)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.h        2015-08-17 00:52:50 UTC (rev 188521)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.h        2015-08-17 15:36:16 UTC (rev 188522)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx">     virtual void swapBuffers() override;
</span><span class="cx">     virtual void setGeometry(const IntRect&amp;) override;
</span><span class="cx">     virtual GLPlatformSurface::SurfaceAttributes attributes() const override;
</span><ins>+    virtual bool isCurrentDrawable() const override;
</ins><span class="cx">     virtual void destroy() override;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -55,6 +56,7 @@
</span><span class="cx">     GLXOffScreenSurface(SurfaceAttributes);
</span><span class="cx">     virtual ~GLXOffScreenSurface();
</span><span class="cx">     virtual PlatformSurfaceConfig configuration() override;
</span><ins>+    virtual bool isCurrentDrawable() const override;
</ins><span class="cx">     virtual void destroy() override;
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre>
</div>
</div>

</body>
</html>