Create message response external typed data objects as Uint8Lists (#5101)
PlatformMessageResponseDart will wrap large responses in Dart external typed data objects in order to avoid copying the data into a new buffer. Previously these objects were created with the Dart_TypedData_kByteData type. A weak persistent handle is then associated with the ByteData to provide a finalizer that deletes the raw buffer. However, the Dart VM could call finalizer on the ByteData even if references still existed to the Dart ByteBuffer object backing the ByteData. The ByteBuffer would then be referencing a deleted raw buffer. This PR prevents that scenario by creating a Dart_TypedData_kUint8 object, attaching the finalizer to that object, and then wrapping it in a ByteData.
Showing
想要评论请 注册 或 登录