[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

cmarrin at apple.com cmarrin at apple.com
Wed Dec 22 14:32:44 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 051ff0884ea9e6a73ee2fd1d14522acb6e1680ed
Author: cmarrin at apple.com <cmarrin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 13 00:16:32 2010 +0000

    2010-10-12  Chris Marrin  <cmarrin at apple.com>
    
            Reviewed by Darin Adler.
    
            Manage DrawingBuffer lifetime in GraphicsContext3D
            https://bugs.webkit.org/show_bug.cgi?id=47501
    
            GraphicsContext3D and DrawingBuffer are now Refcounted. DrawingBuffer
            has a RefPtr to GraphicsContext3D to ensure the proper lifetime.
            DrawingBuffer is now created by GraphicsContext3D. Also DrawingBuffer
            refers to GraphicsContext3D rather than SharedGraphicsContext3D.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69619 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6a59aaf..ad05be2 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,49 @@
+2010-10-12  Chris Marrin  <cmarrin at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Manage DrawingBuffer lifetime in GraphicsContext3D
+        https://bugs.webkit.org/show_bug.cgi?id=47501
+
+        GraphicsContext3D and DrawingBuffer are now Refcounted. DrawingBuffer
+        has a RefPtr to GraphicsContext3D to ensure the proper lifetime. 
+        DrawingBuffer is now created by GraphicsContext3D. Also DrawingBuffer
+        refers to GraphicsContext3D rather than SharedGraphicsContext3D.
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
+        * html/canvas/CanvasRenderingContext2D.h:
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::create):
+        (WebCore::WebGLRenderingContext::WebGLRenderingContext):
+        * html/canvas/WebGLRenderingContext.h:
+        * platform/graphics/GraphicsContext3D.cpp:
+        (WebCore::GraphicsContext3D::createDrawingBuffer):
+        * platform/graphics/GraphicsContext3D.h:
+        * platform/graphics/chromium/DrawingBufferChromium.cpp:
+        (WebCore::generateColorTexture):
+        (WebCore::DrawingBuffer::DrawingBuffer):
+        (WebCore::DrawingBuffer::~DrawingBuffer):
+        (WebCore::DrawingBuffer::publishToPlatformLayer):
+        (WebCore::DrawingBuffer::reset):
+        * platform/graphics/gpu/DrawingBuffer.cpp:
+        (WebCore::DrawingBuffer::create):
+        (WebCore::DrawingBuffer::clear):
+        (WebCore::DrawingBuffer::bind):
+        * platform/graphics/gpu/DrawingBuffer.h:
+        (WebCore::DrawingBuffer::graphicsContext3D):
+        * platform/graphics/gpu/SharedGraphicsContext3D.cpp:
+        (WebCore::SharedGraphicsContext3D::create):
+        (WebCore::SharedGraphicsContext3D::SharedGraphicsContext3D):
+        * platform/graphics/gpu/SharedGraphicsContext3D.h:
+        (WebCore::SharedGraphicsContext3D::graphicsContext3D):
+        * platform/graphics/gpu/mac/DrawingBufferMac.mm:
+        (WebCore::DrawingBuffer::DrawingBuffer):
+        (WebCore::DrawingBuffer::~DrawingBuffer):
+        (WebCore::DrawingBuffer::reset):
+        * platform/graphics/mac/GraphicsContext3DMac.mm:
+        (WebCore::GraphicsContext3D::create):
+
 2010-10-12  Jian Li  <jianli at chromium.org>
 
         Reviewed by David Levin.
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index 5f4b4b7..9c60230 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -131,7 +131,7 @@ CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, bo
     if (GraphicsContext* c = drawingContext()) {
         m_context3D = p->sharedGraphicsContext3D();
         if (m_context3D) {
-            m_drawingBuffer = DrawingBuffer::create(m_context3D.get(), IntSize(canvas->width(), canvas->height()));
+            m_drawingBuffer = m_context3D->graphicsContext3D()->createDrawingBuffer(IntSize(canvas->width(), canvas->height()));
             c->setSharedGraphicsContext3D(m_context3D.get(), m_drawingBuffer.get(), IntSize(canvas->width(), canvas->height()));
         }
     }
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.h b/WebCore/html/canvas/CanvasRenderingContext2D.h
index 2c88a31..f51c5e9 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.h
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.h
@@ -294,7 +294,7 @@ private:
 #endif
 
 #if ENABLE(ACCELERATED_2D_CANVAS)
-    OwnPtr<DrawingBuffer> m_drawingBuffer;
+    RefPtr<DrawingBuffer> m_drawingBuffer;
     RefPtr<SharedGraphicsContext3D> m_context3D;
 #endif
 };
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index d1bb0cd..353a4b3 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -88,15 +88,15 @@ PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElemen
 {
     HostWindow* hostWindow = canvas->document()->view()->root()->hostWindow();
     GraphicsContext3D::Attributes emptyAttributes;
-    OwnPtr<GraphicsContext3D> context(GraphicsContext3D::create(attrs ? attrs->attributes() : emptyAttributes, hostWindow));
+    RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(attrs ? attrs->attributes() : emptyAttributes, hostWindow));
 
     if (!context)
         return 0;
         
-    return new WebGLRenderingContext(canvas, context.release());
+    return new WebGLRenderingContext(canvas, context);
 }
 
-WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, PassOwnPtr<GraphicsContext3D> context)
+WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, PassRefPtr<GraphicsContext3D> context)
     : CanvasRenderingContext(passedCanvas)
     , m_context(context)
     , m_needsUpdate(true)
diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h
index f507054..c4c856c 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.h
+++ b/WebCore/html/canvas/WebGLRenderingContext.h
@@ -291,7 +291,7 @@ public:
   private:
     friend class WebGLObject;
 
-    WebGLRenderingContext(HTMLCanvasElement*, PassOwnPtr<GraphicsContext3D>);
+    WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>);
 
     void addObject(WebGLObject*);
     void detachAndRemoveAllObjects();
@@ -329,7 +329,7 @@ public:
 
     PassRefPtr<Image> videoFrameToImage(HTMLVideoElement* video);
 
-    OwnPtr<GraphicsContext3D> m_context;
+    RefPtr<GraphicsContext3D> m_context;
     bool m_needsUpdate;
     bool m_markedCanvasDirty;
     // FIXME: I think this is broken -- it does not increment any
diff --git a/WebCore/platform/graphics/GraphicsContext3D.cpp b/WebCore/platform/graphics/GraphicsContext3D.cpp
index 9c34a09..b077927 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.cpp
+++ b/WebCore/platform/graphics/GraphicsContext3D.cpp
@@ -31,6 +31,7 @@
 #include "GraphicsContext3D.h"
 
 #include "ArrayBufferView.h"
+#include "DrawingBuffer.h"
 #include "Image.h"
 #include "ImageData.h"
 
@@ -41,6 +42,11 @@ static uint8_t convertColor16To8(uint16_t value)
     return value >> 8;
 }
 
+PassRefPtr<DrawingBuffer> GraphicsContext3D::createDrawingBuffer(const IntSize& size)
+{
+    return DrawingBuffer::create(this, size);
+}
+
 bool GraphicsContext3D::computeFormatAndTypeParameters(unsigned int format,
                                                        unsigned int type,
                                                        unsigned long* componentsPerPixel,
diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h
index 907d845..df363b4 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/WebCore/platform/graphics/GraphicsContext3D.h
@@ -26,16 +26,12 @@
 #ifndef GraphicsContext3D_h
 #define GraphicsContext3D_h
 
-#if PLATFORM(MAC)
-#include "ANGLEWebKitBridge.h"
-#endif
 #include "GraphicsLayer.h"
 #include "PlatformString.h"
 
 #include <wtf/HashMap.h>
 #include <wtf/ListHashSet.h>
 #include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
 
 // FIXME: Find a better way to avoid the name confliction for NO_ERROR.
 #if ((PLATFORM(CHROMIUM) && OS(WINDOWS)) || PLATFORM(WIN) || (PLATFORM(QT) && OS(WINDOWS)))
@@ -43,6 +39,7 @@
 #endif
 
 #if PLATFORM(MAC)
+#include "ANGLEWebKitBridge.h"
 #include <OpenGL/OpenGL.h>
 #include <wtf/RetainPtr.h>
 
@@ -78,6 +75,7 @@ const Platform3DObject NullPlatform3DObject = 0;
 
 namespace WebCore {
 class CanvasRenderingContext;
+class DrawingBuffer;
 class HostWindow;
 class Image;
 class ImageData;
@@ -94,7 +92,7 @@ struct ActiveInfo {
 class GraphicsContext3DInternal;
 #endif
 
-class GraphicsContext3D : public Noncopyable {
+class GraphicsContext3D : public RefCounted<GraphicsContext3D> {
 public:
     enum WebGLEnumType {
         DEPTH_BUFFER_BIT = 0x00000100,
@@ -441,8 +439,8 @@ public:
         RenderDirectlyToHostWindow
     };
 
-    static PassOwnPtr<GraphicsContext3D> create(Attributes attrs, HostWindow* hostWindow, RenderStyle renderStyle = RenderOffscreen);
-    virtual ~GraphicsContext3D();
+    static PassRefPtr<GraphicsContext3D> create(Attributes, HostWindow*, RenderStyle = RenderOffscreen);
+    ~GraphicsContext3D();
 
 #if PLATFORM(MAC)
     PlatformGraphicsContext3D platformGraphicsContext3D() const { return m_contextObj; }
@@ -469,6 +467,8 @@ public:
 #endif
     void makeContextCurrent();
 
+    PassRefPtr<DrawingBuffer> createDrawingBuffer(const IntSize& = IntSize());
+    
 #if PLATFORM(MAC) || PLATFORM(CHROMIUM)
     // With multisampling on, blit from multisampleFBO to regular FBO.
     void prepareTexture();
diff --git a/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp b/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
index 9ce0efe..b54a427 100644
--- a/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
+++ b/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
@@ -48,7 +48,7 @@ struct DrawingBufferInternal {
 #endif
 };
 
-static unsigned generateColorTexture(SharedGraphicsContext3D* context, const IntSize& size)
+static unsigned generateColorTexture(GraphicsContext3D* context, const IntSize& size)
 {
     unsigned offscreenColorTexture = context->createTexture();
     if (!offscreenColorTexture)
@@ -66,13 +66,13 @@ static unsigned generateColorTexture(SharedGraphicsContext3D* context, const Int
 }
 
 
-DrawingBuffer::DrawingBuffer(SharedGraphicsContext3D* context, const IntSize& size, unsigned framebuffer)
+DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, const IntSize& size)
     : m_context(context)
     , m_size(size)
-    , m_framebuffer(framebuffer)
+    , m_fbo(context->createFramebuffer())
     , m_internal(new DrawingBufferInternal)
 {
-    context->bindFramebuffer(framebuffer);
+    context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
     m_internal->offscreenColorTexture = generateColorTexture(context, size);
 }
 
@@ -82,14 +82,22 @@ DrawingBuffer::~DrawingBuffer()
     if (m_internal->platformLayer)
         m_internal->platformLayer->setDrawingBuffer(0);
 #endif
-    m_context->bindFramebuffer(m_framebuffer);
+
+    if (!m_context)
+        return;
+        
+    m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
     m_context->deleteTexture(m_internal->offscreenColorTexture);
-    m_context->deleteFramebuffer(m_framebuffer);
+
+    clear();
 }
 
 #if USE(ACCELERATED_COMPOSITING)
 void DrawingBuffer::publishToPlatformLayer()
 {
+    if (!m_context)
+        return;
+        
     if (m_callback)
         m_callback->willPublish();
     unsigned parentTexture = m_internal->platformLayer->textureId();
@@ -106,6 +114,9 @@ void DrawingBuffer::publishToPlatformLayer()
 
 void DrawingBuffer::reset(const IntSize& newSize)
 {
+    if (!m_context)
+        return;
+        
     if (m_size == newSize)
         return;
     m_size = newSize;
diff --git a/WebCore/platform/graphics/gpu/DrawingBuffer.cpp b/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
index 4b0adc1..2dc0517 100644
--- a/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
@@ -30,27 +30,38 @@
 
 #include "config.h"
 
-#if ENABLE(ACCELERATED_2D_CANVAS)
+#if ENABLE(ACCELERATED_2D_CANVAS) || ENABLE(3D_CANVAS)
 
 #include "DrawingBuffer.h"
 
-#include "SharedGraphicsContext3D.h"
-
 namespace WebCore {
 
-PassOwnPtr<DrawingBuffer> DrawingBuffer::create(SharedGraphicsContext3D* context, const IntSize& size)
+PassRefPtr<DrawingBuffer> DrawingBuffer::create(GraphicsContext3D* context, const IntSize& size)
+{
+    RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(context, size));
+    return (drawingBuffer->m_context) ? drawingBuffer.release() : 0;
+}
+
+void DrawingBuffer::clear()
 {
-    unsigned framebuffer = context->createFramebuffer();
-    ASSERT(framebuffer);
-    if (!framebuffer)
-        return 0;
-    return adoptPtr(new DrawingBuffer(context, size, framebuffer));
+    if (!m_context)
+        return;
+
+    m_context->makeContextCurrent();
+    m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
+    m_context->deleteFramebuffer(m_fbo);
+    m_fbo = 0;
+
+    m_context.clear();
 }
 
 void DrawingBuffer::bind()
 {
-    m_context->bindFramebuffer(m_framebuffer);
-    m_context->setViewport(m_size);
+    if (!m_context)
+        return;
+        
+    m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
+    m_context->viewport(0, 0, m_size.width(), m_size.height());
 }
 
 } // namespace WebCore
diff --git a/WebCore/platform/graphics/gpu/DrawingBuffer.h b/WebCore/platform/graphics/gpu/DrawingBuffer.h
index 2fafe56..75c7f99 100644
--- a/WebCore/platform/graphics/gpu/DrawingBuffer.h
+++ b/WebCore/platform/graphics/gpu/DrawingBuffer.h
@@ -44,23 +44,26 @@
 
 namespace WebCore {
 
-class SharedGraphicsContext3D;
-
 #if PLATFORM(CHROMIUM)
 struct DrawingBufferInternal;
 #endif
 
 // Manages a rendering target (framebuffer + attachment) for a canvas.  Can publish its rendering
 // results to a PlatformLayer for compositing.
-class DrawingBuffer : public Noncopyable {
+class DrawingBuffer : public RefCounted<DrawingBuffer> {
 public:
-    static PassOwnPtr<DrawingBuffer> create(SharedGraphicsContext3D*, const IntSize&);
+    friend class GraphicsContext3D;
+    
     ~DrawingBuffer();
 
     void reset(const IntSize&);
     void bind();
     IntSize size() const { return m_size; }
 
+    // Clear all resources from this object, as well as context. Called when context is destroyed
+    // to prevent invalid accesses to the resources.
+    void clear();
+    
 #if USE(ACCELERATED_COMPOSITING)
     PlatformLayer* platformLayer();
     void publishToPlatformLayer();
@@ -79,12 +82,16 @@ public:
     void setWillPublishCallback(PassOwnPtr<WillPublishCallback> callback) { m_callback = callback; }
 #endif
 
+    PassRefPtr<GraphicsContext3D> graphicsContext3D() const { return m_context; }
+
 private:
-    DrawingBuffer(SharedGraphicsContext3D*, const IntSize&, unsigned framebuffer);
+    static PassRefPtr<DrawingBuffer> create(GraphicsContext3D*, const IntSize&);
+    
+    DrawingBuffer(GraphicsContext3D*, const IntSize&);
 
-    SharedGraphicsContext3D* m_context;
+    RefPtr<GraphicsContext3D> m_context;
     IntSize m_size;
-    unsigned m_framebuffer;
+    Platform3DObject m_fbo;
 
 #if PLATFORM(CHROMIUM)
     OwnPtr<WillPublishCallback> m_callback;
diff --git a/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp b/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp
index 4b7b4cf..87a0b69 100644
--- a/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp
+++ b/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp
@@ -52,7 +52,7 @@ namespace WebCore {
 PassRefPtr<SharedGraphicsContext3D> SharedGraphicsContext3D::create(HostWindow* hostWindow)
 {
     GraphicsContext3D::Attributes attr;
-    OwnPtr<GraphicsContext3D> context = GraphicsContext3D::create(attr, hostWindow);
+    RefPtr<GraphicsContext3D> context = GraphicsContext3D::create(attr, hostWindow);
     if (!context)
         return 0;
     OwnPtr<SolidFillShader> solidFillShader = SolidFillShader::create(context.get());
@@ -64,7 +64,7 @@ PassRefPtr<SharedGraphicsContext3D> SharedGraphicsContext3D::create(HostWindow*
     return adoptRef(new SharedGraphicsContext3D(context.release(), solidFillShader.release(), texShader.release()));
 }
 
-SharedGraphicsContext3D::SharedGraphicsContext3D(PassOwnPtr<GraphicsContext3D> context, PassOwnPtr<SolidFillShader> solidFillShader, PassOwnPtr<TexShader> texShader)
+SharedGraphicsContext3D::SharedGraphicsContext3D(PassRefPtr<GraphicsContext3D> context, PassOwnPtr<SolidFillShader> solidFillShader, PassOwnPtr<TexShader> texShader)
     : m_context(context)
     , m_quadVertices(0)
     , m_solidFillShader(solidFillShader)
diff --git a/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h b/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h
index ffbc070..05008c2 100644
--- a/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h
+++ b/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h
@@ -118,14 +118,16 @@ public:
     // the texture.
     PassRefPtr<Texture> createTexture(Texture::Format, int width, int height);
 
+    GraphicsContext3D* graphicsContext3D() const { return m_context.get(); }
+
 private:
-    SharedGraphicsContext3D(PassOwnPtr<GraphicsContext3D>, PassOwnPtr<SolidFillShader>, PassOwnPtr<TexShader>);
+    SharedGraphicsContext3D(PassRefPtr<GraphicsContext3D>, PassOwnPtr<SolidFillShader>, PassOwnPtr<TexShader>);
 
     // Used to implement removeTexturesFor(), see the comment above.
     static HashSet<SharedGraphicsContext3D*>* allContexts();
     void removeTextureFor(NativeImagePtr);
 
-    OwnPtr<GraphicsContext3D> m_context;
+    RefPtr<GraphicsContext3D> m_context;
 
     unsigned m_quadVertices;
 
diff --git a/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm b/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm
index 892dc0e..7a8c501 100644
--- a/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm
+++ b/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm
@@ -25,41 +25,46 @@
 
 #include "config.h"
 
-#if ENABLE(ACCELERATED_2D_CANVAS)
+#if ENABLE(ACCELERATED_2D_CANVAS) || ENABLE(3D_CANVAS)
 
 #include "DrawingBuffer.h"
 
-#include "SharedGraphicsContext3D.h"
 #include "WebGLLayer.h"
 
 #import "BlockExceptions.h"
 
 namespace WebCore {
 
-DrawingBuffer::DrawingBuffer(SharedGraphicsContext3D* context, const IntSize& size, unsigned framebuffer)
+DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, const IntSize& size)
     : m_context(context)
     , m_size(size)
-    , m_framebuffer(framebuffer)
+    , m_fbo(context->createFramebuffer())
 {
-    context->bindFramebuffer(framebuffer);
-
+    ASSERT(m_fbo);
+    if (!m_fbo) {
+        clear();
+        return;
+    }
+        
     // Create the WebGLLayer
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-        m_platformLayer.adoptNS([[WebGLLayer alloc] initWithGraphicsContext3D:0]);
+        m_platformLayer.adoptNS([[WebGLLayer alloc] initWithGraphicsContext3D:m_context.get()]);
 #ifndef NDEBUG
-        [m_platformLayer.get() setName:@"WebGL Layer"];
+        [m_platformLayer.get() setName:@"DrawingBuffer Layer"];
 #endif    
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
 DrawingBuffer::~DrawingBuffer()
 {
-    m_context->bindFramebuffer(m_framebuffer);
-    m_context->deleteFramebuffer(m_framebuffer);
+    clear();
 }
 
 void DrawingBuffer::reset(const IntSize& newSize)
 {
+    if (!m_context)
+        return;
+        
     if (m_size == newSize)
         return;
     m_size = newSize;
diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm b/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
index a4919d8..e079b44 100644
--- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
+++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
@@ -77,12 +77,12 @@ static void setPixelFormat(Vector<CGLPixelFormatAttribute>& attribs, int colorBi
     attribs.append(static_cast<CGLPixelFormatAttribute>(0));
 }
 
-PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
+PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
 {
     // This implementation doesn't currently support rendering directly to the HostWindow.
     if (renderStyle == RenderDirectlyToHostWindow)
         return 0;
-    OwnPtr<GraphicsContext3D> context(new GraphicsContext3D(attrs, hostWindow, false));
+    RefPtr<GraphicsContext3D> context = adoptRef(new GraphicsContext3D(attrs, hostWindow, false));
     return context->m_contextObj ? context.release() : 0;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list