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

Unified Diff: Source/core/html/canvas/WebGLRenderingContext.cpp

Issue 15876011: Make WebGL extensions get lost when context is lost. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/canvas/WebGLRenderingContext.cpp
diff --git a/Source/core/html/canvas/WebGLRenderingContext.cpp b/Source/core/html/canvas/WebGLRenderingContext.cpp
index c911b8177e27295ad60805b9147c76d0449e1bcd..8b3f5c7e8d1a2338d2f13433dc350368d92d8476 100644
--- a/Source/core/html/canvas/WebGLRenderingContext.cpp
+++ b/Source/core/html/canvas/WebGLRenderingContext.cpp
@@ -711,6 +711,11 @@ void WebGLRenderingContext::addCompressedTextureFormat(GC3Denum format)
m_compressedTextureFormats.append(format);
}
+void WebGLRenderingContext::removeAllCompressedTextureFormats()
+{
+ m_compressedTextureFormats.clear();
+}
+
WebGLRenderingContext::~WebGLRenderingContext()
{
// Remove all references to WebGLObjects so if they are the last reference
@@ -732,6 +737,11 @@ WebGLRenderingContext::~WebGLRenderingContext()
m_blackTextureCubeMap = 0;
detachAndRemoveAllObjects();
+
+ // release all extensions
+ for (size_t i = 0; i < m_extensions.size(); ++i)
+ delete m_extensions[i];
+
destroyGraphicsContext3D();
m_contextGroup->removeContext(this);
@@ -2144,7 +2154,7 @@ bool WebGLRenderingContext::ExtensionTracker::matchesNameWithPrefixes(const Stri
return false;
}
-WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
+PassRefPtr<WebGLExtension> WebGLRenderingContext::getExtension(const String& name)
{
if (isContextLost())
return 0;
@@ -4174,6 +4184,14 @@ void WebGLRenderingContext::loseContextImpl(WebGLRenderingContext::LostContextMo
detachAndRemoveAllObjects();
+ // Lose all the extensions.
+ for (size_t i = 0; i < m_extensions.size(); ++i) {
+ ExtensionTracker* tracker = m_extensions[i];
+ tracker->loseExtension();
+ }
+
+ removeAllCompressedTextureFormats();
+
if (mode != RealLostContext)
destroyGraphicsContext3D();
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698