Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: Source/core/html/canvas/WebGLRenderingContextBase.cpp

Issue 169933002: WebGL: Don't destroy mailbox textures in the destructor until they're released. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase DrawingBufferTest to ToT Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/platform/graphics/gpu/DrawingBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 716
717 if (!m_drawingBuffer) 717 if (!m_drawingBuffer)
718 return; 718 return;
719 719
720 m_extensionsUtil.clear(); 720 m_extensionsUtil.clear();
721 721
722 webContext()->setContextLostCallback(0); 722 webContext()->setContextLostCallback(0);
723 webContext()->setErrorMessageCallback(0); 723 webContext()->setErrorMessageCallback(0);
724 724
725 ASSERT(m_drawingBuffer); 725 ASSERT(m_drawingBuffer);
726 m_drawingBuffer->beginDestruction();
726 m_drawingBuffer.clear(); 727 m_drawingBuffer.clear();
727 } 728 }
728 729
729 void WebGLRenderingContextBase::markContextChanged(ContentChangeType changeType) 730 void WebGLRenderingContextBase::markContextChanged(ContentChangeType changeType)
730 { 731 {
731 if (m_framebufferBinding || isContextLost()) 732 if (m_framebufferBinding || isContextLost())
732 return; 733 return;
733 734
734 m_drawingBuffer->markContentsChanged(); 735 m_drawingBuffer->markContentsChanged();
735 736
(...skipping 4698 matching lines...) Expand 10 before | Expand all | Expand 10 after
5434 LocalFrame* frame = canvas()->document().frame(); 5435 LocalFrame* frame = canvas()->document().frame();
5435 if (!frame) 5436 if (!frame)
5436 return; 5437 return;
5437 5438
5438 Settings* settings = frame->settings(); 5439 Settings* settings = frame->settings();
5439 5440
5440 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled ())) 5441 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled ()))
5441 return; 5442 return;
5442 5443
5443 // If the context was lost due to RealLostContext, we need to destroy the ol d DrawingBuffer before creating new DrawingBuffer to ensure resource budget enou gh. 5444 // If the context was lost due to RealLostContext, we need to destroy the ol d DrawingBuffer before creating new DrawingBuffer to ensure resource budget enou gh.
5444 m_drawingBuffer.clear(); 5445 if (m_drawingBuffer) {
5446 m_drawingBuffer->beginDestruction();
5447 m_drawingBuffer.clear();
5448 }
5445 5449
5446 blink::WebGraphicsContext3D::Attributes attributes = m_requestedAttributes-> attributes(canvas()->document().topDocument().url().string(), settings); 5450 blink::WebGraphicsContext3D::Attributes attributes = m_requestedAttributes-> attributes(canvas()->document().topDocument().url().string(), settings);
5447 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr ent()->createOffscreenGraphicsContext3D(attributes, 0)); 5451 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr ent()->createOffscreenGraphicsContext3D(attributes, 0));
5448 RefPtr<DrawingBuffer> drawingBuffer; 5452 RefPtr<DrawingBuffer> drawingBuffer;
5449 // Even if a non-null WebGraphicsContext3D is created, until it's made curre nt, it isn't known whether the context is still lost. 5453 // Even if a non-null WebGraphicsContext3D is created, until it's made curre nt, it isn't known whether the context is still lost.
5450 if (context) { 5454 if (context) {
5451 RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = ad optRef(new WebGLRenderingContextEvictionManager()); 5455 RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = ad optRef(new WebGLRenderingContextEvictionManager());
5452 5456
5453 // Construct a new drawing buffer with the new WebGraphicsContext3D. 5457 // Construct a new drawing buffer with the new WebGraphicsContext3D.
5454 DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes->p reserveDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard; 5458 DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes->p reserveDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
5663 if (m_textureUnits[i].m_texture2DBinding 5667 if (m_textureUnits[i].m_texture2DBinding
5664 || m_textureUnits[i].m_textureCubeMapBinding) { 5668 || m_textureUnits[i].m_textureCubeMapBinding) {
5665 m_onePlusMaxNonDefaultTextureUnit = i + 1; 5669 m_onePlusMaxNonDefaultTextureUnit = i + 1;
5666 return; 5670 return;
5667 } 5671 }
5668 } 5672 }
5669 m_onePlusMaxNonDefaultTextureUnit = 0; 5673 m_onePlusMaxNonDefaultTextureUnit = 0;
5670 } 5674 }
5671 5675
5672 } // namespace WebCore 5676 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/platform/graphics/gpu/DrawingBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698