Change blockify/unblockifyObject to accept serializer as argument.

This makes them easier to test, since they now have no dependency on SparkEnv.