⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 136207 in webkit


Ignore:
Timestamp:
Nov 29, 2012, 10:41:40 PM (14 years ago)
Author:
Martin Robinson
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):

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r136205 r136207  
     12012-11-29  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] [WebKit2] WebKitWebViewBase creates a GL context for the redirected XComposite window crashing WebKit in Xvfb
     4        https://bugs.webkit.org/show_bug.cgi?id=103476
     5
     6        Reviewed by Alejandro G. Castro.
     7
     8        Allow creation of RedirectedXCompositeWindow in a mode which does not have a backing
     9        GLContext. For WebKit2 the GLContext is always in the WebProcess. Creating the GLContext
     10        in both processes can cause crashes when library is run in Xvfb.
     11
     12        No new tests. This fixes a crash running tests on some systems.
     13
     14        * platform/gtk/RedirectedXCompositeWindow.cpp:
     15        (WebCore::RedirectedXCompositeWindow::RedirectedXCompositeWindow):
     16        (WebCore::RedirectedXCompositeWindow::resize): Do not create the GLContext when
     17        in the new no-GLContext mode.
     18        (WebCore::RedirectedXCompositeWindow::context): ASSERT that we are not in
     19        no-GLContext mode.
     20
    1212012-11-29  Keishi Hattori  <keishi@webkit.org>
    222
  • trunk/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp

    r132823 r136207  
    9393}
    9494
    95 PassOwnPtr<RedirectedXCompositeWindow> RedirectedXCompositeWindow::create(const IntSize& size)
    96 {
    97     return supportsXDamageAndXComposite() ? adoptPtr(new RedirectedXCompositeWindow(size)) : nullptr;
    98 }
    99 
    100 RedirectedXCompositeWindow::RedirectedXCompositeWindow(const IntSize& size)
     95PassOwnPtr<RedirectedXCompositeWindow> RedirectedXCompositeWindow::create(const IntSize& size, GLContextNeeded needsContext)
     96{
     97    return supportsXDamageAndXComposite() ? adoptPtr(new RedirectedXCompositeWindow(size, needsContext)) : nullptr;
     98}
     99
     100RedirectedXCompositeWindow::RedirectedXCompositeWindow(const IntSize& size, GLContextNeeded needsContext)
    101101    : m_size(size)
    102102    , m_window(0)
    103103    , m_parentWindow(0)
    104104    , m_pixmap(0)
     105    , m_needsContext(needsContext)
    105106    , m_surface(0)
    106107    , m_needsNewPixmapAfterResize(false)
    … …  
    177178
    178179    XFlush(display);
    179     context()->waitNative();
    180 
    181     // This swap is based on code in Chromium. It tries to work-around a bug in the Intel drivers
    182     // where a swap is necessary to ensure the front and back buffers are properly resized.
    183     if (context() == GLContext::getCurrent())
    184         context()->swapBuffers();
     180
     181    if (m_needsContext == CreateGLContext) {
     182        context()->waitNative();
     183        // This swap is based on code in Chromium. It tries to work-around a bug in the Intel drivers
     184        // where a swap is necessary to ensure the front and back buffers are properly resized.
     185        if (context() == GLContext::getCurrent())
     186            context()->swapBuffers();
     187    }
    185188
    186189    m_size = size;
    … …  
    190193GLContext* RedirectedXCompositeWindow::context()
    191194{
     195    ASSERT(m_needsContext);
     196
    192197    if (m_context)
    193198        return m_context.get();
  • trunk/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h

    r130525 r136207  
    4343class RedirectedXCompositeWindow {
    4444public:
    45     static PassOwnPtr<RedirectedXCompositeWindow> create(const IntSize&);
     45    enum GLContextNeeded { CreateGLContext, DoNotCreateGLContext };
     46    static PassOwnPtr<RedirectedXCompositeWindow> create(const IntSize&, GLContextNeeded = CreateGLContext);
    4647    virtual ~RedirectedXCompositeWindow();
    4748    const IntSize& size() { return m_size; }
    … …  
    6061
    6162private:
    62     RedirectedXCompositeWindow(const IntSize&);
     63    RedirectedXCompositeWindow(const IntSize&, GLContextNeeded);
    6364    void cleanupPixmapAndPixmapSurface();
    6465
    … …  
    6768    Window m_parentWindow;
    6869    Pixmap m_pixmap;
     70    GLContextNeeded m_needsContext;
    6971    OwnPtr<GLContext> m_context;
    7072    RefPtr<cairo_surface_t> m_surface;
  • trunk/Source/WebKit2/ChangeLog

    r136204 r136207  
     12012-11-29  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] [WebKit2] WebKitWebViewBase creates a GL context for the redirected XComposite window crashing WebKit in Xvfb
     4        https://bugs.webkit.org/show_bug.cgi?id=103476
     5
     6        Reviewed by Alejandro G. Castro.
     7
     8        Create the RedirectedXCompositeWindow with an argument specifying that it
     9        should never have a GLContext backing it.
     10
     11        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
     12        (_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate):
     13
    1142012-11-29  Rafael Weinstein  <rafaelw@chromium.org>
    215
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp

    r136152 r136207  
    8484        : imContext(adoptGRef(gtk_im_multicontext_new()))
    8585#if USE(TEXTURE_MAPPER_GL)
    86         , redirectedWindow(RedirectedXCompositeWindow::create(IntSize(1, 1)))
     86        , redirectedWindow(RedirectedXCompositeWindow::create(IntSize(1, 1), RedirectedXCompositeWindow::DoNotCreateGLContext))
    8787#endif
    8888    {
Note: See TracChangeset for help on using the changeset viewer.