v8 12.4.254 (node 22.4.1)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
v8-embedder-heap.h
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_V8_EMBEDDER_HEAP_H_
6#define INCLUDE_V8_EMBEDDER_HEAP_H_
7
8#include "v8-traced-handle.h" // NOLINT(build/include_directory)
9#include "v8config.h" // NOLINT(build/include_directory)
10
11namespace v8 {
12namespace internal {
13class TracedHandles;
14} // namespace internal
15
16class Isolate;
17class Value;
18
23 public:
24 enum class RootHandling {
25 kQueryEmbedderForNonDroppableReferences,
26 kDontQueryEmbedderForAnyReference,
27 };
28
29 virtual ~EmbedderRootsHandler() = default;
30
32 explicit EmbedderRootsHandler(RootHandling default_traced_reference_handling)
33 : default_traced_reference_handling_(default_traced_reference_handling) {}
34
50 virtual bool IsRoot(const v8::TracedReference<v8::Value>& handle) = 0;
51
61 virtual void ResetRoot(const v8::TracedReference<v8::Value>& handle) = 0;
62
68 virtual bool TryResetRoot(const v8::TracedReference<v8::Value>& handle) {
69 ResetRoot(handle);
70 return true;
71 }
72
73 private:
74 const RootHandling default_traced_reference_handling_ =
75 RootHandling::kQueryEmbedderForNonDroppableReferences;
76
77 friend class internal::TracedHandles;
78};
79
80} // namespace v8
81
82#endif // INCLUDE_V8_EMBEDDER_HEAP_H_
virtual bool TryResetRoot(const v8::TracedReference< v8::Value > &handle)
virtual ~EmbedderRootsHandler()=default
virtual bool IsRoot(const v8::TracedReference< v8::Value > &handle)=0
virtual void ResetRoot(const v8::TracedReference< v8::Value > &handle)=0
EmbedderRootsHandler(RootHandling default_traced_reference_handling)
#define V8_EXPORT
Definition v8config.h:753