芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/.nvm/versions/node/v14.16.1/include/node/cppgc/trace-trait.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_TRACE_TRAIT_H_ #define INCLUDE_CPPGC_TRACE_TRAIT_H_ #include
#include "cppgc/type-traits.h" namespace cppgc { class Visitor; namespace internal { template
::type>> struct TraceTraitImpl; } // namespace internal using TraceCallback = void (*)(Visitor*, const void*); // TraceDescriptor is used to describe how to trace an object. struct TraceDescriptor { // The adjusted base pointer of the object that should be traced. const void* base_object_payload; // A callback for tracing the object. TraceCallback callback; }; template
struct TraceTrait { static_assert(internal::IsTraceableV
, "T must have a Trace() method"); static TraceDescriptor GetTraceDescriptor(const void* self) { return internal::TraceTraitImpl
::GetTraceDescriptor( static_cast
(self)); } static void Trace(Visitor* visitor, const void* self) { static_cast
(self)->Trace(visitor); } }; namespace internal { template
struct TraceTraitImpl
{ static TraceDescriptor GetTraceDescriptor(const void* self) { return {self, TraceTrait
::Trace}; } }; template
struct TraceTraitImpl
{ static TraceDescriptor GetTraceDescriptor(const void* self) { return static_cast
(self)->GetTraceDescriptor(); } }; } // namespace internal } // namespace cppgc #endif // INCLUDE_CPPGC_TRACE_TRAIT_H_