Make *Repository#get(int userId) lock-free
This reworks how IME-related per-user data can be queried in a thread-safe manner. Basically the idea is to make query operations lock-free by making sure that the underlying SparseArray is immutable. While we still need a lock for data mutation, simple read access no longer requires any lock at the cost of putting the sparse array into a volatile field, which has gotten pretty cheap on both ARM and remain so on X86 at least compared to synchronized blocks. There must be no observable behavior change beyond the performance characteristics. Bug: 353307830 Fix: 352594784 Test: atest FrameworksInputMethodSystemServerTests:ImmutableSparseArrayTest Flag: EXEMPT refactor Change-Id: Id0783e57c7e8ff70f16f3c3d486f5a5e64bbe7db
Loading
Please register or sign in to comment