[BrowserMainLoop] Do not give embedders the responsibility to run the loop

Refactor BrowserMainParts so that BrowserMainLoop owns the loop and
only gives embedders the opportunity to configure it before it runs it.

This is intended to be a no-op logic wise but will be key in a follow-up
change where the loop will be run in multiple steps (until "first idle"
and then forever with a new BrowserMainParts::OnFirstIdle() phase in
between):
https://chromium-review.googlesource.com/c/chromium/src/+/2678899

It was previously strange to have all phases managed by BrowserMainLoop
(BrowserMainParts is only for Pre/Post); *except* for actually running
the loop.

The key changes are in browser_main_loop.cc and in browser_main_parts.h
where this CL introduces WillRunMainMessageLoop() as a replacement for
an overridable MainMessageLoopRun(). Everything else is a side-effect of
that change (intended to be a no-op).

WillRunMainMessageLoop() was necessary instead of augmenting
PreMainMessageLoopRun() because the latter is part of
CreateStartupTasks() and unintuitively runs in a separate phase of
startup which is not guaranteed to be immediately before
MainMessageLoopRun()...

PreMainMessageLoopRun() was modified slightly to return the |error_code|
like many of its sibling methods already did (this was previously an
out-param on MainMessageLoopRun() but no overrides modified the value
after PreMainMessageLoopRun()).

Also took advantage of this CL to further document each phase's role.

Bug: 1175074
Change-Id: I44f84781340fe15efdeac73c7ac35367b1c216f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
Reviewed-by: Reilly Grant <[email protected]>
Reviewed-by: Fabrice de Gans-Riberi <[email protected]>
Reviewed-by: Bo <[email protected]>
Reviewed-by: Sean Topping <[email protected]>
Reviewed-by: Andrey Kosyakov <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Commit-Queue: Gabriel Charette <[email protected]>
Cr-Commit-Position: refs/heads/master@{#863314}
diff --git a/content/shell/browser/shell_browser_main_parts.h b/content/shell/browser/shell_browser_main_parts.h
index 65259192..d39242b 100644
--- a/content/shell/browser/shell_browser_main_parts.h
+++ b/content/shell/browser/shell_browser_main_parts.h
@@ -40,9 +40,9 @@
   void PreMainMessageLoopStart() override;
   void PostMainMessageLoopStart() override;
   void ToolkitInitialized() override;
-  void PreMainMessageLoopRun() override;
-  bool MainMessageLoopRun(int* result_code) override;
-  void PreDefaultMainMessageLoopRun(base::OnceClosure quit_closure) override;
+  int PreMainMessageLoopRun() override;
+  void WillRunMainMessageLoop(
+      std::unique_ptr<base::RunLoop>& run_loop) override;
   void PostMainMessageLoopRun() override;
   void PostDestroyThreads() override;