Split singleton creation and notifications watching
This CL is decoupling the process singleton Create(...) and
start Watching(...). The current CL should be a no-op.
* The Create(...) phase will take the locks and ensures the browser
is unique. After that phase, the notifications are not yet
processed.
* The call to StartWatching(...) will ensure there are some code
pumping the notifications from other processes.
The purpose of this split is to make it easier to lift the process singleton into earlier startup phases. The Create(...) function can
be called before the creation of the IO-Thread while the StartWatching(...) must happen after.
Bug: 1340599
Change-Id: I11b95c38137736bfaf5edbae86379e124e2990a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3781028
Reviewed-by: Scott Violet <[email protected]>
Commit-Queue: Etienne Bergeron <[email protected]>
Reviewed-by: Gabriel Charette <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1030549}
diff --git a/chrome/browser/chrome_process_singleton.h b/chrome/browser/chrome_process_singleton.h
index 1cb2ce2..14f047d 100644
--- a/chrome/browser/chrome_process_singleton.h
+++ b/chrome/browser/chrome_process_singleton.h
@@ -42,6 +42,12 @@
// PROFILE_IN_USE if it happens to use the same profile directory.
ProcessSingleton::NotifyResult NotifyOtherProcessOrCreate();
+ // Start watching for notifications from other processes. After this call,
+ // the notifications sent by other process can be processed. This call
+ // requires the browser threads (UI / IO) to be created. Requests that occur
+ // before calling StartWatching(...) will be blocked and may timeout.
+ void StartWatching();
+
// Clear any lock state during shutdown.
void Cleanup();