forked from firka/flutter
Revert "Remove usage of Dart_AllocateWithNativeFields from tonic (#16588)" (flutter/engine#16684)
This reverts commit d32975f387.
This commit is contained in:
@@ -1890,12 +1890,6 @@ class Path extends NativeFieldWrapperClass2 {
|
||||
/// Create a new empty [Path] object.
|
||||
@pragma('vm:entry-point')
|
||||
Path() { _constructor(); }
|
||||
|
||||
// Workaround for tonic, which expects classes with native fields to have a
|
||||
// private constructor.
|
||||
@pragma('vm:entry-point')
|
||||
Path._() { _constructor(); }
|
||||
|
||||
void _constructor() native 'Path_constructor';
|
||||
|
||||
/// Creates a copy of another [Path].
|
||||
|
||||
@@ -22,17 +22,13 @@ Dart_Handle DartWrappable::CreateDartWrapper(DartState* dart_state) {
|
||||
Dart_PersistentHandle type = dart_state->class_library().GetClass(info);
|
||||
TONIC_DCHECK(!LogIfError(type));
|
||||
|
||||
Dart_Handle private_constructor_name = Dart_NewStringFromCString("_");
|
||||
Dart_Handle wrapper = Dart_New(type, private_constructor_name, 0, nullptr);
|
||||
intptr_t native_fields[kNumberOfNativeFields];
|
||||
native_fields[kPeerIndex] = reinterpret_cast<intptr_t>(this);
|
||||
native_fields[kWrapperInfoIndex] = reinterpret_cast<intptr_t>(&info);
|
||||
Dart_Handle wrapper =
|
||||
Dart_AllocateWithNativeFields(type, kNumberOfNativeFields, native_fields);
|
||||
TONIC_DCHECK(!LogIfError(wrapper));
|
||||
|
||||
Dart_Handle res = Dart_SetNativeInstanceField(
|
||||
wrapper, kPeerIndex, reinterpret_cast<intptr_t>(this));
|
||||
TONIC_DCHECK(!LogIfError(res));
|
||||
res = Dart_SetNativeInstanceField(wrapper, kWrapperInfoIndex,
|
||||
reinterpret_cast<intptr_t>(&info));
|
||||
TONIC_DCHECK(!LogIfError(res));
|
||||
|
||||
this->RetainDartWrappableReference(); // Balanced in FinalizeDartWrapper.
|
||||
dart_wrapper_ = Dart_NewWeakPersistentHandle(
|
||||
wrapper, this, GetAllocationSize(), &FinalizeDartWrapper);
|
||||
|
||||
Reference in New Issue
Block a user