Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webgl/WebGLSharedObject.cpp |
| diff --git a/third_party/WebKit/Source/modules/webgl/WebGLSharedObject.cpp b/third_party/WebKit/Source/modules/webgl/WebGLSharedObject.cpp |
| index 4cc3717bf4967e31448970f07924bb323dd52ec7..074fcbc4685f2a5c9d1d47a454df72f607404848 100644 |
| --- a/third_party/WebKit/Source/modules/webgl/WebGLSharedObject.cpp |
| +++ b/third_party/WebKit/Source/modules/webgl/WebGLSharedObject.cpp |
| @@ -31,24 +31,33 @@ |
| namespace blink { |
| WebGLSharedObject::WebGLSharedObject(WebGLRenderingContextBase* context) |
| - : WebGLObject(context), m_contextGroup(context->contextGroup()) {} |
| - |
| -WebGLSharedObject::~WebGLSharedObject() { |
| - if (m_contextGroup) |
| - m_contextGroup->removeObject(this); |
| + : WebGLObject(context), m_contextGroup(this, context->contextGroup()) {} |
| + |
| +bool WebGLSharedObject::validate(const WebGLContextGroup* contextGroup, |
| + const WebGLRenderingContextBase*) const { |
| + // The contexts and context groups no longer maintain references to all |
| + // the objects they ever created, so there's no way to invalidate them |
| + // eagerly during context loss. The invalidation is discovered lazily. |
| + return contextGroup == m_contextGroup && |
| + cachedNumberOfContextLosses() == contextGroup->numberOfContextLosses(); |
|
Zhenyao Mo
2016/12/02 18:58:40
Can you add a comment here saying for WebGL, there
Ken Russell (switch to Gerrit)
2016/12/02 20:38:49
There's actually no such assumption in this code,
|
| } |
| -void WebGLSharedObject::detachContextGroup() { |
| - detach(); |
| - if (m_contextGroup) { |
| - deleteObject(nullptr); |
| - m_contextGroup->removeObject(this); |
| - m_contextGroup = nullptr; |
| - } |
| +uint32_t WebGLSharedObject::currentNumberOfContextLosses() const { |
| + return m_contextGroup->numberOfContextLosses(); |
| } |
| gpu::gles2::GLES2Interface* WebGLSharedObject::getAGLInterface() const { |
| return m_contextGroup ? m_contextGroup->getAGLInterface() : nullptr; |
| } |
| +DEFINE_TRACE(WebGLSharedObject) { |
| + visitor->trace(m_contextGroup); |
| + WebGLObject::trace(visitor); |
| +} |
| + |
| +DEFINE_TRACE_WRAPPERS(WebGLSharedObject) { |
| + visitor->traceWrappers(m_contextGroup); |
| + WebGLObject::traceWrappers(visitor); |
| +} |
| + |
| } // namespace blink |