App cycle

Introduce an `Application` class, which has a well-defined lifecycle and lets other objects participate in that lifecycle. This will make things like initializing the workspace, and other Future based tasks, easier. They can run in the application's `starting` lifecycle, before the application is fully initialized. The application essentially moves from the starting to started state, processes user requests, and then moves to the closing state, and finally to the closed state.

So things like restoring open tabs or opening the workspace can happen in the starting state, and persisting the list of open tabs or the workspace state can happen in the closing or closed state.

We can also delay some actions until the application is fully constructed. The spark_test.dart file now uses this; it waits until the app is initialized before running the tests. Before it had just used a fixed delay.

@keertip @gaurave @ussuri