ScreenCaptureListenerWrapper - hold weak ref
This change should reduce the amount of time taken by Java's garbage collection to free hardware buffers. Without this change, cleaning up hardware buffers via GC required: * A GC cycle to collect ScreenCaptureListener * NativeAllocationRegistry to clean up ScreenCaptureListenerWrapper (this can be tens of seconds) * A second GC cycle to collect the consumer ScreenCaptureListenerWrapper referenced and the hardware buffer the consumer referenced With this change, ScreenCaptureListenerWrapper no longer holds a global reference to the consumer allowing GC to clean up unreferenced consumers immediately. The change also includes a small refactor of the interface used to create synchronous ScreenCaptureListeners. Bug: 283813337 Test: presumbits Change-Id: I318d73d6cbf2210db5e4386ab57e4ce3a3629166
Loading
Please register or sign in to comment