Skip to content

Commit 7b2ffc4

Browse files
author
david
committed
feat: script_value.h compiled successful
1 parent 827fa72 commit 7b2ffc4

File tree

8 files changed

+30
-23
lines changed

8 files changed

+30
-23
lines changed

bridge/bindings/v8/base/memory/scoped_refptr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ class TRIVIAL_ABI scoped_refptr {
344344
// RAW_PTR_EXCLUSION: scoped_refptr<> has its own UaF prevention mechanism.
345345
// Given how widespread it is, we it'll likely a perf regression for no
346346
// additional security benefit.
347-
RAW_PTR_EXCLUSION T* ptr_ = nullptr;
347+
T* ptr_ = nullptr;
348348

349349
private:
350350
template <typename U>

bridge/bindings/v8/gin/public/context_holder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class GIN_EXPORT ContextHolder {
4444
void SetContext(v8::Local<v8::Context> context);
4545

4646
private:
47-
raw_ptr<v8::Isolate> isolate_;
47+
v8::Isolate *isolate_;
4848
v8::UniquePersistent<v8::Context> context_;
4949
std::unique_ptr<PerContextData> data_;
5050
};

bridge/bindings/v8/platform/heap/member.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "bindings/v8/platform/heap/persistent.h"
1212
#include "bindings/v8/platform/wtf/hash_traits.h"
1313
#include "bindings/v8/platform/heap/write_barrier.h"
14+
#include "foundation/macros.h"
1415

1516
namespace webf {
1617

@@ -37,19 +38,19 @@ constexpr auto kMemberDeletedValue = cppgc::kSentinelPointer;
3738

3839
template <typename T>
3940
struct ThreadingTrait<Member<T>> {
40-
STATIC_ONLY(ThreadingTrait);
41+
WEBF_STATIC_ONLY(ThreadingTrait);
4142
static constexpr ThreadAffinity kAffinity = ThreadingTrait<T>::kAffinity;
4243
};
4344

4445
template <typename T>
4546
struct ThreadingTrait<WeakMember<T>> {
46-
STATIC_ONLY(ThreadingTrait);
47+
WEBF_STATIC_ONLY(ThreadingTrait);
4748
static constexpr ThreadAffinity kAffinity = ThreadingTrait<T>::kAffinity;
4849
};
4950

5051
template <typename T>
5152
struct ThreadingTrait<UntracedMember<T>> {
52-
STATIC_ONLY(ThreadingTrait);
53+
WEBF_STATIC_ONLY(ThreadingTrait);
5354
static constexpr ThreadAffinity kAffinity = ThreadingTrait<T>::kAffinity;
5455
};
5556

@@ -74,7 +75,7 @@ static_assert(kBlinkMemberGCHasDebugChecks ||
7475

7576
template <typename T>
7677
struct IsTraceable<Member<T>> {
77-
STATIC_ONLY(IsTraceable);
78+
WEBF_STATIC_ONLY(IsTraceable);
7879
static const bool value = true;
7980
};
8081

@@ -83,7 +84,7 @@ struct IsWeak<WeakMember<T>> : std::true_type {};
8384

8485
template <typename T>
8586
struct IsTraceable<WeakMember<T>> {
86-
STATIC_ONLY(IsTraceable);
87+
WEBF_STATIC_ONLY(IsTraceable);
8788
static const bool value = true;
8889
};
8990

@@ -92,7 +93,7 @@ struct IsTraceable<WeakMember<T>> {
9293
// directly with any of those types.
9394
template <typename T>
9495
class ValuePeeker final {
95-
DISALLOW_NEW();
96+
WEBF_DISALLOW_NEW();
9697

9798
public:
9899
// NOLINTNEXTLINE
@@ -131,7 +132,7 @@ class ValuePeeker final {
131132
// Default hash for hash tables with Member<>-derived elements.
132133
template <typename T, typename MemberType>
133134
struct BaseMemberHashTraits : SimpleClassHashTraits<MemberType> {
134-
STATIC_ONLY(BaseMemberHashTraits);
135+
WEBF_STATIC_ONLY(BaseMemberHashTraits);
135136

136137
// Heap hash containers allow to operate with raw pointers, e.g.
137138
// HeapHashSet<Member<GCed>> set;
@@ -198,22 +199,22 @@ struct HashTraits<webf::UntracedMember<T>> : UntracedMemberHashTraits<T> {};
198199

199200
template <typename T>
200201
class MemberConstructTraits {
201-
STATIC_ONLY(MemberConstructTraits);
202+
WEBF_STATIC_ONLY(MemberConstructTraits);
202203

203204
public:
204205
template <typename... Args>
205206
static T* Construct(void* location, Args&&... args) {
206207
// `Construct()` creates a new Member which must not be visible to the
207208
// concurrent marker yet, similar to regular ctors in Member.
208-
return new (NotNullTag::kNotNull, location) T(std::forward<Args>(args)...);
209+
return new (base::NotNullTag::kNotNull, location) T(std::forward<Args>(args)...);
209210
}
210211

211212
template <typename... Args>
212213
static T* ConstructAndNotifyElement(void* location, Args&&... args) {
213214
// `ConstructAndNotifyElement()` updates an existing Member which might
214215
// also be concurrently traced while we update it. The regular ctors
215216
// for Member don't use an atomic write which can lead to data races.
216-
T* object = new (NotNullTag::kNotNull, location)
217+
T* object = new (base::NotNullTag::kNotNull, location)
217218
T(std::forward<Args>(args)..., typename T::AtomicInitializerTag());
218219
NotifyNewElement(object);
219220
return object;

bridge/bindings/v8/platform/heap/persistent.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "bindings/v8/platform/heap/heap_buildflags.h"
1414
#include "bindings/v8/platform/wtf/vector_traits.h"
1515
#include "bindings/v8/platform/wtf/hash_traits.h"
16+
#include "foundation/macros.h"
1617

1718
// Required to optimize away locations for builds that do not need them to avoid
1819
// binary size blowup.
@@ -75,7 +76,7 @@ namespace webf {
7576

7677
template <typename T>
7778
struct PersistentVectorTraitsBase : VectorTraitsBase<T> {
78-
STATIC_ONLY(PersistentVectorTraitsBase);
79+
WEBF_STATIC_ONLY(PersistentVectorTraitsBase);
7980
static const bool kCanInitializeWithMemset = true;
8081
};
8182

bridge/bindings/v8/platform/heap/self_keep_alive.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace webf {
4040
// implementation of the object.
4141
template <typename Self>
4242
class SelfKeepAlive final {
43-
DISALLOW_NEW();
43+
WEBF_DISALLOW_NEW();
4444

4545
public:
4646
explicit SelfKeepAlive(

bridge/bindings/v8/platform/heap/write_barrier.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
#include <v8/cppgc/member.h>
1313
#include <v8/cppgc/heap-consistency.h>
1414
#include "bindings/v8/platform/wtf/type_traits.h"
15+
#include "foundation/macros.h"
1516

1617
namespace webf {
1718

1819
class WriteBarrier final {
19-
STATIC_ONLY(WriteBarrier);
20+
WEBF_STATIC_ONLY(WriteBarrier);
2021

2122
using HeapConsistency = cppgc::subtle::HeapConsistency;
2223

bridge/bindings/v8/platform/wtf/hash_traits.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#include "bindings/v8/platform/wtf/type_traits.h"
1919
#include "bindings/v8/platform/wtf/hash_functions.h"
2020
#include "bindings/v8/platform/wtf/hash_table_deleted_value_type.h"
21+
#include "foundation/macros.h"
22+
#include "bindings/v8/base/memory/stack_allocated.h"
23+
#include "bindings/v8/base/memory/scoped_refptr.h"
2124

2225
namespace webf {
2326

@@ -62,7 +65,7 @@ namespace internal {
6265

6366
template <typename T>
6467
struct GenericHashTraitsBase {
65-
STATIC_ONLY(GenericHashTraitsBase);
68+
WEBF_STATIC_ONLY(GenericHashTraitsBase);
6669

6770
using TraitType = T;
6871

@@ -275,7 +278,7 @@ struct GenericHashTraits<scoped_refptr<P>>
275278
static bool Equal(const scoped_refptr<P>& a, P* b) { return a == b; }
276279

277280
class RefPtrValuePeeker {
278-
DISALLOW_NEW();
281+
WEBF_DISALLOW_NEW();
279282

280283
public:
281284
ALWAYS_INLINE RefPtrValuePeeker(P* p) : ptr_(p) {}
@@ -346,7 +349,7 @@ struct GenericHashTraits<std::unique_ptr<T>>
346349
static void ConstructDeletedValue(std::unique_ptr<T>& slot) {
347350
// Dirty trick: implant an invalid pointer to unique_ptr. Destructor isn't
348351
// called for deleted buckets, so this is okay.
349-
new (NotNullTag::kNotNull, &slot)
352+
new (base::NotNullTag::kNotNull, &slot)
350353
std::unique_ptr<T>(reinterpret_cast<T*>(1u));
351354
}
352355
static bool IsDeletedValue(const std::unique_ptr<T>& value) {
@@ -385,7 +388,7 @@ struct SimpleClassHashTraits : GenericHashTraits<T> {
385388
static constexpr bool value = false;
386389
};
387390
static void ConstructDeletedValue(T& slot) {
388-
new (NotNullTag::kNotNull, &slot) T(kHashTableDeletedValue);
391+
new (base::NotNullTag::kNotNull, &slot) T(kHashTableDeletedValue);
389392
}
390393
static bool IsDeletedValue(const T& value) {
391394
return value.IsHashTableDeletedValue();
@@ -422,7 +425,7 @@ struct HashTraitsDeletedValueHelper {
422425
return value == Traits::DeletedValue();
423426
}
424427
static void ConstructDeletedValue(typename Traits::TraitType& slot) {
425-
new (NotNullTag::kNotNull, &slot)
428+
new (base::NotNullTag::kNotNull, &slot)
426429
typename Traits::TraitType(Traits::DeletedValue());
427430
}
428431
};

bridge/bindings/v8/script_value.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,19 @@
1313
#include "dictionary_base.h"
1414
#include "foundation/macros.h"
1515
#include "foundation/native_string.h"
16-
//#include "platform/script_state.h"
16+
#include "platform/script_state.h"
1717
#include "union_base.h"
1818
//#include "bindings/v8/platform/wtf/vector_traits.h"
1919
//#include "script_wrappable.h"
2020
#include "foundation/macros.h"
21+
#include "bindings/v8/trace_wrapper_v8_reference.h"
2122

2223
namespace webf {
2324
namespace bindings {
2425
class DictionaryBase;
2526
class UnionBase;
2627
} // namespace bindings
27-
//class ScriptState;
28+
class ScriptState;
2829

2930
// ScriptValue is used when an idl specifies the type as 'any'. ScriptValue
3031
// stores the v8 value using WorldSafeV8Reference.
@@ -139,7 +140,7 @@ class ScriptValue final {
139140
// Returns v8Value() if a given ScriptState is the same as the
140141
// ScriptState which is associated with this ScriptValue. Otherwise
141142
// this "clones" the v8 value and returns it.
142-
// v8::Local<v8::Value> V8ValueFor(ScriptState*) const;
143+
v8::Local<v8::Value> V8ValueFor(ScriptState*) const;
143144

144145
bool ToString(AtomicString&) const;
145146

0 commit comments

Comments
 (0)