The block of code this patch adds starting in line 381 could be made into a separated member function for XWalkBrowserMainParts, and then you call it.

The PreMainMessageLoopRun() function is too big and cluttered, this would be a step towards making it more readable. The idea is that PreMainMessageLoopRun() should call more highlevel functions with descriptive names and clear goals, and each function takes care of the details of achieving that goal.