Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/node/v8-embedder-heap.h
$ cat -n /usr/include/node/v8-embedder-heap.h 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 11 namespace v8 { 12 namespace internal { 13 class TracedHandles; 14 } // namespace internal 15 16 class Isolate; 17 class Value; 18 19 /** 20 * Handler for embedder roots on non-unified heap garbage collections. 21 */ 22 class V8_EXPORT EmbedderRootsHandler { 23 public: 24 enum class RootHandling { 25 kQueryEmbedderForNonDroppableReferences, 26 kDontQueryEmbedderForAnyReference, 27 }; 28 29 virtual ~EmbedderRootsHandler() = default; 30 31 EmbedderRootsHandler() = default; 32 explicit EmbedderRootsHandler(RootHandling default_traced_reference_handling) 33 : default_traced_reference_handling_(default_traced_reference_handling) {} 34 35 /** 36 * Returns true if the |TracedReference| handle should be considered as root 37 * for the currently running non-tracing garbage collection and false 38 * otherwise. The default implementation will keep all |TracedReference| 39 * references as roots. 40 * 41 * If this returns false, then V8 may decide that the object referred to by 42 * such a handle is reclaimed. In that case, V8 calls |ResetRoot()| for the 43 * |TracedReference|. 44 * 45 * Note that the `handle` is different from the handle that the embedder holds 46 * for retaining the object. 47 * 48 * The concrete implementations must be thread-safe. 49 */ 50 virtual bool IsRoot(const v8::TracedReference
& handle) = 0; 51 52 /** 53 * Used in combination with |IsRoot|. Called by V8 when an 54 * object that is backed by a handle is reclaimed by a non-tracing garbage 55 * collection. It is up to the embedder to reset the original handle. 56 * 57 * Note that the |handle| is different from the handle that the embedder holds 58 * for retaining the object. It is up to the embedder to find the original 59 * handle via the object or class id. 60 */ 61 virtual void ResetRoot(const v8::TracedReference
& handle) = 0; 62 63 /** 64 * Similar to |ResetRoot()|, but opportunistic. The function is called in 65 * parallel for different handles and as such must be thread-safe. In case, 66 * |false| is returned, |ResetRoot()| will be recalled for the same handle. 67 */ 68 virtual bool TryResetRoot(const v8::TracedReference
& 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_
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™