DescriptionManage WebGLRenderingContextBase's weak refs manually without Oilpan.
WebGLRenderingContextBase keeps a set of registered on-heap WebGLContextObjects,
ensuring that these are detached if it is finalized first -- it being unsafe to
make any reverse access of the *Base object from those after that point. These
references must however be weak as the *Base object mustn't keep WebGL objects
alive if they're not otherwise used & referenced.
Without Oilpan enabled by default, *Base isn't on the heap, that set of
weak WebGLContextObject references must be managed manually rather than relying
on HeapHashSet<WeakMember<T>>. If we were to do so, a GC might identify a
WebGLContextObject as only being weakly referenced from the *Base object and
clear out the entry for it in the set. Should the *Base object then be finalized
and destructed before that WebGLContextObject is lazily swept, it would attempt
to access an already freed object. With sorry consequences.
To address, we keep an off-heap set of untraced raw WebGLContextObject pointers,
which are effectively weak. Like now/before, it is the responsibility of either
the WebGLContextObject to detach itself when finalized or have the *Base
object do that and detach the whole set.
R=kbr,haraken
BUG=534524
Committed: https://crrev.com/ec0092e045dffb6df9ba3df114724e4dd421ca83
Cr-Commit-Position: refs/heads/master@{#350775}
Patch Set 1 #Patch Set 2 : strongify m_contextObjects #Patch Set 3 : weakify using a HashSet #Patch Set 4 : reinstate WebGLContextObject dtor (non-Oilpan) #
Messages
Total messages: 25 (6 generated)
|