Skip to content

Commit 8e1d48e

Browse files
authored
Migrate some Dart_WeakPersistentHandle uses to Dart_FinalizableHandle (flutter#20107)
1 parent 8229df8 commit 8e1d48e

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

shell/platform/fuchsia/dart-pkg/zircon/sdk_ext/system.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,7 @@ struct SizedRegion {
423423
size_t size;
424424
};
425425

426-
void System::VmoMapFinalizer(void* isolate_callback_data,
427-
Dart_WeakPersistentHandle handle,
428-
void* peer) {
426+
void System::VmoMapFinalizer(void* isolate_callback_data, void* peer) {
429427
SizedRegion* r = reinterpret_cast<SizedRegion*>(peer);
430428
zx_vmar_unmap(zx_vmar_root_self(), reinterpret_cast<uintptr_t>(r->region),
431429
r->size);
@@ -453,9 +451,9 @@ Dart_Handle System::VmoMap(fml::RefPtr<Handle> vmo) {
453451
FML_DCHECK(!tonic::LogIfError(object));
454452

455453
SizedRegion* r = new SizedRegion(data, size);
456-
Dart_NewWeakPersistentHandle(object, reinterpret_cast<void*>(r),
457-
static_cast<intptr_t>(size) + sizeof(*r),
458-
System::VmoMapFinalizer);
454+
Dart_NewFinalizableHandle(object, reinterpret_cast<void*>(r),
455+
static_cast<intptr_t>(size) + sizeof(*r),
456+
System::VmoMapFinalizer);
459457

460458
return ConstructDartObject(kMapResult, ToDart(ZX_OK), object);
461459
}

shell/platform/fuchsia/dart-pkg/zircon/sdk_ext/system.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ class System : public fml::RefCountedThreadSafe<System>,
6969
fml::RefPtr<Handle> channel);
7070

7171
private:
72-
static void VmoMapFinalizer(void* isolate_callback_data,
73-
Dart_WeakPersistentHandle handle,
74-
void* peer);
72+
static void VmoMapFinalizer(void* isolate_callback_data, void* peer);
7573

7674
static zx::channel CloneChannelFromFileDescriptor(int fd);
7775
};

third_party/tonic/file_loader/file_loader.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,7 @@ Dart_Handle FileLoader::Import(Dart_Handle url) {
195195
}
196196

197197
namespace {
198-
void MallocFinalizer(void* isolate_callback_data,
199-
Dart_WeakPersistentHandle handle,
200-
void* peer) {
198+
void MallocFinalizer(void* isolate_callback_data, void* peer) {
201199
free(peer);
202200
}
203201
} // namespace
@@ -212,7 +210,7 @@ Dart_Handle FileLoader::Kernel(Dart_Handle url) {
212210
}
213211
result =
214212
Dart_NewExternalTypedData(Dart_TypedData_kUint8, buffer, buffer_size);
215-
Dart_NewWeakPersistentHandle(result, buffer, buffer_size, MallocFinalizer);
213+
Dart_NewFinalizableHandle(result, buffer, buffer_size, MallocFinalizer);
216214
return result;
217215
}
218216

0 commit comments

Comments
 (0)