Ensure pendingTransactions are applied if the VRI is torn down
When callers invoke the applyTransactionOnDraw, the code previously set up an RT frame callback and only merged the transaction once a draw started. However, if VRI is being torn down before a traversal starts, the callback will never be invoked and the transaction will be left in memory until GC. The cleanest way is to immediately apply the transaction when the VRI is getting torn down to avoid leaving a stale transaction with reference to SCs in it. This required a bit of cleanup to ensure the UI thread still had access to the SurfaceControl until a traversal was called. The new behavior merges all incoming transactions from applyTransactionOnDraw into a single Transaction. Then in the traversal path, it will either piggy-back on the frame callback from sync transaction or create a new one. The Transaction and flag are cleared in the traversal path since if draw has been invoked, we are guaranteed the callback even if VRI dies. This is because HardwareRenderer is not destroyed until everything in the queue completes. Test: presubmit Bug: 248162583 Change-Id: I4d28b917545f530a068b237bf95de431afd749cb
Loading
Please register or sign in to comment