Skip to content
Commit 20ca02e2 authored by Patrick Williams's avatar Patrick Williams
Browse files

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
parent 0673acc6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment