Browsers are single threaded. If it was the case that your onModuleLoad was actually taking a long time, then the browser wouldn't be doing anything else. If that's the case, then try breaking up your onModuleLoad into several parts & then do:
enum StartupTask {
TASK1:
TASK2:
TASK3:
}
DeferredCommand.addCommand(new IncrementalCommand() {
StartupTask current = StartupTask.TASK1;
public boolean execute() {
switch (current) {
case TASK1:
// do my initialization
current = TASK2;
break;
case TASK2:
// continue intialization
current = TASK3:
case TASK3:
// finish initialization
current = null;
}
return current != null;
}
});
That's one way to do it. Or you could add a bunch of Command instances instead of using incremental command. Any number of ways to do this. Are you sure though that your onModuleLoad takes a long time?
Try instrumenting it first:
public void onModuleLoad()
{
long start = System.currentTimeMillis();
// rest of code
long elapsed = System.currentTimeMillis() - start;
Window.alert("Initialization took " + elapsed + " milliseconds");