Index: Source/core/html/canvas/WebGLContextGroup.cpp |
diff --git a/Source/core/html/canvas/WebGLContextGroup.cpp b/Source/core/html/canvas/WebGLContextGroup.cpp |
index 06204706c6c00ec9d79b816b717341f21eef9006..2603c1bb82e8ac18f324749b4ac291fe22dab325 100644 |
--- a/Source/core/html/canvas/WebGLContextGroup.cpp |
+++ b/Source/core/html/canvas/WebGLContextGroup.cpp |
@@ -39,6 +39,8 @@ PassRefPtr<WebGLContextGroup> WebGLContextGroup::create() |
} |
WebGLContextGroup::WebGLContextGroup() |
+ : m_contextCreationCount(0) |
+ , m_acquireRequestCount(0) |
{ |
} |
@@ -54,13 +56,19 @@ GraphicsContext3D* WebGLContextGroup::getAGraphicsContext3D() |
return (*it)->graphicsContext3D(); |
} |
-void WebGLContextGroup::addContext(WebGLRenderingContext* context) |
+unsigned WebGLContextGroup::addContext(WebGLRenderingContext* context) |
{ |
m_contexts.add(context); |
+ return m_contextCreationCount++; |
} |
void WebGLContextGroup::removeContext(WebGLRenderingContext* context) |
{ |
+ // Release all the resources this context has acquired. |
+ for (HashSet<WebGLSharedObject*>::iterator it = m_groupObjects.begin(); it != m_groupObjects.end(); ++it) { |
+ (*it)->release(context); |
+ } |
+ |
// We must call detachAndRemoveAllObjects before removing the last context. |
if (m_contexts.size() == 1 && m_contexts.contains(context)) |
detachAndRemoveAllObjects(); |
@@ -94,4 +102,18 @@ void WebGLContextGroup::loseContextGroup(WebGLRenderingContext::LostContextMode |
detachAndRemoveAllObjects(); |
} |
+long WebGLContextGroup::generateAcquireRequestId() |
+{ |
+ return ++m_acquireRequestCount; |
+} |
+ |
+void WebGLContextGroup::cancelAcquireSharedResource(const WebGLRenderingContext* context, long id) |
+{ |
+ for (HashSet<WebGLSharedObject*>::iterator it = m_groupObjects.begin(); it != m_groupObjects.end(); ++it) { |
+ if ((*it)->cancelAcquireRequest(context, id)) { |
+ break; |
+ } |
+ } |
+} |
+ |
} // namespace WebCore |