Refactor the compositing interface to use messages instead of callbacks.

This will enable compositing to be cleaned up drastically and is necessary
for proper integration with the new scheduler.

r? @metajack