Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1936)

Unified Diff: chrome/browser/process_singleton.h

Issue 11415237: Move many ProcessSingleton methods to "protected" visibility as an upcoming refactoring of ProcessS… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/process_singleton.h
diff --git a/chrome/browser/process_singleton.h b/chrome/browser/process_singleton.h
index 504f2ad155f9064293acb0901427367da89f7a39..365c6e220d0737b27704ee1345fbe29b1455d4e7 100644
--- a/chrome/browser/process_singleton.h
+++ b/chrome/browser/process_singleton.h
@@ -67,16 +67,6 @@ class ProcessSingleton : public base::NonThreadSafe {
explicit ProcessSingleton(const FilePath& user_data_dir);
~ProcessSingleton();
- // Notify another process, if available.
- // Returns true if another process was found and notified, false if we
- // should continue with this process.
- // Windows code roughly based on Mozilla.
- //
- // TODO(brettw): this will not handle all cases. If two process start up too
- // close to each other, the Create() might not yet have happened for the
- // first one, so this function won't find it.
- NotifyResult NotifyOtherProcess();
-
// Notify another process, if available. Otherwise sets ourselves as the
// singleton instance and stores the provided callback for notification from
// future processes. Returns PROCESS_NONE if we became the singleton
@@ -84,28 +74,6 @@ class ProcessSingleton : public base::NonThreadSafe {
NotifyResult NotifyOtherProcessOrCreate(
const NotificationCallback& notification_callback);
-#if defined(OS_LINUX) || defined(OS_OPENBSD)
- // Exposed for testing. We use a timeout on Linux, and in tests we want
- // this timeout to be short.
- NotifyResult NotifyOtherProcessWithTimeout(const CommandLine& command_line,
- int timeout_seconds,
- bool kill_unresponsive);
- NotifyResult NotifyOtherProcessWithTimeoutOrCreate(
- const CommandLine& command_line,
- const NotificationCallback& notification_callback,
- int timeout_seconds);
- void OverrideCurrentPidForTesting(base::ProcessId pid);
- void OverrideKillCallbackForTesting(const base::Callback<void(int)>& callback);
- static void DisablePromptForTesting();
-#endif // defined(OS_LINUX) || defined(OS_OPENBSD)
-
- // Sets ourself up as the singleton instance. Returns true on success. If
- // false is returned, we are not the singleton instance and the caller must
- // exit. Otherwise, stores the provided callback for notification from
- // future processes.
- bool Create(
- const NotificationCallback& notification_callback);
-
// Clear any lock state during shutdown.
void Cleanup();
@@ -137,6 +105,44 @@ class ProcessSingleton : public base::NonThreadSafe {
LRESULT WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
#endif
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
+ static void DisablePromptForTesting();
+#endif // defined(OS_LINUX) || defined(OS_OPENBSD)
+
+ protected:
+ // Notify another process, if available.
+ // Returns true if another process was found and notified, false if we
+ // should continue with this process.
+ // Windows code roughly based on Mozilla.
+ //
+ // TODO(brettw): this will not handle all cases. If two process start up too
robertshield 2012/11/30 21:21:52 nit: processes
gab 2012/11/30 21:35:36 Done.
+ // close to each other, the Create() might not yet have happened for the
+ // first one, so this function won't find it.
+ virtual NotifyResult NotifyOtherProcess();
+
+ // Sets ourself up as the singleton instance. Returns true on success. If
+ // false is returned, we are not the singleton instance and the caller must
+ // exit. Otherwise, stores the provided callback for notification from
+ // future processes.
+ virtual bool Create(
+ const NotificationCallback& notification_callback);
+
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
+ // Exposed for testing. We use a timeout on Linux, and in tests we want
+ // this timeout to be short.
+ virtual NotifyResult NotifyOtherProcessWithTimeout(
+ const CommandLine& command_line,
+ int timeout_seconds,
+ bool kill_unresponsive);
+ virtual NotifyResult NotifyOtherProcessWithTimeoutOrCreate(
+ const CommandLine& command_line,
+ const NotificationCallback& notification_callback,
+ int timeout_seconds);
+ virtual void OverrideCurrentPidForTesting(base::ProcessId pid);
+ virtual void OverrideKillCallbackForTesting(
+ const base::Callback<void(int)>& callback);
+#endif // defined(OS_LINUX) || defined(OS_OPENBSD)
+
private:
typedef std::pair<CommandLine::StringVector, FilePath> DelayedStartupMessage;
« no previous file with comments | « no previous file | chrome/browser/process_singleton_linux.cc » ('j') | chrome/browser/process_singleton_linux_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698