$47 GRAYBYTE WORDPRESS FILE MANAGER $32

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cpanel/ea-nodejs22/include/node/cppgc/

HOME
Current File : /opt/cpanel/ea-nodejs22/include/node/cppgc//liveness-broker.h
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef INCLUDE_CPPGC_LIVENESS_BROKER_H_
#define INCLUDE_CPPGC_LIVENESS_BROKER_H_

#include "cppgc/heap.h"
#include "cppgc/member.h"
#include "cppgc/sentinel-pointer.h"
#include "cppgc/trace-trait.h"
#include "v8config.h"  // NOLINT(build/include_directory)

namespace cppgc {

namespace internal {
class LivenessBrokerFactory;
}  // namespace internal

/**
 * The broker is passed to weak callbacks to allow (temporarily) querying
 * the liveness state of an object. References to non-live objects must be
 * cleared when `IsHeapObjectAlive()` returns false.
 *
 * \code
 * class GCedWithCustomWeakCallback final
 *   : public GarbageCollected<GCedWithCustomWeakCallback> {
 *  public:
 *   UntracedMember<Bar> bar;
 *
 *   void CustomWeakCallbackMethod(const LivenessBroker& broker) {
 *     if (!broker.IsHeapObjectAlive(bar))
 *       bar = nullptr;
 *   }
 *
 *   void Trace(cppgc::Visitor* visitor) const {
 *     visitor->RegisterWeakCallbackMethod<
 *         GCedWithCustomWeakCallback,
 *         &GCedWithCustomWeakCallback::CustomWeakCallbackMethod>(this);
 *   }
 * };
 * \endcode
 */
class V8_EXPORT LivenessBroker final {
 public:
  template <typename T>
  bool IsHeapObjectAlive(const T* object) const {
    // - nullptr objects are considered alive to allow weakness to be used from
    // stack while running into a conservative GC. Treating nullptr as dead
    // would mean that e.g. custom collections could not be strongified on
    // stack.
    // - Sentinel pointers are also preserved in weakness and not cleared.
    return !object || object == kSentinelPointer ||
           IsHeapObjectAliveImpl(
               TraceTrait<T>::GetTraceDescriptor(object).base_object_payload);
  }

  template <typename T>
  bool IsHeapObjectAlive(const WeakMember<T>& weak_member) const {
    return IsHeapObjectAlive<T>(weak_member.Get());
  }

  template <typename T>
  bool IsHeapObjectAlive(const UntracedMember<T>& untraced_member) const {
    return IsHeapObjectAlive<T>(untraced_member.Get());
  }

 private:
  LivenessBroker() = default;

  bool IsHeapObjectAliveImpl(const void*) const;

  friend class internal::LivenessBrokerFactory;
};

}  // namespace cppgc

#endif  // INCLUDE_CPPGC_LIVENESS_BROKER_H_

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
16 Mar 2026 5.04 PM
root / root
0755
internal
--
16 Mar 2026 5.04 PM
root / root
0755
allocation.h
11.61 KB
17 Jan 2026 1.16 AM
root / root
0644
common.h
0.628 KB
17 Jan 2026 1.16 AM
root / root
0644
cross-thread-persistent.h
14.814 KB
17 Jan 2026 1.16 AM
root / root
0644
custom-space.h
2.396 KB
17 Jan 2026 1.16 AM
root / root
0644
default-platform.h
2.178 KB
17 Jan 2026 1.16 AM
root / root
0644
ephemeron-pair.h
0.785 KB
17 Jan 2026 1.16 AM
root / root
0644
explicit-management.h
3.291 KB
17 Jan 2026 1.16 AM
root / root
0644
garbage-collected.h
3.108 KB
17 Jan 2026 1.16 AM
root / root
0644
heap-consistency.h
11.739 KB
17 Jan 2026 1.16 AM
root / root
0644
heap-handle.h
1.259 KB
17 Jan 2026 1.16 AM
root / root
0644
heap-state.h
2.57 KB
17 Jan 2026 1.16 AM
root / root
0644
heap-statistics.h
3.889 KB
17 Jan 2026 1.16 AM
root / root
0644
heap.h
5.697 KB
17 Jan 2026 1.16 AM
root / root
0644
liveness-broker.h
2.34 KB
17 Jan 2026 1.16 AM
root / root
0644
macros.h
1.313 KB
17 Jan 2026 1.16 AM
root / root
0644
member.h
23.549 KB
17 Jan 2026 1.16 AM
root / root
0644
name-provider.h
1.986 KB
17 Jan 2026 1.16 AM
root / root
0644
object-size-trait.h
1.604 KB
17 Jan 2026 1.16 AM
root / root
0644
persistent.h
13.61 KB
17 Jan 2026 1.16 AM
root / root
0644
platform.h
5.9 KB
17 Jan 2026 1.16 AM
root / root
0644
prefinalizer.h
2.875 KB
17 Jan 2026 1.16 AM
root / root
0644
process-heap-statistics.h
0.985 KB
17 Jan 2026 1.16 AM
root / root
0644
sentinel-pointer.h
1.18 KB
17 Jan 2026 1.16 AM
root / root
0644
source-location.h
0.404 KB
17 Jan 2026 1.16 AM
root / root
0644
testing.h
2.962 KB
17 Jan 2026 1.16 AM
root / root
0644
trace-trait.h
3.397 KB
17 Jan 2026 1.16 AM
root / root
0644
type-traits.h
8.453 KB
17 Jan 2026 1.16 AM
root / root
0644
visitor.h
18.082 KB
17 Jan 2026 1.16 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF