Diff
Modified: trunk/Source/WebCore/ChangeLog (153449 => 153450)
--- trunk/Source/WebCore/ChangeLog 2013-07-30 00:20:03 UTC (rev 153449)
+++ trunk/Source/WebCore/ChangeLog 2013-07-30 00:25:33 UTC (rev 153450)
@@ -1,3 +1,20 @@
+2013-07-29 Alex Christensen <[email protected]>
+
+ Moved GLContext.cpp and .h out of cairo directory to be used by non-cairo ports.
+ https://bugs.webkit.org/show_bug.cgi?id=119223
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ * GNUmakefile.list.am:
+ * PlatformGTK.cmake:
+ * WebCore.vcxproj/WebCore.vcxproj:
+ * WebCore.vcxproj/WebCore.vcxproj.filters:
+ Changed location of GLContext.cpp and GLContext.h.
+ * platform/graphics/GLContext.cpp: Copied from WebCore/platform/graphics/cairo/GLContext.cpp.
+ * platform/graphics/GLContext.h: Copied from WebCore/platform/graphics/cairo/GLContext.h.
+ * platform/graphics/cairo/GLContext.cpp: Removed.
+ * platform/graphics/cairo/GLContext.h: Removed.
+
2013-07-29 Jer Noble <[email protected]>
TextTrackRepresentation captions often disappear then appear again.
Modified: trunk/Source/WebCore/GNUmakefile.list.am (153449 => 153450)
--- trunk/Source/WebCore/GNUmakefile.list.am 2013-07-30 00:20:03 UTC (rev 153449)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2013-07-30 00:25:33 UTC (rev 153450)
@@ -6304,8 +6304,8 @@
Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp
if USE_OPENGL
platformgtk_sources += \
- Source/WebCore/platform/graphics/cairo/GLContext.cpp \
- Source/WebCore/platform/graphics/cairo/GLContext.h \
+ Source/WebCore/platform/graphics/GLContext.cpp \
+ Source/WebCore/platform/graphics/GLContext.h \
Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp \
Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h
endif # END USE_OPENGL
Modified: trunk/Source/WebCore/PlatformGTK.cmake (153449 => 153450)
--- trunk/Source/WebCore/PlatformGTK.cmake 2013-07-30 00:20:03 UTC (rev 153449)
+++ trunk/Source/WebCore/PlatformGTK.cmake 2013-07-30 00:25:33 UTC (rev 153450)
@@ -119,7 +119,7 @@
platform/graphics/cairo/DrawingBufferCairo.cpp
platform/graphics/cairo/FontCairo.cpp
platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
- platform/graphics/cairo/GLContext.cpp
+ platform/graphics/GLContext.cpp
platform/graphics/cairo/GradientCairo.cpp
platform/graphics/cairo/GraphicsContext3DCairo.cpp
platform/graphics/cairo/GraphicsContext3DPrivate.cpp
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (153449 => 153450)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2013-07-30 00:20:03 UTC (rev 153449)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2013-07-30 00:25:33 UTC (rev 153450)
@@ -7368,7 +7368,7 @@
<ClCompile Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateAVCF.cpp" />
<ClCompile Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateLegacyAVCF.cpp" />
<ClCompile Include="..\platform\graphics\avfoundation\InbandTextTrackPrivateAVF.cpp" />
- <ClCompile Include="..\platform\graphics\cairo\GLContext.cpp">
+ <ClCompile Include="..\platform\graphics\GLContext.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
@@ -19232,7 +19232,7 @@
<ClInclude Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateAVCF.h" />
<ClInclude Include="..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateLegacyAVCF.h" />
<ClInclude Include="..\platform\graphics\avfoundation\InbandTextTrackPrivateAVF.h" />
- <ClInclude Include="..\platform\graphics\cairo\GLContext.h" />
+ <ClInclude Include="..\platform\graphics\GLContext.h" />
<ClInclude Include="..\platform\graphics\cairo\GraphicsContext3DPrivate.h" />
<ClInclude Include="..\platform\graphics\cg\SubimageCacheWithTimer.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (153449 => 153450)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2013-07-30 00:20:03 UTC (rev 153449)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2013-07-30 00:25:33 UTC (rev 153450)
@@ -7057,7 +7057,7 @@
<ClCompile Include="..\html\canvas\CanvasContextAttributes.cpp">
<Filter>html\canvas</Filter>
</ClCompile>
- <ClCompile Include="..\platform\graphics\cairo\GLContext.cpp">
+ <ClCompile Include="..\platform\graphics\GLContext.cpp">
<Filter>platform\graphics\cairo</Filter>
</ClCompile>
<ClCompile Include="..\platform\graphics\opengl\GraphicsContext3DOpenGLES.cpp">
@@ -14823,7 +14823,7 @@
<ClInclude Include="..\html\canvas\CanvasContextAttributes.h">
<Filter>html\canvas</Filter>
</ClInclude>
- <ClInclude Include="..\platform\graphics\cairo\GLContext.h">
+ <ClInclude Include="..\platform\graphics\GLContext.h">
<Filter>platform\graphics\cairo</Filter>
</ClInclude>
<ClInclude Include="..\platform\graphics\egl\GLContextEGL.h">
Copied: trunk/Source/WebCore/platform/graphics/GLContext.cpp (from rev 153449, trunk/Source/WebCore/platform/graphics/cairo/GLContext.cpp) (0 => 153450)
--- trunk/Source/WebCore/platform/graphics/GLContext.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/GLContext.cpp 2013-07-30 00:25:33 UTC (rev 153450)
@@ -0,0 +1,204 @@
+/*
+ * Copyright (C) 2011, 2012 Igalia, S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "GLContext.h"
+
+#if USE(OPENGL)
+
+#if USE(EGL)
+#include "GLContextEGL.h"
+#endif
+
+#if USE(GLX)
+#include "GLContextGLX.h"
+#endif
+
+#include <wtf/ThreadSpecific.h>
+
+#if PLATFORM(X11)
+#include <X11/Xlib.h>
+#endif
+
+#if PLATFORM(GTK)
+#include <gdk/gdk.h>
+#ifndef GTK_API_VERSION_2
+#ifdef GDK_WINDOWING_WAYLAND
+#include <gdk/gdkwayland.h>
+#endif
+#endif
+#endif
+
+using WTF::ThreadSpecific;
+
+namespace WebCore {
+
+class ThreadGlobalGLContext {
+public:
+ static ThreadSpecific<ThreadGlobalGLContext>* staticGLContext;
+
+ void setContext(GLContext* context) { m_context = context; }
+ GLContext* context() { return m_context; }
+
+private:
+ GLContext* m_context;
+};
+
+ThreadSpecific<ThreadGlobalGLContext>* ThreadGlobalGLContext::staticGLContext;
+
+inline ThreadGlobalGLContext* currentContext()
+{
+ if (!ThreadGlobalGLContext::staticGLContext)
+ ThreadGlobalGLContext::staticGLContext = new ThreadSpecific<ThreadGlobalGLContext>;
+ return *ThreadGlobalGLContext::staticGLContext;
+}
+
+GLContext* GLContext::sharingContext()
+{
+ DEFINE_STATIC_LOCAL(OwnPtr<GLContext>, sharing, (createOffscreenContext()));
+ return sharing.get();
+}
+
+#if PLATFORM(X11)
+// We do not want to call glXMakeContextCurrent using different Display pointers,
+// because it might lead to crashes in some drivers (fglrx). We use a shared display
+// pointer here.
+static Display* gSharedX11Display = 0;
+Display* GLContext::sharedX11Display()
+{
+ if (!gSharedX11Display)
+ gSharedX11Display = XOpenDisplay(0);
+ return gSharedX11Display;
+}
+
+void GLContext::cleanupSharedX11Display()
+{
+ if (!gSharedX11Display)
+ return;
+ XCloseDisplay(gSharedX11Display);
+ gSharedX11Display = 0;
+}
+#endif // PLATFORM(X11)
+
+// Because of driver bugs, exiting the program when there are active pbuffers
+// can crash the X server (this has been observed with the official Nvidia drivers).
+// We need to ensure that we clean everything up on exit. There are several reasons
+// that GraphicsContext3Ds will still be alive at exit, including user error (memory
+// leaks) and the page cache. In any case, we don't want the X server to crash.
+typedef Vector<GLContext*> ActiveContextList;
+static ActiveContextList& activeContextList()
+{
+ DEFINE_STATIC_LOCAL(ActiveContextList, activeContexts, ());
+ return activeContexts;
+}
+
+void GLContext::addActiveContext(GLContext* context)
+{
+ static bool addedAtExitHandler = false;
+ if (!addedAtExitHandler) {
+ atexit(&GLContext::cleanupActiveContextsAtExit);
+ addedAtExitHandler = true;
+ }
+ activeContextList().append(context);
+}
+
+static bool gCleaningUpAtExit = false;
+
+void GLContext::removeActiveContext(GLContext* context)
+{
+ // If we are cleaning up the context list at exit, don't bother removing the context
+ // from the list, since we don't want to modify the list while it's being iterated.
+ if (gCleaningUpAtExit)
+ return;
+
+ ActiveContextList& contextList = activeContextList();
+ size_t i = contextList.find(context);
+ if (i != notFound)
+ contextList.remove(i);
+}
+
+void GLContext::cleanupActiveContextsAtExit()
+{
+ gCleaningUpAtExit = true;
+
+ ActiveContextList& contextList = activeContextList();
+ for (size_t i = 0; i < contextList.size(); ++i)
+ delete contextList[i];
+
+#if PLATFORM(X11)
+ cleanupSharedX11Display();
+#endif
+}
+
+
+
+PassOwnPtr<GLContext> GLContext::createContextForWindow(uint64_t windowHandle, GLContext* sharingContext)
+{
+#if PLATFORM(GTK) && defined(GDK_WINDOWING_WAYLAND) && USE(EGL)
+ GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
+
+ if (GDK_IS_WAYLAND_DISPLAY(display)) {
+ if (OwnPtr<GLContext> eglContext = GLContextEGL::createContext(windowHandle, sharingContext))
+ return eglContext.release();
+ return nullptr;
+ }
+#endif
+
+#if USE(GLX)
+ if (OwnPtr<GLContext> glxContext = GLContextGLX::createContext(windowHandle, sharingContext))
+ return glxContext.release();
+#endif
+#if USE(EGL)
+ if (OwnPtr<GLContext> eglContext = GLContextEGL::createContext(windowHandle, sharingContext))
+ return eglContext.release();
+#endif
+ return nullptr;
+}
+
+GLContext::GLContext()
+{
+ addActiveContext(this);
+}
+
+PassOwnPtr<GLContext> GLContext::createOffscreenContext(GLContext* sharingContext)
+{
+ return createContextForWindow(0, sharingContext);
+}
+
+GLContext::~GLContext()
+{
+ if (this == currentContext()->context())
+ currentContext()->setContext(0);
+ removeActiveContext(this);
+}
+
+bool GLContext::makeContextCurrent()
+{
+ currentContext()->setContext(this);
+ return true;
+}
+
+GLContext* GLContext::getCurrent()
+{
+ return currentContext()->context();
+}
+
+} // namespace WebCore
+
+#endif // USE(OPENGL)
+
Copied: trunk/Source/WebCore/platform/graphics/GLContext.h (from rev 153449, trunk/Source/WebCore/platform/graphics/cairo/GLContext.h) (0 => 153450)
--- trunk/Source/WebCore/platform/graphics/GLContext.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/GLContext.h 2013-07-30 00:25:33 UTC (rev 153450)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef GLContext_h
+#define GLContext_h
+
+#include "GraphicsContext3D.h"
+#include "Widget.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
+
+#if USE(CAIRO)
+typedef struct _cairo_device cairo_device_t;
+#endif
+
+#if PLATFORM(X11)
+typedef struct _XDisplay Display;
+#endif
+
+namespace WebCore {
+
+class GLContext {
+ WTF_MAKE_NONCOPYABLE(GLContext);
+public:
+ static PassOwnPtr<GLContext> createContextForWindow(uint64_t windowHandle, GLContext* sharingContext);
+ static PassOwnPtr<GLContext> createOffscreenContext(GLContext* sharing = 0);
+ static GLContext* getCurrent();
+ static GLContext* sharingContext();
+
+ GLContext();
+ virtual ~GLContext();
+ virtual bool makeContextCurrent();
+ virtual void swapBuffers() = 0;
+ virtual void waitNative() = 0;
+ virtual bool canRenderToDefaultFramebuffer() = 0;
+ virtual IntSize defaultFrameBufferSize() = 0;
+
+#if USE(CAIRO)
+ virtual cairo_device_t* cairoDevice() = 0;
+#endif
+
+#if PLATFORM(X11)
+ static Display* sharedX11Display();
+ static void cleanupSharedX11Display();
+#endif
+
+ static void addActiveContext(GLContext*);
+ static void removeActiveContext(GLContext*);
+ static void cleanupActiveContextsAtExit();
+
+#if USE(3D_GRAPHICS)
+ virtual PlatformGraphicsContext3D platformContext() = 0;
+#endif
+};
+
+} // namespace WebCore
+
+#endif // GLContext_h
Deleted: trunk/Source/WebCore/platform/graphics/cairo/GLContext.cpp (153449 => 153450)
--- trunk/Source/WebCore/platform/graphics/cairo/GLContext.cpp 2013-07-30 00:20:03 UTC (rev 153449)
+++ trunk/Source/WebCore/platform/graphics/cairo/GLContext.cpp 2013-07-30 00:25:33 UTC (rev 153450)
@@ -1,204 +0,0 @@
-/*
- * Copyright (C) 2011, 2012 Igalia, S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "GLContext.h"
-
-#if USE(OPENGL)
-
-#if USE(EGL)
-#include "GLContextEGL.h"
-#endif
-
-#if USE(GLX)
-#include "GLContextGLX.h"
-#endif
-
-#include <wtf/ThreadSpecific.h>
-
-#if PLATFORM(X11)
-#include <X11/Xlib.h>
-#endif
-
-#if PLATFORM(GTK)
-#include <gdk/gdk.h>
-#ifndef GTK_API_VERSION_2
-#ifdef GDK_WINDOWING_WAYLAND
-#include <gdk/gdkwayland.h>
-#endif
-#endif
-#endif
-
-using WTF::ThreadSpecific;
-
-namespace WebCore {
-
-class ThreadGlobalGLContext {
-public:
- static ThreadSpecific<ThreadGlobalGLContext>* staticGLContext;
-
- void setContext(GLContext* context) { m_context = context; }
- GLContext* context() { return m_context; }
-
-private:
- GLContext* m_context;
-};
-
-ThreadSpecific<ThreadGlobalGLContext>* ThreadGlobalGLContext::staticGLContext;
-
-inline ThreadGlobalGLContext* currentContext()
-{
- if (!ThreadGlobalGLContext::staticGLContext)
- ThreadGlobalGLContext::staticGLContext = new ThreadSpecific<ThreadGlobalGLContext>;
- return *ThreadGlobalGLContext::staticGLContext;
-}
-
-GLContext* GLContext::sharingContext()
-{
- DEFINE_STATIC_LOCAL(OwnPtr<GLContext>, sharing, (createOffscreenContext()));
- return sharing.get();
-}
-
-#if PLATFORM(X11)
-// We do not want to call glXMakeContextCurrent using different Display pointers,
-// because it might lead to crashes in some drivers (fglrx). We use a shared display
-// pointer here.
-static Display* gSharedX11Display = 0;
-Display* GLContext::sharedX11Display()
-{
- if (!gSharedX11Display)
- gSharedX11Display = XOpenDisplay(0);
- return gSharedX11Display;
-}
-
-void GLContext::cleanupSharedX11Display()
-{
- if (!gSharedX11Display)
- return;
- XCloseDisplay(gSharedX11Display);
- gSharedX11Display = 0;
-}
-#endif // PLATFORM(X11)
-
-// Because of driver bugs, exiting the program when there are active pbuffers
-// can crash the X server (this has been observed with the official Nvidia drivers).
-// We need to ensure that we clean everything up on exit. There are several reasons
-// that GraphicsContext3Ds will still be alive at exit, including user error (memory
-// leaks) and the page cache. In any case, we don't want the X server to crash.
-typedef Vector<GLContext*> ActiveContextList;
-static ActiveContextList& activeContextList()
-{
- DEFINE_STATIC_LOCAL(ActiveContextList, activeContexts, ());
- return activeContexts;
-}
-
-void GLContext::addActiveContext(GLContext* context)
-{
- static bool addedAtExitHandler = false;
- if (!addedAtExitHandler) {
- atexit(&GLContext::cleanupActiveContextsAtExit);
- addedAtExitHandler = true;
- }
- activeContextList().append(context);
-}
-
-static bool gCleaningUpAtExit = false;
-
-void GLContext::removeActiveContext(GLContext* context)
-{
- // If we are cleaning up the context list at exit, don't bother removing the context
- // from the list, since we don't want to modify the list while it's being iterated.
- if (gCleaningUpAtExit)
- return;
-
- ActiveContextList& contextList = activeContextList();
- size_t i = contextList.find(context);
- if (i != notFound)
- contextList.remove(i);
-}
-
-void GLContext::cleanupActiveContextsAtExit()
-{
- gCleaningUpAtExit = true;
-
- ActiveContextList& contextList = activeContextList();
- for (size_t i = 0; i < contextList.size(); ++i)
- delete contextList[i];
-
-#if PLATFORM(X11)
- cleanupSharedX11Display();
-#endif
-}
-
-
-
-PassOwnPtr<GLContext> GLContext::createContextForWindow(uint64_t windowHandle, GLContext* sharingContext)
-{
-#if PLATFORM(GTK) && defined(GDK_WINDOWING_WAYLAND) && USE(EGL)
- GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
-
- if (GDK_IS_WAYLAND_DISPLAY(display)) {
- if (OwnPtr<GLContext> eglContext = GLContextEGL::createContext(windowHandle, sharingContext))
- return eglContext.release();
- return nullptr;
- }
-#endif
-
-#if USE(GLX)
- if (OwnPtr<GLContext> glxContext = GLContextGLX::createContext(windowHandle, sharingContext))
- return glxContext.release();
-#endif
-#if USE(EGL)
- if (OwnPtr<GLContext> eglContext = GLContextEGL::createContext(windowHandle, sharingContext))
- return eglContext.release();
-#endif
- return nullptr;
-}
-
-GLContext::GLContext()
-{
- addActiveContext(this);
-}
-
-PassOwnPtr<GLContext> GLContext::createOffscreenContext(GLContext* sharingContext)
-{
- return createContextForWindow(0, sharingContext);
-}
-
-GLContext::~GLContext()
-{
- if (this == currentContext()->context())
- currentContext()->setContext(0);
- removeActiveContext(this);
-}
-
-bool GLContext::makeContextCurrent()
-{
- currentContext()->setContext(this);
- return true;
-}
-
-GLContext* GLContext::getCurrent()
-{
- return currentContext()->context();
-}
-
-} // namespace WebCore
-
-#endif // USE(OPENGL)
-
Deleted: trunk/Source/WebCore/platform/graphics/cairo/GLContext.h (153449 => 153450)
--- trunk/Source/WebCore/platform/graphics/cairo/GLContext.h 2013-07-30 00:20:03 UTC (rev 153449)
+++ trunk/Source/WebCore/platform/graphics/cairo/GLContext.h 2013-07-30 00:25:33 UTC (rev 153450)
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2012 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef GLContext_h
-#define GLContext_h
-
-#include "GraphicsContext3D.h"
-#include "Widget.h"
-#include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
-
-#if USE(CAIRO)
-typedef struct _cairo_device cairo_device_t;
-#endif
-
-#if PLATFORM(X11)
-typedef struct _XDisplay Display;
-#endif
-
-namespace WebCore {
-
-class GLContext {
- WTF_MAKE_NONCOPYABLE(GLContext);
-public:
- static PassOwnPtr<GLContext> createContextForWindow(uint64_t windowHandle, GLContext* sharingContext);
- static PassOwnPtr<GLContext> createOffscreenContext(GLContext* sharing = 0);
- static GLContext* getCurrent();
- static GLContext* sharingContext();
-
- GLContext();
- virtual ~GLContext();
- virtual bool makeContextCurrent();
- virtual void swapBuffers() = 0;
- virtual void waitNative() = 0;
- virtual bool canRenderToDefaultFramebuffer() = 0;
- virtual IntSize defaultFrameBufferSize() = 0;
-
-#if USE(CAIRO)
- virtual cairo_device_t* cairoDevice() = 0;
-#endif
-
-#if PLATFORM(X11)
- static Display* sharedX11Display();
- static void cleanupSharedX11Display();
-#endif
-
- static void addActiveContext(GLContext*);
- static void removeActiveContext(GLContext*);
- static void cleanupActiveContextsAtExit();
-
-#if USE(3D_GRAPHICS)
- virtual PlatformGraphicsContext3D platformContext() = 0;
-#endif
-};
-
-} // namespace WebCore
-
-#endif // GLContext_h