vulkan: Ensure VkDecoderGlobalState is locked for delayed removal

This solves a deadlock when multiple VkInstances are removed at the
same time.

on_vkDestroyDevice first processes delayed removal and then destroys
the device with GlobalState mLock locked. However this could cause a
deadlock case like this:

on_vkDestroyDevice (1):
 - processDelayedRemoves
   - acquires BoxedHandleManager lock
   - callback()
     - acquires GlobalState mLock

on_vkDestroyDevice (2):
 - processDelayedRemoves finished
 - acquires mLock
 - destroyDeviceLocked()
   - acquires BoxedHandleManager lock

In our VkDecoder there are a lot of nested mLock->BoxedHandleManager
lock usages -- so we could always require GlobalState mLock to be
locked when we call processDelayedRemoves. This ensures the correct
locking and unlocking order and thus will prevent deadlocks.

TEST: chromium cc_unittests and viz_unittests doesn't regress

Change-Id: I473820cc781b77547a731ffd3dd36d0a99ef79ef
1 file changed
tree: 5eab953701e69813bb8a64791afcc2ecf83d0e43
  1. registry/