libv8 8.4.255.0-universal-darwin-20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ext/libv8/.location.yml +1 -0
- data/ext/libv8/location.rb +89 -0
- data/ext/libv8/paths.rb +28 -0
- data/lib/libv8.rb +9 -0
- data/lib/libv8/version.rb +3 -0
- data/vendor/v8/include/cppgc/allocation.h +124 -0
- data/vendor/v8/include/cppgc/garbage-collected.h +192 -0
- data/vendor/v8/include/cppgc/heap.h +50 -0
- data/vendor/v8/include/cppgc/internal/accessors.h +26 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +44 -0
- data/vendor/v8/include/cppgc/internal/compiler-specific.h +26 -0
- data/vendor/v8/include/cppgc/internal/finalizer-trait.h +90 -0
- data/vendor/v8/include/cppgc/internal/gc-info.h +43 -0
- data/vendor/v8/include/cppgc/internal/logging.h +50 -0
- data/vendor/v8/include/cppgc/internal/persistent-node.h +109 -0
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +133 -0
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +31 -0
- data/vendor/v8/include/cppgc/liveness-broker.h +50 -0
- data/vendor/v8/include/cppgc/macros.h +26 -0
- data/vendor/v8/include/cppgc/member.h +206 -0
- data/vendor/v8/include/cppgc/persistent.h +304 -0
- data/vendor/v8/include/cppgc/platform.h +31 -0
- data/vendor/v8/include/cppgc/prefinalizer.h +54 -0
- data/vendor/v8/include/cppgc/source-location.h +59 -0
- data/vendor/v8/include/cppgc/trace-trait.h +67 -0
- data/vendor/v8/include/cppgc/type-traits.h +109 -0
- data/vendor/v8/include/cppgc/visitor.h +137 -0
- data/vendor/v8/include/libplatform/libplatform-export.h +29 -0
- data/vendor/v8/include/libplatform/libplatform.h +85 -0
- data/vendor/v8/include/libplatform/v8-tracing.h +332 -0
- data/vendor/v8/include/v8-fast-api-calls.h +412 -0
- data/vendor/v8/include/v8-inspector-protocol.h +13 -0
- data/vendor/v8/include/v8-inspector.h +327 -0
- data/vendor/v8/include/v8-internal.h +389 -0
- data/vendor/v8/include/v8-platform.h +577 -0
- data/vendor/v8/include/v8-profiler.h +1059 -0
- data/vendor/v8/include/v8-util.h +652 -0
- data/vendor/v8/include/v8-value-serializer-version.h +24 -0
- data/vendor/v8/include/v8-version-string.h +38 -0
- data/vendor/v8/include/v8-version.h +20 -0
- data/vendor/v8/include/v8-wasm-trap-handler-posix.h +31 -0
- data/vendor/v8/include/v8-wasm-trap-handler-win.h +28 -0
- data/vendor/v8/include/v8.h +12018 -0
- data/vendor/v8/include/v8config.h +465 -0
- data/vendor/v8/out.gn/libv8/obj/libv8_libbase.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/libv8_libplatform.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/third_party/icu/libicui18n.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/third_party/icu/libicuuc.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/third_party/zlib/google/libcompression_utils_portable.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/third_party/zlib/libchrome_zlib.a +0 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8d065f6cf847c085ad01d7a080ee6e6c6ebd74715333f41e32cead93d95fc439
|
4
|
+
data.tar.gz: 43bff1bedb58084c917111ca671725304a6f9aba5588489937796b8df5b2fc2a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 76f8bbbd9526e8b3b78a38528af04ff95406cbb8d142c89dbc5f19867f1ce40d9c8cff30a78e572ec301f1b95c631d659e1e783c5fee5e5b3d968428158abc70
|
7
|
+
data.tar.gz: fbd675e42862a28c5e3ea039d60f8a1f12fce9dba9d7ece4ca9088c175c11dea5408277521f6da2db1b0649454f6b771f59ec0cc3788f6fddfad6c701e947846
|
@@ -0,0 +1 @@
|
|
1
|
+
--- !ruby/object:Libv8::Location::Vendor {}
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'pathname'
|
3
|
+
require File.expand_path '../paths', __FILE__
|
4
|
+
|
5
|
+
module Libv8
|
6
|
+
class Location
|
7
|
+
def install!
|
8
|
+
File.open(Pathname(__FILE__).dirname.join('.location.yml'), "w") do |f|
|
9
|
+
f.write self.to_yaml
|
10
|
+
end
|
11
|
+
return 0
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.load!
|
15
|
+
File.open(Pathname(__FILE__).dirname.join('.location.yml')) do |f|
|
16
|
+
YAML.load f
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Vendor < Location
|
21
|
+
def install!
|
22
|
+
require File.expand_path '../builder', __FILE__
|
23
|
+
builder = Libv8::Builder.new
|
24
|
+
exit_status = builder.build_libv8!
|
25
|
+
super if exit_status == 0
|
26
|
+
verify_installation!
|
27
|
+
return exit_status
|
28
|
+
end
|
29
|
+
|
30
|
+
def configure(context = MkmfContext.new)
|
31
|
+
context.incflags.insert 0, Libv8::Paths.include_paths.map{ |p| "-I#{p}" }.join(" ") + " "
|
32
|
+
context.ldflags.insert 0, Libv8::Paths.object_paths.join(" ") + " "
|
33
|
+
end
|
34
|
+
|
35
|
+
def verify_installation!
|
36
|
+
include_paths = Libv8::Paths.include_paths
|
37
|
+
unless include_paths.detect { |p| Pathname(p).join('v8.h').exist? }
|
38
|
+
fail HeaderNotFound, "Unable to locate 'v8.h' in the libv8 header paths: #{include_paths.inspect}"
|
39
|
+
end
|
40
|
+
Libv8::Paths.object_paths.each do |p|
|
41
|
+
fail ArchiveNotFound, p unless File.exist? p
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class HeaderNotFound < StandardError; end
|
46
|
+
|
47
|
+
class ArchiveNotFound < StandardError
|
48
|
+
def initialize(filename)
|
49
|
+
super "libv8 did not install properly, expected binary v8 archive '#{filename}'to exist, but it was not found"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class System < Location
|
55
|
+
def configure(context = MkmfContext.new)
|
56
|
+
context.send(:dir_config, 'v8')
|
57
|
+
context.send(:find_header, 'v8.h') or fail NotFoundError
|
58
|
+
context.send(:find_header, 'libplatform/libplatform.h') or fail NotFoundError
|
59
|
+
context.send(:have_library, 'v8') or fail NotFoundError
|
60
|
+
end
|
61
|
+
|
62
|
+
class NotFoundError < StandardError
|
63
|
+
def initialize(*args)
|
64
|
+
super(<<-EOS)
|
65
|
+
By using --with-system-v8, you have chosen to use the version
|
66
|
+
of V8 found on your system and *not* the one that is bundled with
|
67
|
+
the libv8 rubygem.
|
68
|
+
|
69
|
+
However, your system version of v8 could not be located.
|
70
|
+
|
71
|
+
Please make sure your system version of v8 that is compatible
|
72
|
+
with #{Libv8::VERSION} installed. You may need to use the
|
73
|
+
--with-v8-dir option if it is installed in a non-standard location
|
74
|
+
EOS
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
class MkmfContext
|
80
|
+
def incflags
|
81
|
+
$INCFLAGS
|
82
|
+
end
|
83
|
+
|
84
|
+
def ldflags
|
85
|
+
$LDFLAGS
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
data/ext/libv8/paths.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
require 'shellwords'
|
3
|
+
|
4
|
+
module Libv8
|
5
|
+
module Paths
|
6
|
+
module_function
|
7
|
+
|
8
|
+
def include_paths
|
9
|
+
[Shellwords.escape(File.join(vendored_source_path, 'include'))]
|
10
|
+
end
|
11
|
+
|
12
|
+
def object_paths
|
13
|
+
[Shellwords.escape(File.join(vendored_source_path,
|
14
|
+
'out.gn',
|
15
|
+
'libv8',
|
16
|
+
'obj',
|
17
|
+
"libv8_monolith.#{config['LIBEXT']}"))]
|
18
|
+
end
|
19
|
+
|
20
|
+
def config
|
21
|
+
RbConfig::MAKEFILE_CONFIG
|
22
|
+
end
|
23
|
+
|
24
|
+
def vendored_source_path
|
25
|
+
File.expand_path "../../../vendor/v8", __FILE__
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/libv8.rb
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
// Copyright 2020 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_CPPGC_ALLOCATION_H_
|
6
|
+
#define INCLUDE_CPPGC_ALLOCATION_H_
|
7
|
+
|
8
|
+
#include <stdint.h>
|
9
|
+
#include <atomic>
|
10
|
+
|
11
|
+
#include "cppgc/garbage-collected.h"
|
12
|
+
#include "cppgc/heap.h"
|
13
|
+
#include "cppgc/internal/api-constants.h"
|
14
|
+
#include "cppgc/internal/gc-info.h"
|
15
|
+
|
16
|
+
namespace cppgc {
|
17
|
+
|
18
|
+
template <typename T>
|
19
|
+
class MakeGarbageCollectedTraitBase;
|
20
|
+
|
21
|
+
namespace internal {
|
22
|
+
|
23
|
+
class V8_EXPORT MakeGarbageCollectedTraitInternal {
|
24
|
+
protected:
|
25
|
+
static inline void MarkObjectAsFullyConstructed(const void* payload) {
|
26
|
+
// See api_constants for an explanation of the constants.
|
27
|
+
std::atomic<uint16_t>* atomic_mutable_bitfield =
|
28
|
+
reinterpret_cast<std::atomic<uint16_t>*>(
|
29
|
+
const_cast<uint16_t*>(reinterpret_cast<const uint16_t*>(
|
30
|
+
reinterpret_cast<const uint8_t*>(payload) -
|
31
|
+
api_constants::kFullyConstructedBitFieldOffsetFromPayload)));
|
32
|
+
uint16_t value = atomic_mutable_bitfield->load(std::memory_order_relaxed);
|
33
|
+
value = value | api_constants::kFullyConstructedBitMask;
|
34
|
+
atomic_mutable_bitfield->store(value, std::memory_order_release);
|
35
|
+
}
|
36
|
+
|
37
|
+
static void* Allocate(cppgc::Heap* heap, size_t size, GCInfoIndex index);
|
38
|
+
|
39
|
+
friend class HeapObjectHeader;
|
40
|
+
};
|
41
|
+
|
42
|
+
} // namespace internal
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Base trait that provides utilities for advancers users that have custom
|
46
|
+
* allocation needs (e.g., overriding size). It's expected that users override
|
47
|
+
* MakeGarbageCollectedTrait (see below) and inherit from
|
48
|
+
* MakeGarbageCollectedTraitBase and make use of the low-level primitives
|
49
|
+
* offered to allocate and construct an object.
|
50
|
+
*/
|
51
|
+
template <typename T>
|
52
|
+
class MakeGarbageCollectedTraitBase
|
53
|
+
: private internal::MakeGarbageCollectedTraitInternal {
|
54
|
+
protected:
|
55
|
+
/**
|
56
|
+
* Allocates memory for an object of type T.
|
57
|
+
*
|
58
|
+
* \param heap The heap to allocate this object on.
|
59
|
+
* \param size The size that should be reserved for the object.
|
60
|
+
* \returns the memory to construct an object of type T on.
|
61
|
+
*/
|
62
|
+
static void* Allocate(Heap* heap, size_t size) {
|
63
|
+
// TODO(chromium:1056170): Allow specifying arena for specific embedder
|
64
|
+
// uses.
|
65
|
+
return internal::MakeGarbageCollectedTraitInternal::Allocate(
|
66
|
+
heap, size, internal::GCInfoTrait<T>::Index());
|
67
|
+
}
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Marks an object as fully constructed, resulting in precise handling by the
|
71
|
+
* garbage collector.
|
72
|
+
*
|
73
|
+
* \param payload The base pointer the object is allocated at.
|
74
|
+
*/
|
75
|
+
static void MarkObjectAsFullyConstructed(const void* payload) {
|
76
|
+
internal::MakeGarbageCollectedTraitInternal::MarkObjectAsFullyConstructed(
|
77
|
+
payload);
|
78
|
+
}
|
79
|
+
};
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Default trait class that specifies how to construct an object of type T.
|
83
|
+
* Advanced users may override how an object is constructed using the utilities
|
84
|
+
* that are provided through MakeGarbageCollectedTraitBase.
|
85
|
+
*
|
86
|
+
* Any trait overriding construction must
|
87
|
+
* - allocate through MakeGarbageCollectedTraitBase<T>::Allocate;
|
88
|
+
* - mark the object as fully constructed using
|
89
|
+
* MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed;
|
90
|
+
*/
|
91
|
+
template <typename T>
|
92
|
+
class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase<T> {
|
93
|
+
public:
|
94
|
+
template <typename... Args>
|
95
|
+
static T* Call(Heap* heap, Args&&... args) {
|
96
|
+
static_assert(internal::IsGarbageCollectedType<T>::value,
|
97
|
+
"T needs to be a garbage collected object");
|
98
|
+
static_assert(
|
99
|
+
!internal::IsGarbageCollectedMixinType<T>::value ||
|
100
|
+
sizeof(T) <= internal::api_constants::kLargeObjectSizeThreshold,
|
101
|
+
"GarbageCollectedMixin may not be a large object");
|
102
|
+
void* memory = MakeGarbageCollectedTraitBase<T>::Allocate(heap, sizeof(T));
|
103
|
+
T* object = ::new (memory) T(std::forward<Args>(args)...);
|
104
|
+
MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed(object);
|
105
|
+
return object;
|
106
|
+
}
|
107
|
+
};
|
108
|
+
|
109
|
+
/**
|
110
|
+
* Constructs a managed object of type T where T transitively inherits from
|
111
|
+
* GarbageCollected.
|
112
|
+
*
|
113
|
+
* \param args List of arguments with which an instance of T will be
|
114
|
+
* constructed.
|
115
|
+
* \returns an instance of type T.
|
116
|
+
*/
|
117
|
+
template <typename T, typename... Args>
|
118
|
+
T* MakeGarbageCollected(Heap* heap, Args&&... args) {
|
119
|
+
return MakeGarbageCollectedTrait<T>::Call(heap, std::forward<Args>(args)...);
|
120
|
+
}
|
121
|
+
|
122
|
+
} // namespace cppgc
|
123
|
+
|
124
|
+
#endif // INCLUDE_CPPGC_ALLOCATION_H_
|
@@ -0,0 +1,192 @@
|
|
1
|
+
// Copyright 2020 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_CPPGC_GARBAGE_COLLECTED_H_
|
6
|
+
#define INCLUDE_CPPGC_GARBAGE_COLLECTED_H_
|
7
|
+
|
8
|
+
#include <type_traits>
|
9
|
+
|
10
|
+
#include "cppgc/internal/api-constants.h"
|
11
|
+
#include "cppgc/macros.h"
|
12
|
+
#include "cppgc/platform.h"
|
13
|
+
#include "cppgc/trace-trait.h"
|
14
|
+
#include "cppgc/type-traits.h"
|
15
|
+
|
16
|
+
namespace cppgc {
|
17
|
+
|
18
|
+
class Visitor;
|
19
|
+
|
20
|
+
namespace internal {
|
21
|
+
|
22
|
+
class GarbageCollectedBase {
|
23
|
+
public:
|
24
|
+
// Must use MakeGarbageCollected.
|
25
|
+
void* operator new(size_t) = delete;
|
26
|
+
void* operator new[](size_t) = delete;
|
27
|
+
// The garbage collector is taking care of reclaiming the object. Also,
|
28
|
+
// virtual destructor requires an unambiguous, accessible 'operator delete'.
|
29
|
+
void operator delete(void*) {
|
30
|
+
#ifdef V8_ENABLE_CHECKS
|
31
|
+
internal::Abort();
|
32
|
+
#endif // V8_ENABLE_CHECKS
|
33
|
+
}
|
34
|
+
void operator delete[](void*) = delete;
|
35
|
+
|
36
|
+
protected:
|
37
|
+
GarbageCollectedBase() = default;
|
38
|
+
};
|
39
|
+
|
40
|
+
} // namespace internal
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Base class for managed objects. Only descendent types of GarbageCollected
|
44
|
+
* can be constructed using MakeGarbageCollected. Must be inherited from as
|
45
|
+
* left-most base class.
|
46
|
+
*
|
47
|
+
* Types inheriting from GarbageCollected must provide a method of
|
48
|
+
* signature `void Trace(cppgc::Visitor*) const` that dispatchs all managed
|
49
|
+
* pointers to the visitor and delegates to garbage-collected base classes.
|
50
|
+
* The method must be virtual if the type is not directly a child of
|
51
|
+
* GarbageCollected and marked as final.
|
52
|
+
*
|
53
|
+
* \code
|
54
|
+
* // Example using final class.
|
55
|
+
* class FinalType final : public GarbageCollected<FinalType> {
|
56
|
+
* public:
|
57
|
+
* void Trace(cppgc::Visitor* visitor) const {
|
58
|
+
* // Dispatch using visitor->Trace(...);
|
59
|
+
* }
|
60
|
+
* };
|
61
|
+
*
|
62
|
+
* // Example using non-final base class.
|
63
|
+
* class NonFinalBase : public GarbageCollected<NonFinalBase> {
|
64
|
+
* public:
|
65
|
+
* virtual void Trace(cppgc::Visitor*) const {}
|
66
|
+
* };
|
67
|
+
*
|
68
|
+
* class FinalChild final : public NonFinalBase {
|
69
|
+
* public:
|
70
|
+
* void Trace(cppgc::Visitor* visitor) const final {
|
71
|
+
* // Dispatch using visitor->Trace(...);
|
72
|
+
* NonFinalBase::Trace(visitor);
|
73
|
+
* }
|
74
|
+
* };
|
75
|
+
* \endcode
|
76
|
+
*/
|
77
|
+
template <typename>
|
78
|
+
class GarbageCollected : public internal::GarbageCollectedBase {
|
79
|
+
public:
|
80
|
+
using IsGarbageCollectedTypeMarker = void;
|
81
|
+
|
82
|
+
protected:
|
83
|
+
GarbageCollected() = default;
|
84
|
+
};
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Base class for managed mixin objects. Such objects cannot be constructed
|
88
|
+
* directly but must be mixed into the inheritance hierarchy of a
|
89
|
+
* GarbageCollected object.
|
90
|
+
*
|
91
|
+
* Types inheriting from GarbageCollectedMixin must override a virtual method
|
92
|
+
* of signature `void Trace(cppgc::Visitor*) const` that dispatchs all managed
|
93
|
+
* pointers to the visitor and delegates to base classes.
|
94
|
+
*
|
95
|
+
* \code
|
96
|
+
* class Mixin : public GarbageCollectedMixin {
|
97
|
+
* public:
|
98
|
+
* void Trace(cppgc::Visitor* visitor) const override {
|
99
|
+
* // Dispatch using visitor->Trace(...);
|
100
|
+
* }
|
101
|
+
* };
|
102
|
+
* \endcode
|
103
|
+
*/
|
104
|
+
class GarbageCollectedMixin : public internal::GarbageCollectedBase {
|
105
|
+
public:
|
106
|
+
using IsGarbageCollectedMixinTypeMarker = void;
|
107
|
+
|
108
|
+
// Sentinel used to mark not-fully-constructed mixins.
|
109
|
+
static constexpr void* kNotFullyConstructedObject = nullptr;
|
110
|
+
|
111
|
+
// Provide default implementation that indicate that the vtable is not yet
|
112
|
+
// set up properly. This is used to to get GCInfo objects for mixins so that
|
113
|
+
// these objects can be processed later on.
|
114
|
+
virtual TraceDescriptor GetTraceDescriptor() const {
|
115
|
+
return {kNotFullyConstructedObject, nullptr};
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* This Trace method must be overriden by objects inheriting from
|
120
|
+
* GarbageCollectedMixin.
|
121
|
+
*/
|
122
|
+
virtual void Trace(cppgc::Visitor*) const {}
|
123
|
+
};
|
124
|
+
|
125
|
+
/**
|
126
|
+
* Macro defines all methods and markers needed for handling mixins. Must be
|
127
|
+
* used on the type that is inheriting from GarbageCollected *and*
|
128
|
+
* GarbageCollectedMixin.
|
129
|
+
*
|
130
|
+
* \code
|
131
|
+
* class Mixin : public GarbageCollectedMixin {
|
132
|
+
* public:
|
133
|
+
* void Trace(cppgc::Visitor* visitor) const override {
|
134
|
+
* // Dispatch using visitor->Trace(...);
|
135
|
+
* }
|
136
|
+
* };
|
137
|
+
*
|
138
|
+
* class Foo : public GarbageCollected<Foo>, public Mixin {
|
139
|
+
* USING_GARBAGE_COLLECTED_MIXIN();
|
140
|
+
* public:
|
141
|
+
* void Trace(cppgc::Visitor* visitor) const override {
|
142
|
+
* // Dispatch using visitor->Trace(...);
|
143
|
+
* Mixin::Trace(visitor);
|
144
|
+
* }
|
145
|
+
* };
|
146
|
+
* \endcode
|
147
|
+
*/
|
148
|
+
#define USING_GARBAGE_COLLECTED_MIXIN() \
|
149
|
+
public: \
|
150
|
+
/* Marker is used by clang to check for proper usages of the macro. */ \
|
151
|
+
typedef int HasUsingGarbageCollectedMixinMacro; \
|
152
|
+
\
|
153
|
+
TraceDescriptor GetTraceDescriptor() const override { \
|
154
|
+
static_assert( \
|
155
|
+
internal::IsSubclassOfTemplate< \
|
156
|
+
std::remove_const_t<std::remove_pointer_t<decltype(this)>>, \
|
157
|
+
cppgc::GarbageCollected>::value, \
|
158
|
+
"Only garbage collected objects can have garbage collected mixins"); \
|
159
|
+
return {this, TraceTrait<std::remove_const_t< \
|
160
|
+
std::remove_pointer_t<decltype(this)>>>::Trace}; \
|
161
|
+
} \
|
162
|
+
\
|
163
|
+
private: \
|
164
|
+
friend class internal::__thisIsHereToForceASemicolonAfterThisMacro
|
165
|
+
|
166
|
+
/**
|
167
|
+
* Merge two or more Mixins into one.
|
168
|
+
*
|
169
|
+
* \code
|
170
|
+
* class A : public GarbageCollectedMixin {};
|
171
|
+
* class B : public GarbageCollectedMixin {};
|
172
|
+
* class C : public A, public B {
|
173
|
+
* MERGE_GARBAGE_COLLECTED_MIXINS();
|
174
|
+
* public:
|
175
|
+
* };
|
176
|
+
* \endcode
|
177
|
+
*/
|
178
|
+
#define MERGE_GARBAGE_COLLECTED_MIXINS() \
|
179
|
+
public: \
|
180
|
+
/* When using multiple mixins the methods become */ \
|
181
|
+
/* ambigous. Providing additional implementations */ \
|
182
|
+
/* disambiguate them again. */ \
|
183
|
+
TraceDescriptor GetTraceDescriptor() const override { \
|
184
|
+
return {kNotFullyConstructedObject, nullptr}; \
|
185
|
+
} \
|
186
|
+
\
|
187
|
+
private: \
|
188
|
+
friend class internal::__thisIsHereToForceASemicolonAfterThisMacro
|
189
|
+
|
190
|
+
} // namespace cppgc
|
191
|
+
|
192
|
+
#endif // INCLUDE_CPPGC_GARBAGE_COLLECTED_H_
|