layers: Overhaul unique_objects

Unique objects now uses a 64-bit counter as the unique handle returned
to the app. It stores an internal mapping of handles to actual object
ptrs that are used for all non-dispatchable objects. This virtually
eliminates the possibility of having a repeat handle as objects
are created and destroyed.

All counter increments and map accesses are protected by a mutex.
2 files changed