bindings, heap: Avoid reading in-construction on ASW::Trace
The in-construction bit is considered an implementation detail of the garbage collector and should not be relied on by user objects. ActiveScriptWrappable objects are queried by the garbage collector for pending activities and rooted as long as there are activities pending. Since the GC may interrupt construction of ASW objects the virtual methods for HasPendingActivity() and potentially GetExecutionContext() may not be called. While ASW(Base) HasPendingActivity() may provide a default body for HasPendingActivity() and thus work around the construction problem, the call to GetExecutionContext() is dispatched through CRTP and there are three different use cases: a) GetExecutionContext() may still be pure virtual at ASW registration (EventTarget). b) GetExecutionContext() may already be marked as final at ASW registration (Node) c) GetExecutionContext() may be a regular method (users of ExecutionContextClient) Use case a) would require a default body for GetExecutionContext in ASW while use case b) prohibits that. The other alternative would have been adding virtual ScriptWrappable::GetExecutionContext() { return nullptr; } Since ExecutionContext is not a concept of platform layering would be violated. (Even though just a forward declaration would suffice.) Bug: chromium:1056170 Change-Id: Ibf3cfb600eaa7f3e11e76579268b52689883440c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2167433 Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Reviewed-by:Kentaro Hara <haraken@chromium.org> Cr-Commit-Position: refs/heads/master@{#762847}
Showing
Please register or sign in to comment