WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-104733-20130104203141.patch (text/plain), 11.12 KB, created by
Kenneth Russell
on 2013-01-04 20:34:34 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Kenneth Russell
Created:
2013-01-04 20:34:34 PST
Size:
11.12 KB
patch
obsolete
>Subversion Revision: 138848 >diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp >index c900ef26f09ff36beb871fa999cbfa60b0a5279a..738cdbba81bd1a60a770bb3d56d66c53ee512aa0 100644 >--- a/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp >+++ b/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp >@@ -97,12 +97,6 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument > } > #if ENABLE(WEBGL) > else if (result->is3d()) { >- // 3D canvas contexts can hold on to lots of GPU resources, and we want to take an >- // opportunity to get rid of them as soon as possible when we navigate away from pages using >- // them. >- V8PerIsolateData* perIsolateData = V8PerIsolateData::from(args.GetIsolate()); >- perIsolateData->setShouldCollectGarbageSoon(); >- > v8::Handle<v8::Value> v8Result = toV8(static_cast<WebGLRenderingContext*>(result), args.Holder(), args.GetIsolate()); > if (InspectorInstrumentation::canvasAgentEnabled(imp->document())) { > ScriptState* scriptState = ScriptState::forContext(v8::Context::GetCurrent()); >diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp >index 2e0e51b339ef9b7d1790502054fd2479d718c7bf..7cc0296590b821254ce5347ada214391c8e03bc7 100644 >--- a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp >+++ b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp >@@ -403,7 +403,7 @@ PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElemen > return nullptr; > Settings* settings = frame->settings(); > >- // The FrameLoaderClient might creation of a new WebGL context despite the page settings; in >+ // The FrameLoaderClient might disallow creation of a new WebGL context despite the page settings; in > // particular, if WebGL contexts were lost one or more times via the GL_ARB_robustness extension. > if (!frame->loader()->client()->allowWebGL(settings && settings->webGLEnabled())) { > canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Web page was not allowed to create a WebGL context.")); >@@ -439,6 +439,7 @@ PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElemen > extensions->pushGroupMarkerEXT("WebGLRenderingContext"); > > OwnPtr<WebGLRenderingContext> renderingContext = adoptPtr(new WebGLRenderingContext(canvas, context, attributes)); >+ renderingContext->suspendIfNeeded(); > > #if PLATFORM(CHROMIUM) > if (!renderingContext->m_drawingBuffer) { >@@ -453,6 +454,7 @@ PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElemen > WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, PassRefPtr<GraphicsContext3D> context, > GraphicsContext3D::Attributes attributes) > : CanvasRenderingContext(passedCanvas) >+ , ActiveDOMObject(passedCanvas->document(), this) > , m_context(context) > , m_drawingBuffer(0) > , m_dispatchContextLostEventTimer(this, &WebGLRenderingContext::dispatchContextLostEvent) >@@ -465,6 +467,8 @@ WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa > , m_synthesizedErrorsToConsole(false) > , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole) > { >+ fprintf(stderr, "WebGLRenderingContext::WebGLRenderingContext %p\n", this); >+ > ASSERT(m_context); > m_contextGroup = WebGLContextGroup::create(); > m_contextGroup->addContext(this); >@@ -596,6 +600,8 @@ void WebGLRenderingContext::addCompressedTextureFormat(GC3Denum format) > > WebGLRenderingContext::~WebGLRenderingContext() > { >+ fprintf(stderr, "WebGLRenderingContext::~WebGLRenderingContext %p\n", this); >+ > // Remove all references to WebGLObjects so if they are the last reference > // they will be freed before the last context is removed from the context group. > m_boundArrayBuffer = 0; >@@ -615,11 +621,24 @@ WebGLRenderingContext::~WebGLRenderingContext() > m_blackTextureCubeMap = 0; > > detachAndRemoveAllObjects(); >- m_context->setContextLostCallback(nullptr); >- m_context->setErrorMessageCallback(nullptr); >+ destroyGraphicsContext3D(); > m_contextGroup->removeContext(this); > } > >+void WebGLRenderingContext::destroyGraphicsContext3D() >+{ >+ // The drawing buffer holds a context reference. It must also be destroyed >+ // in order for the context to be released. >+ if (m_drawingBuffer) >+ m_drawingBuffer.clear(); >+ >+ if (m_context) { >+ m_context->setContextLostCallback(nullptr); >+ m_context->setErrorMessageCallback(nullptr); >+ m_context.clear(); >+ } >+} >+ > void WebGLRenderingContext::markContextChanged() > { > if (m_framebufferBinding) >@@ -4584,6 +4603,16 @@ void WebGLRenderingContext::detachAndRemoveAllObjects() > } > } > >+void WebGLRenderingContext::stop() >+{ >+ if (!isContextLost()) { >+ fprintf(stderr, "WebGLRenderingContext::stop %p\n", this); >+ >+ forceLostContext(SyntheticLostContext); >+ destroyGraphicsContext3D(); >+ } >+} >+ > WebGLGetInfo WebGLRenderingContext::getBooleanParameter(GC3Denum pname) > { > GC3Dboolean value = 0; >diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.h b/Source/WebCore/html/canvas/WebGLRenderingContext.h >index 7ddfc2cd65ef01c02582734b36ed27fa997fffea..d8de9a3f68585d00e39da12447c4ec4d7c8b84f6 100644 >--- a/Source/WebCore/html/canvas/WebGLRenderingContext.h >+++ b/Source/WebCore/html/canvas/WebGLRenderingContext.h >@@ -26,6 +26,7 @@ > #ifndef WebGLRenderingContext_h > #define WebGLRenderingContext_h > >+#include "ActiveDOMObject.h" > #include "CanvasRenderingContext.h" > #include "DrawingBuffer.h" > #include "GraphicsContext3D.h" >@@ -75,7 +76,7 @@ class WebGLVertexArrayObjectOES; > > typedef int ExceptionCode; > >-class WebGLRenderingContext : public CanvasRenderingContext { >+class WebGLRenderingContext : public CanvasRenderingContext, public ActiveDOMObject { > public: > static PassOwnPtr<WebGLRenderingContext> create(HTMLCanvasElement*, WebGLContextAttributes*); > virtual ~WebGLRenderingContext(); >@@ -317,6 +318,9 @@ public: > > unsigned getMaxVertexAttribs() const { return m_maxVertexAttribs; } > >+ // ActiveDOMObject notifications >+ virtual void stop(); >+ > private: > friend class WebGLFramebuffer; > friend class WebGLObject; >@@ -334,6 +338,7 @@ public: > void addContextObject(WebGLContextObject*); > void detachAndRemoveAllObjects(); > >+ void destroyGraphicsContext3D(); > void markContextChanged(); > void cleanupAfterGraphicsCall(bool changed) > { >diff --git a/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp b/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp >index aeee451883adb8cb55cd879fbcbf6d57a02db7b8..4e25f13017ea0925ce6907c2a94efc2cdd7f79b4 100644 >--- a/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp >+++ b/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp >@@ -186,6 +186,13 @@ public: > > virtual unsigned prepareTexture(WebKit::WebTextureUpdater& updater) OVERRIDE > { >+ if (!m_drawingBuffer->colorBuffer()) { >+ // DrawingBuffer has already been torn down due to page navigation. This is the only way >+ // we can tell the compositor to stop rendering the associated layer. Calling >+ // GraphicsLayerChromium::unregisterContentsLayer is insufficient. >+ return 0; >+ } >+ > m_drawingBuffer->prepareBackBuffer(); > > m_drawingBuffer->graphicsContext3D()->flush(); >@@ -203,6 +210,11 @@ public: > return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_drawingBuffer->graphicsContext3D()); > } > >+ void clearTextureId() >+ { >+ m_layer->setTextureId(0); >+ } >+ > WebKit::WebLayer* layer() { return m_layer->layer(); } > > private: >@@ -210,6 +222,11 @@ private: > OwnPtr<WebKit::WebExternalTextureLayer> m_layer; > }; > >+Platform3DObject DrawingBuffer::framebuffer() const >+{ >+ return m_fbo; >+} >+ > #if USE(ACCELERATED_COMPOSITING) > PlatformLayer* DrawingBuffer::platformLayer() > { >@@ -218,14 +235,7 @@ PlatformLayer* DrawingBuffer::platformLayer() > > return m_private->layer(); > } >-#endif > >-Platform3DObject DrawingBuffer::framebuffer() const >-{ >- return m_fbo; >-} >- >-#if USE(ACCELERATED_COMPOSITING) > void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer* imageBuffer) > { > if (!m_context->makeContextCurrent() || m_context->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR) >@@ -249,6 +259,11 @@ void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer* imageBuffer) > > m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, previousFramebuffer); > } >+ >+void DrawingBuffer::clearPlatformLayer() >+{ >+ m_private->clearTextureId(); >+} > #endif > > } >diff --git a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp >index 282bde03f2bd3fa8f11d43bce57d57e16bdbadb4..9876f40a4288f1d4668c8ed02ae2bb72b2cf1aec 100644 >--- a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp >+++ b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp >@@ -120,6 +120,10 @@ void DrawingBuffer::clear() > m_context->deleteFramebuffer(m_fbo); > m_fbo = 0; > } >+ >+#if USE(ACCELERATED_COMPOSITING) >+ clearPlatformLayer(); >+#endif > } > > void DrawingBuffer::createSecondaryBuffers() >diff --git a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h >index b2c59aae641e07e6df32714fea0278f0bb65d1f2..61aa1ce6bee7ff703731be88f3c3164b61b832b0 100644 >--- a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h >+++ b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h >@@ -129,6 +129,7 @@ public: > bool requiresCopyFromBackToFrontBuffer() const; > unsigned frontColorBuffer() const; > void paintCompositedResultsToCanvas(ImageBuffer*); >+ void clearPlatformLayer(); > #endif > > GraphicsContext3D* graphicsContext3D() const { return m_context.get(); } >diff --git a/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm b/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm >index 40dc2a51ead8e9b9d2e4b3b6528f97182cdd1cfe..5837e3a14504df7ce3f2a25952f3be449cac4b6d 100644 >--- a/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm >+++ b/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm >@@ -113,6 +113,11 @@ unsigned DrawingBuffer::frontColorBuffer() const > { > return colorBuffer(); > } >+ >+void DrawingBuffer::clearPlatformLayer() >+{ >+ // Don't need to do anything on this platform. >+} > #endif > > } >diff --git a/Source/WebCore/platform/graphics/gpu/qt/DrawingBufferQt.cpp b/Source/WebCore/platform/graphics/gpu/qt/DrawingBufferQt.cpp >index 17a59a418104de0cd7311e322de9d142206cea64..904a74fa643376422a274b41dda6241b804f1802 100644 >--- a/Source/WebCore/platform/graphics/gpu/qt/DrawingBufferQt.cpp >+++ b/Source/WebCore/platform/graphics/gpu/qt/DrawingBufferQt.cpp >@@ -104,6 +104,10 @@ unsigned DrawingBuffer::frontColorBuffer() const > void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer*) > { > } >+ >+void DrawingBuffer::clearPlatformLayer() >+{ >+} > #endif > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 104733
:
179321
|
179556
|
179777
|
180229
|
181424
|
181626
|
181783