Title: [136207] trunk/Source
Revision
136207
Author
[email protected]
Date
2012-11-29 22:41:40 -0800 (Thu, 29 Nov 2012)

Log Message

[GTK] [WebKit2] WebKitWebViewBase creates a GL context for the redirected XComposite window crashing WebKit in Xvfb
https://bugs.webkit.org/show_bug.cgi?id=103476

Reviewed by Alejandro G. Castro.

Source/WebCore:

Allow creation of RedirectedXCompositeWindow in a mode which does not have a backing
GLContext. For WebKit2 the GLContext is always in the WebProcess. Creating the GLContext
in both processes can cause crashes when library is run in Xvfb.

No new tests. This fixes a crash running tests on some systems.

* platform/gtk/RedirectedXCompositeWindow.cpp:
(WebCore::RedirectedXCompositeWindow::RedirectedXCompositeWindow):
(WebCore::RedirectedXCompositeWindow::resize): Do not create the GLContext when
in the new no-GLContext mode.
(WebCore::RedirectedXCompositeWindow::context): ASSERT that we are not in
no-GLContext mode.

Source/WebKit2:

Create the RedirectedXCompositeWindow with an argument specifying that it
should never have a GLContext backing it.

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136206 => 136207)


--- trunk/Source/WebCore/ChangeLog	2012-11-30 06:15:58 UTC (rev 136206)
+++ trunk/Source/WebCore/ChangeLog	2012-11-30 06:41:40 UTC (rev 136207)
@@ -1,3 +1,23 @@
+2012-11-29  Martin Robinson  <[email protected]>
+
+        [GTK] [WebKit2] WebKitWebViewBase creates a GL context for the redirected XComposite window crashing WebKit in Xvfb
+        https://bugs.webkit.org/show_bug.cgi?id=103476
+
+        Reviewed by Alejandro G. Castro.
+
+        Allow creation of RedirectedXCompositeWindow in a mode which does not have a backing
+        GLContext. For WebKit2 the GLContext is always in the WebProcess. Creating the GLContext
+        in both processes can cause crashes when library is run in Xvfb.
+
+        No new tests. This fixes a crash running tests on some systems.
+
+        * platform/gtk/RedirectedXCompositeWindow.cpp:
+        (WebCore::RedirectedXCompositeWindow::RedirectedXCompositeWindow):
+        (WebCore::RedirectedXCompositeWindow::resize): Do not create the GLContext when
+        in the new no-GLContext mode.
+        (WebCore::RedirectedXCompositeWindow::context): ASSERT that we are not in
+        no-GLContext mode.
+
 2012-11-29  Keishi Hattori  <[email protected]>
 
         Better type ahead for DateTimeSymbolicFieldElement

Modified: trunk/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp (136206 => 136207)


--- trunk/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp	2012-11-30 06:15:58 UTC (rev 136206)
+++ trunk/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp	2012-11-30 06:41:40 UTC (rev 136207)
@@ -92,16 +92,17 @@
     return true;
 }
 
-PassOwnPtr<RedirectedXCompositeWindow> RedirectedXCompositeWindow::create(const IntSize& size)
+PassOwnPtr<RedirectedXCompositeWindow> RedirectedXCompositeWindow::create(const IntSize& size, GLContextNeeded needsContext)
 {
-    return supportsXDamageAndXComposite() ? adoptPtr(new RedirectedXCompositeWindow(size)) : nullptr;
+    return supportsXDamageAndXComposite() ? adoptPtr(new RedirectedXCompositeWindow(size, needsContext)) : nullptr;
 }
 
-RedirectedXCompositeWindow::RedirectedXCompositeWindow(const IntSize& size)
+RedirectedXCompositeWindow::RedirectedXCompositeWindow(const IntSize& size, GLContextNeeded needsContext)
     : m_size(size)
     , m_window(0)
     , m_parentWindow(0)
     , m_pixmap(0)
+    , m_needsContext(needsContext)
     , m_surface(0)
     , m_needsNewPixmapAfterResize(false)
     , m_damage(0)
@@ -176,12 +177,14 @@
     XResizeWindow(display, m_window, size.width(), size.height());
 
     XFlush(display);
-    context()->waitNative();
 
-    // This swap is based on code in Chromium. It tries to work-around a bug in the Intel drivers
-    // where a swap is necessary to ensure the front and back buffers are properly resized.
-    if (context() == GLContext::getCurrent())
-        context()->swapBuffers();
+    if (m_needsContext == CreateGLContext) {
+        context()->waitNative();
+        // This swap is based on code in Chromium. It tries to work-around a bug in the Intel drivers
+        // where a swap is necessary to ensure the front and back buffers are properly resized.
+        if (context() == GLContext::getCurrent())
+            context()->swapBuffers();
+    }
 
     m_size = size;
     m_needsNewPixmapAfterResize = true;
@@ -189,6 +192,8 @@
 
 GLContext* RedirectedXCompositeWindow::context()
 {
+    ASSERT(m_needsContext);
+
     if (m_context)
         return m_context.get();
 

Modified: trunk/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h (136206 => 136207)


--- trunk/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h	2012-11-30 06:15:58 UTC (rev 136206)
+++ trunk/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h	2012-11-30 06:41:40 UTC (rev 136207)
@@ -42,7 +42,8 @@
 
 class RedirectedXCompositeWindow {
 public:
-    static PassOwnPtr<RedirectedXCompositeWindow> create(const IntSize&);
+    enum GLContextNeeded { CreateGLContext, DoNotCreateGLContext };
+    static PassOwnPtr<RedirectedXCompositeWindow> create(const IntSize&, GLContextNeeded = CreateGLContext);
     virtual ~RedirectedXCompositeWindow();
     const IntSize& size() { return m_size; }
 
@@ -59,13 +60,14 @@
     }
 
 private:
-    RedirectedXCompositeWindow(const IntSize&);
+    RedirectedXCompositeWindow(const IntSize&, GLContextNeeded);
     void cleanupPixmapAndPixmapSurface();
 
     IntSize m_size;
     Window m_window;
     Window m_parentWindow;
     Pixmap m_pixmap;
+    GLContextNeeded m_needsContext;
     OwnPtr<GLContext> m_context;
     RefPtr<cairo_surface_t> m_surface;
     unsigned int m_pendingResizeSourceId;

Modified: trunk/Source/WebKit2/ChangeLog (136206 => 136207)


--- trunk/Source/WebKit2/ChangeLog	2012-11-30 06:15:58 UTC (rev 136206)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-30 06:41:40 UTC (rev 136207)
@@ -1,3 +1,16 @@
+2012-11-29  Martin Robinson  <[email protected]>
+
+        [GTK] [WebKit2] WebKitWebViewBase creates a GL context for the redirected XComposite window crashing WebKit in Xvfb
+        https://bugs.webkit.org/show_bug.cgi?id=103476
+
+        Reviewed by Alejandro G. Castro.
+
+        Create the RedirectedXCompositeWindow with an argument specifying that it
+        should never have a GLContext backing it.
+
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate):
+
 2012-11-29  Rafael Weinstein  <[email protected]>
 
         [HTMLTemplateElement] Add feature flag

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (136206 => 136207)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2012-11-30 06:15:58 UTC (rev 136206)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2012-11-30 06:41:40 UTC (rev 136207)
@@ -83,7 +83,7 @@
     _WebKitWebViewBasePrivate()
         : imContext(adoptGRef(gtk_im_multicontext_new()))
 #if USE(TEXTURE_MAPPER_GL)
-        , redirectedWindow(RedirectedXCompositeWindow::create(IntSize(1, 1)))
+        , redirectedWindow(RedirectedXCompositeWindow::create(IntSize(1, 1), RedirectedXCompositeWindow::DoNotCreateGLContext))
 #endif
     {
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to