summaryrefslogtreecommitdiffstats
path: root/chromium/v8/include/cppgc/internal/persistent-node.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/v8/include/cppgc/internal/persistent-node.h')
-rw-r--r--chromium/v8/include/cppgc/internal/persistent-node.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/chromium/v8/include/cppgc/internal/persistent-node.h b/chromium/v8/include/cppgc/internal/persistent-node.h
index 11cf69623e8..e05efe36213 100644
--- a/chromium/v8/include/cppgc/internal/persistent-node.h
+++ b/chromium/v8/include/cppgc/internal/persistent-node.h
@@ -56,6 +56,11 @@ class PersistentNode final {
bool IsUsed() const { return trace_; }
+ void* owner() const {
+ CPPGC_DCHECK(IsUsed());
+ return owner_;
+ }
+
private:
// PersistentNode acts as a designated union:
// If trace_ != nullptr, owner_ points to the corresponding Persistent handle.
@@ -67,11 +72,13 @@ class PersistentNode final {
TraceCallback trace_ = nullptr;
};
-class V8_EXPORT PersistentRegion {
+class V8_EXPORT PersistentRegion final {
using PersistentNodeSlots = std::array<PersistentNode, 256u>;
public:
PersistentRegion() = default;
+ // Clears Persistent fields to avoid stale pointers after heap teardown.
+ ~PersistentRegion();
PersistentRegion(const PersistentRegion&) = delete;
PersistentRegion& operator=(const PersistentRegion&) = delete;