Changeset 139142 in webkit
- Timestamp:
- Jan 8, 2013 6:21:57 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r139140 r139142 1 2013-01-08 Brandon Jones <bajones@chromium.org> 2 3 Make WebGLRenderingContext inherit from ActiveDOMObject 4 https://bugs.webkit.org/show_bug.cgi?id=104733 5 6 Reviewed by Adam Barth. 7 8 * fast/canvas/webgl/context-release-upon-reload-expected.txt: Added. 9 * fast/canvas/webgl/context-release-upon-reload.html: Added. 10 * fast/canvas/webgl/resources/context-release-upon-reload-child.html: Added. 11 1 12 2013-01-08 Martin Robinson <mrobinson@igalia.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r139141 r139142 1 2013-01-08 Brandon Jones <bajones@chromium.org> 2 3 Make WebGLRenderingContext inherit from ActiveDOMObject 4 https://bugs.webkit.org/show_bug.cgi?id=104733 5 6 Reviewed by Adam Barth. 7 8 When ActiveDOMObject::stop is called on the WebGLRenderingContext the 9 DrawingBuffer and GraphicsContext3D instances are forcibly released in 10 order to keep GPU memory utilization to a minimum. 11 12 Incorporated new layout test based on one just added to the WebGL 13 conformance suite. Also tested manually by reloading and 14 navigating between many WebGL apps. 15 16 Test: fast/canvas/webgl/context-release-upon-reload.html 17 18 * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp: 19 (WebCore::V8HTMLCanvasElement::getContextCallback): 20 Removed garbage collection hack added in Bug 76255. 21 * html/canvas/WebGLRenderingContext.cpp: 22 (WebCore): 23 (WebCore::WebGLRenderingContext::create): 24 Call suspendIfNeeded per ActiveDOMObject contract. 25 (WebCore::WebGLRenderingContext::WebGLRenderingContext): 26 Call ActiveDOMObject constructor. 27 (WebCore::WebGLRenderingContext::~WebGLRenderingContext): 28 Call destroyGraphicsContext3D. 29 (WebCore::WebGLRenderingContext::destroyGraphicsContext3D): 30 Drop DrawingBuffer backing store and delete GraphicsContext3D. 31 (WebCore::WebGLRenderingContext::hasPendingActivity): 32 Always return false. 33 (WebCore::WebGLRenderingContext::stop): 34 Force lost context upon page reload or navigation. 35 * html/canvas/WebGLRenderingContext.h: 36 (WebGLRenderingContext): 37 Inherit from ActiveDOMObject and override notifications. 38 * platform/graphics/blackberry/DrawingBufferBlackBerry.cpp: 39 (WebCore): 40 (WebCore::DrawingBuffer::clearPlatformLayer): 41 Add currently no-op implementation. 42 * platform/graphics/cairo/DrawingBufferCairo.cpp: 43 (WebCore): 44 (WebCore::DrawingBuffer::clearPlatformLayer): 45 Add currently no-op implementation. 46 * platform/graphics/chromium/DrawingBufferChromium.cpp: 47 (WebCore::DrawingBufferPrivate::clearTextureId): 48 Clear texture ID from compositor's layer. 49 (DrawingBufferPrivate): 50 (WebCore::DrawingBuffer::framebuffer): 51 Moved around to reduce number of #ifdefs. 52 (WebCore): 53 (WebCore::DrawingBuffer::platformLayer): 54 (WebCore::DrawingBuffer::clearPlatformLayer): 55 Tell compositor to stop referencing DrawingBuffer's texture. 56 * platform/graphics/clutter/DrawingBufferClutter.cpp: 57 (WebCore): 58 (WebCore::DrawingBuffer::clearPlatformLayer): 59 Add currently no-op implementation. 60 * platform/graphics/gpu/DrawingBuffer.cpp: 61 (WebCore::DrawingBuffer::clear): 62 Call clearPlatformLayer before deleting OpenGL resources. 63 * platform/graphics/gpu/DrawingBuffer.h: 64 (DrawingBuffer): 65 Add clearPlatformLayer. 66 * platform/graphics/gpu/mac/DrawingBufferMac.mm: 67 (WebCore): 68 (WebCore::DrawingBuffer::clearPlatformLayer): 69 Add currently no-op implementation. 70 * platform/graphics/gpu/qt/DrawingBufferQt.cpp: 71 (WebCore): 72 (WebCore::DrawingBuffer::clearPlatformLayer): 73 Add currently no-op implementation. 74 1 75 2013-01-08 Tony Gentilcore <tonyg@chromium.org> 2 76 -
trunk/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
r138665 r139142 98 98 #if ENABLE(WEBGL) 99 99 else if (result->is3d()) { 100 // 3D canvas contexts can hold on to lots of GPU resources, and we want to take an101 // opportunity to get rid of them as soon as possible when we navigate away from pages using102 // them.103 V8PerIsolateData* perIsolateData = V8PerIsolateData::from(args.GetIsolate());104 perIsolateData->setShouldCollectGarbageSoon();105 106 100 v8::Handle<v8::Value> v8Result = toV8(static_cast<WebGLRenderingContext*>(result), args.Holder(), args.GetIsolate()); 107 101 if (InspectorInstrumentation::canvasAgentEnabled(imp->document())) { -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
r138542 r139142 440 440 441 441 OwnPtr<WebGLRenderingContext> renderingContext = adoptPtr(new WebGLRenderingContext(canvas, context, attributes)); 442 renderingContext->suspendIfNeeded(); 442 443 443 444 #if PLATFORM(CHROMIUM) … … 454 455 GraphicsContext3D::Attributes attributes) 455 456 : CanvasRenderingContext(passedCanvas) 457 , ActiveDOMObject(passedCanvas->document(), this) 456 458 , m_context(context) 457 459 , m_drawingBuffer(0) … … 616 618 617 619 detachAndRemoveAllObjects(); 618 m_context->setContextLostCallback(nullptr); 619 m_context->setErrorMessageCallback(nullptr); 620 destroyGraphicsContext3D(); 620 621 m_contextGroup->removeContext(this); 622 } 623 624 void WebGLRenderingContext::destroyGraphicsContext3D() 625 { 626 // The drawing buffer holds a context reference. It must also be destroyed 627 // in order for the context to be released. 628 if (m_drawingBuffer) 629 m_drawingBuffer.clear(); 630 631 if (m_context) { 632 m_context->setContextLostCallback(nullptr); 633 m_context->setErrorMessageCallback(nullptr); 634 m_context.clear(); 635 } 621 636 } 622 637 … … 4585 4600 } 4586 4601 4602 bool WebGLRenderingContext::hasPendingActivity() const 4603 { 4604 return false; 4605 } 4606 4607 void WebGLRenderingContext::stop() 4608 { 4609 if (!isContextLost()) { 4610 forceLostContext(SyntheticLostContext); 4611 destroyGraphicsContext3D(); 4612 } 4613 } 4614 4587 4615 WebGLGetInfo WebGLRenderingContext::getBooleanParameter(GC3Denum pname) 4588 4616 { -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h
r137397 r139142 27 27 #define WebGLRenderingContext_h 28 28 29 #include "ActiveDOMObject.h" 29 30 #include "CanvasRenderingContext.h" 30 31 #include "DrawingBuffer.h" … … 76 77 typedef int ExceptionCode; 77 78 78 class WebGLRenderingContext : public CanvasRenderingContext {79 class WebGLRenderingContext : public CanvasRenderingContext, public ActiveDOMObject { 79 80 public: 80 81 static PassOwnPtr<WebGLRenderingContext> create(HTMLCanvasElement*, WebGLContextAttributes*); … … 318 319 unsigned getMaxVertexAttribs() const { return m_maxVertexAttribs; } 319 320 321 // ActiveDOMObject notifications 322 virtual bool hasPendingActivity() const; 323 virtual void stop(); 324 320 325 private: 321 326 friend class WebGLFramebuffer; … … 335 340 void detachAndRemoveAllObjects(); 336 341 342 void destroyGraphicsContext3D(); 337 343 void markContextChanged(); 338 344 void cleanupAfterGraphicsCall(bool changed) -
trunk/Source/WebCore/platform/graphics/blackberry/DrawingBufferBlackBerry.cpp
r113493 r139142 123 123 return colorBuffer(); 124 124 } 125 126 void DrawingBuffer::clearPlatformLayer() 127 { 128 } 125 129 #endif 126 130 -
trunk/Source/WebCore/platform/graphics/cairo/DrawingBufferCairo.cpp
r122175 r139142 102 102 { 103 103 } 104 105 void DrawingBuffer::clearPlatformLayer() 106 { 107 } 104 108 #endif 105 109 -
trunk/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
r128785 r139142 204 204 } 205 205 206 void clearTextureId() 207 { 208 m_layer->setTextureId(0); 209 } 210 206 211 WebKit::WebLayer* layer() { return m_layer->layer(); } 207 212 … … 211 216 }; 212 217 218 Platform3DObject DrawingBuffer::framebuffer() const 219 { 220 return m_fbo; 221 } 222 213 223 #if USE(ACCELERATED_COMPOSITING) 214 224 PlatformLayer* DrawingBuffer::platformLayer() … … 219 229 return m_private->layer(); 220 230 } 221 #endif 222 223 Platform3DObject DrawingBuffer::framebuffer() const 224 { 225 return m_fbo; 226 } 227 228 #if USE(ACCELERATED_COMPOSITING) 231 229 232 void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer* imageBuffer) 230 233 { … … 250 253 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, previousFramebuffer); 251 254 } 255 256 void DrawingBuffer::clearPlatformLayer() 257 { 258 if (m_private) 259 m_private->clearTextureId(); 260 261 m_context->flush(); 262 } 252 263 #endif 253 264 -
trunk/Source/WebCore/platform/graphics/clutter/DrawingBufferClutter.cpp
r122175 r139142 75 75 { 76 76 } 77 78 void DrawingBuffer::clearPlatformLayer() 79 { 80 } 77 81 #endif 78 82 -
trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
r130235 r139142 77 77 78 78 m_context->makeContextCurrent(); 79 80 #if USE(ACCELERATED_COMPOSITING) 81 clearPlatformLayer(); 82 #endif 83 79 84 if (!m_size.isEmpty()) { 80 85 s_currentResourceUsePixels -= m_size.width() * m_size.height(); -
trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h
r131502 r139142 130 130 unsigned frontColorBuffer() const; 131 131 void paintCompositedResultsToCanvas(ImageBuffer*); 132 void clearPlatformLayer(); 132 133 #endif 133 134 -
trunk/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm
r122175 r139142 114 114 return colorBuffer(); 115 115 } 116 117 void DrawingBuffer::clearPlatformLayer() 118 { 119 // Don't need to do anything on this platform. 120 } 116 121 #endif 117 122 -
trunk/Source/WebCore/platform/graphics/gpu/qt/DrawingBufferQt.cpp
r122175 r139142 105 105 { 106 106 } 107 108 void DrawingBuffer::clearPlatformLayer() 109 { 110 } 107 111 #endif 108 112
Note: See TracChangeset
for help on using the changeset viewer.