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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLContextGroup.cpp

Issue 2547813002: Remove WebGLObject maps from WebGLRenderingContextBase and WebGLContextGroup. (Closed)
Patch Set: Fixed WebGLContextObject::validate. Made WebGLExtension non-finalized. Created 4 years 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
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..46ac62e5f1abe5aea8b3ddb2a0f502d97ba25661 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());
+ // Weak processing removes dead entries from the HeapHashSet, so it's
+ // guaranteed that this will not return null for the reason that a
+ // WeakMember was nulled out.
return (*m_contexts.begin())->contextGL();
}
@@ -49,37 +41,25 @@ void WebGLContextGroup::addContext(WebGLRenderingContextBase* context) {
m_contexts.add(context);
haraken 2016/12/05 05:15:59 You need to add a write barrier here.
Ken Russell (switch to Gerrit) 2016/12/05 06:03:40 What should it read? ScriptWrappableVisitor::writ
haraken 2016/12/05 06:08:39 ScriptWrappableVisitor::writeBarrier(this, context
Ken Russell (switch to Gerrit) 2016/12/05 06:36:20 Thanks, will add.
}
-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;
haraken 2016/12/05 05:15:59 Shall we add CHECK(m_numberOfContextLosses > 0) to
Ken Russell (switch to Gerrit) 2016/12/05 06:03:40 I don't think it's necessary. In the very unlikely
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
+ // need to use weak members to get the desired semantics in Oilpan, but
+ // no such TraceWrapperMember (like TraceWrapperWeakMember) exists yet.
haraken 2016/12/05 05:15:59 You need to add the write barrier to line 41.
Ken Russell (switch to Gerrit) 2016/12/05 06:03:40 Please see question above.
+ for (auto context : m_contexts) {
+ visitor->traceWrappersWithManualWriteBarrier(context);
+ }
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698