Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webgl/WebGLContextGroup.cpp |
| diff --git a/third_party/WebKit/Source/modules/webgl/WebGLContextGroup.cpp b/third_party/WebKit/Source/modules/webgl/WebGLContextGroup.cpp |
| index ea23ab90514d39bc18801a120f06dd8c1ae43ebe..66425c8feed659a2f47d0001bf1441617253c732 100644 |
| --- a/third_party/WebKit/Source/modules/webgl/WebGLContextGroup.cpp |
| +++ b/third_party/WebKit/Source/modules/webgl/WebGLContextGroup.cpp |
| @@ -25,23 +25,15 @@ |
| #include "modules/webgl/WebGLContextGroup.h" |
| -#include "modules/webgl/WebGLSharedObject.h" |
| - |
| namespace blink { |
| -PassRefPtr<WebGLContextGroup> WebGLContextGroup::create() { |
| - RefPtr<WebGLContextGroup> contextGroup = adoptRef(new WebGLContextGroup()); |
| - return contextGroup.release(); |
| -} |
| - |
| -WebGLContextGroup::WebGLContextGroup() {} |
| - |
| -WebGLContextGroup::~WebGLContextGroup() { |
| - detachAndRemoveAllObjects(); |
| -} |
| +WebGLContextGroup::WebGLContextGroup() : m_numberOfContextLosses(0) {} |
| gpu::gles2::GLES2Interface* WebGLContextGroup::getAGLInterface() { |
| ASSERT(!m_contexts.isEmpty()); |
| + // TODO(kbr): is it guaranteed that we won't return null here |
| + // because the WeakMember was nulled out but its entry wasn't |
| + // removed from the HeapHashSet? |
|
Ken Russell (switch to Gerrit)
2016/12/02 09:58:48
haraken@ and sigbjornf@: could you answer this que
haraken
2016/12/02 10:14:34
The weak processing removes the dead entry from th
sof
2016/12/02 10:39:06
https://cs.chromium.org/chromium/src/third_party/W
Ken Russell (switch to Gerrit)
2016/12/02 20:38:49
Thanks for the feedback. I'll include this informa
|
| return (*m_contexts.begin())->contextGL(); |
| } |
| @@ -49,37 +41,24 @@ void WebGLContextGroup::addContext(WebGLRenderingContextBase* context) { |
| m_contexts.add(context); |
| } |
| -void WebGLContextGroup::removeContext(WebGLRenderingContextBase* context) { |
| - // We must call detachAndRemoveAllObjects before removing the last context. |
| - if (m_contexts.size() == 1 && m_contexts.contains(context)) |
| - detachAndRemoveAllObjects(); |
| - |
| - m_contexts.remove(context); |
| -} |
| - |
| -void WebGLContextGroup::removeObject(WebGLSharedObject* object) { |
| - m_groupObjects.remove(object); |
| -} |
| - |
| -void WebGLContextGroup::addObject(WebGLSharedObject* object) { |
| - m_groupObjects.add(object); |
| -} |
| - |
| -void WebGLContextGroup::detachAndRemoveAllObjects() { |
| - while (!m_groupObjects.isEmpty()) { |
| - (*m_groupObjects.begin())->detachContextGroup(); |
| - } |
| -} |
| - |
| void WebGLContextGroup::loseContextGroup( |
| WebGLRenderingContextBase::LostContextMode mode, |
| WebGLRenderingContextBase::AutoRecoveryMethod autoRecoveryMethod) { |
| - // Detach must happen before loseContextImpl, which destroys the |
| - // GraphicsContext3D and prevents groupObjects from being properly deleted. |
| - detachAndRemoveAllObjects(); |
| - |
| + ++m_numberOfContextLosses; |
| for (WebGLRenderingContextBase* const context : m_contexts) |
| context->loseContextImpl(mode, autoRecoveryMethod); |
| } |
| +uint32_t WebGLContextGroup::numberOfContextLosses() const { |
| + return m_numberOfContextLosses; |
| +} |
| + |
| +DEFINE_TRACE_WRAPPERS(WebGLContextGroup) { |
| + // TODO(kbr, mlippautz): need to use the manual write barrier since we |
|
Ken Russell (switch to Gerrit)
2016/12/02 09:58:48
mlippautz: am I correct in my thinking here?
|
| + // need to use weak members, but no such TraceWrapperMember exists yet. |
| + for (auto context : m_contexts) { |
| + visitor->traceWrappersWithManualWriteBarrier(context); |
| + } |
| +} |
| + |
| } // namespace blink |