mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Migrate some Dart_WeakPersistentHandle uses to Dart_FinalizableHandle (#20107)
This commit is contained in:
parent
8229df8722
commit
8e1d48eece
@ -423,9 +423,7 @@ struct SizedRegion {
|
||||
size_t size;
|
||||
};
|
||||
|
||||
void System::VmoMapFinalizer(void* isolate_callback_data,
|
||||
Dart_WeakPersistentHandle handle,
|
||||
void* peer) {
|
||||
void System::VmoMapFinalizer(void* isolate_callback_data, void* peer) {
|
||||
SizedRegion* r = reinterpret_cast<SizedRegion*>(peer);
|
||||
zx_vmar_unmap(zx_vmar_root_self(), reinterpret_cast<uintptr_t>(r->region),
|
||||
r->size);
|
||||
@ -453,9 +451,9 @@ Dart_Handle System::VmoMap(fml::RefPtr<Handle> vmo) {
|
||||
FML_DCHECK(!tonic::LogIfError(object));
|
||||
|
||||
SizedRegion* r = new SizedRegion(data, size);
|
||||
Dart_NewWeakPersistentHandle(object, reinterpret_cast<void*>(r),
|
||||
static_cast<intptr_t>(size) + sizeof(*r),
|
||||
System::VmoMapFinalizer);
|
||||
Dart_NewFinalizableHandle(object, reinterpret_cast<void*>(r),
|
||||
static_cast<intptr_t>(size) + sizeof(*r),
|
||||
System::VmoMapFinalizer);
|
||||
|
||||
return ConstructDartObject(kMapResult, ToDart(ZX_OK), object);
|
||||
}
|
||||
|
||||
@ -69,9 +69,7 @@ class System : public fml::RefCountedThreadSafe<System>,
|
||||
fml::RefPtr<Handle> channel);
|
||||
|
||||
private:
|
||||
static void VmoMapFinalizer(void* isolate_callback_data,
|
||||
Dart_WeakPersistentHandle handle,
|
||||
void* peer);
|
||||
static void VmoMapFinalizer(void* isolate_callback_data, void* peer);
|
||||
|
||||
static zx::channel CloneChannelFromFileDescriptor(int fd);
|
||||
};
|
||||
|
||||
6
third_party/tonic/file_loader/file_loader.cc
vendored
6
third_party/tonic/file_loader/file_loader.cc
vendored
@ -195,9 +195,7 @@ Dart_Handle FileLoader::Import(Dart_Handle url) {
|
||||
}
|
||||
|
||||
namespace {
|
||||
void MallocFinalizer(void* isolate_callback_data,
|
||||
Dart_WeakPersistentHandle handle,
|
||||
void* peer) {
|
||||
void MallocFinalizer(void* isolate_callback_data, void* peer) {
|
||||
free(peer);
|
||||
}
|
||||
} // namespace
|
||||
@ -212,7 +210,7 @@ Dart_Handle FileLoader::Kernel(Dart_Handle url) {
|
||||
}
|
||||
result =
|
||||
Dart_NewExternalTypedData(Dart_TypedData_kUint8, buffer, buffer_size);
|
||||
Dart_NewWeakPersistentHandle(result, buffer, buffer_size, MallocFinalizer);
|
||||
Dart_NewFinalizableHandle(result, buffer, buffer_size, MallocFinalizer);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user