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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLSharedObject.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/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

Powered by Google App Engine
This is Rietveld 408576698