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(); |
| } |
| -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 { |
|
haraken
2016/12/05 05:15:59
Don't we need to have a call path that clears m_co
Ken Russell (switch to Gerrit)
2016/12/05 06:03:40
Actually, looking at this code again, m_contextGro
haraken
2016/12/05 06:08:40
Sounds nicer.
Ken Russell (switch to Gerrit)
2016/12/05 06:36:20
Will fix.
|
| 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 |