Spend less time with the image cache locked.

The image cache is no longer locked for expensive operations,
such as image loads. While this may cause us to load an image
twice (in rare circumstances), it also lets us preload images
without blocking loads frome the main thread.