The entry->num_keys check should keep it alive even with zero refcount, to preserve the data. I did it this way to remove spurious empty origins, in case there's a lot of navigation going on, and then there would be a lot of entries left behind until the thread shuts down for no reason.
So it only gets removed when:
* No storage objects hold a ref to it, and * There is no data stored for that origin.
Since an empty data for an origin is the same as it not having an entry at all, so we can safely remove it (as long as no objects hold a ref to it).