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/process_singleton.h b/chrome/browser/process_singleton.h
index 16bb3aa..7cd82d27 100644
--- a/chrome/browser/process_singleton.h
+++ b/chrome/browser/process_singleton.h
@@ -127,6 +127,9 @@
// another process should call this directly.
bool Create();
+ // Start watching for notifications from other processes.
+ void StartWatching();
+
// Clear any lock state during shutdown.
void Cleanup();
@@ -217,6 +220,7 @@
// Temporary directory to hold the socket.
base::ScopedTempDir socket_dir_;
+ int sock_ = -1;
// Helper class for linux specific messages. LinuxWatcher is ref counted
// because it posts messages between threads.