Server IP : 85.214.239.14 / Your IP : 3.144.101.139 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /usr/include/node/cppgc/ |
Upload File : |
// Copyright 2021 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_OBJECT_SIZE_TRAIT_H_ #define INCLUDE_CPPGC_OBJECT_SIZE_TRAIT_H_ #include <cstddef> #include "cppgc/type-traits.h" #include "v8config.h" // NOLINT(build/include_directory) namespace cppgc { namespace internal { struct V8_EXPORT BaseObjectSizeTrait { protected: static size_t GetObjectSizeForGarbageCollected(const void*); static size_t GetObjectSizeForGarbageCollectedMixin(const void*); }; } // namespace internal namespace subtle { /** * Trait specifying how to get the size of an object that was allocated using * `MakeGarbageCollected()`. Also supports querying the size with an inner * pointer to a mixin. */ template <typename T, bool = IsGarbageCollectedMixinTypeV<T>> struct ObjectSizeTrait; template <typename T> struct ObjectSizeTrait<T, false> : cppgc::internal::BaseObjectSizeTrait { static_assert(sizeof(T), "T must be fully defined"); static_assert(IsGarbageCollectedTypeV<T>, "T must be of type GarbageCollected or GarbageCollectedMixin"); static size_t GetSize(const T& object) { return GetObjectSizeForGarbageCollected(&object); } }; template <typename T> struct ObjectSizeTrait<T, true> : cppgc::internal::BaseObjectSizeTrait { static_assert(sizeof(T), "T must be fully defined"); static size_t GetSize(const T& object) { return GetObjectSizeForGarbageCollectedMixin(&object); } }; } // namespace subtle } // namespace cppgc #endif // INCLUDE_CPPGC_OBJECT_SIZE_TRAIT_H_