GIF89; GIF89; %PDF- %PDF-
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
// 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_
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| internal | Folder | 0755 |
|
|
| allocation.h | File | 11.61 KB | 0644 |
|
| common.h | File | 643 B | 0644 |
|
| cross-thread-persistent.h | File | 14.81 KB | 0644 |
|
| custom-space.h | File | 2.4 KB | 0644 |
|
| default-platform.h | File | 2.18 KB | 0644 |
|
| ephemeron-pair.h | File | 804 B | 0644 |
|
| explicit-management.h | File | 3.29 KB | 0644 |
|
| garbage-collected.h | File | 3.11 KB | 0644 |
|
| heap-consistency.h | File | 11.74 KB | 0644 |
|
| heap-handle.h | File | 1.26 KB | 0644 |
|
| heap-state.h | File | 2.57 KB | 0644 |
|
| heap-statistics.h | File | 3.89 KB | 0644 |
|
| heap.h | File | 5.7 KB | 0644 |
|
| liveness-broker.h | File | 2.34 KB | 0644 |
|
| macros.h | File | 1.31 KB | 0644 |
|
| member.h | File | 23.55 KB | 0644 |
|
| name-provider.h | File | 1.99 KB | 0644 |
|
| object-size-trait.h | File | 1.6 KB | 0644 |
|
| persistent.h | File | 13.61 KB | 0644 |
|
| platform.h | File | 5.9 KB | 0644 |
|
| prefinalizer.h | File | 2.88 KB | 0644 |
|
| process-heap-statistics.h | File | 1009 B | 0644 |
|
| sentinel-pointer.h | File | 1.18 KB | 0644 |
|
| source-location.h | File | 414 B | 0644 |
|
| testing.h | File | 2.96 KB | 0644 |
|
| trace-trait.h | File | 3.4 KB | 0644 |
|
| type-traits.h | File | 8.45 KB | 0644 |
|
| visitor.h | File | 18.08 KB | 0644 |
|