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

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: rebase on master 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 2b03b2d0bcfaa496f5a5ec3284ff36ef34009d84..d85d82efc33a8209c2225a9ce940b3c2778d9535 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,21 +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)
-
#if defined(OS_WIN)
// Used in specific cases to let us know that there is an existing instance
// of Chrome running with this profile. In general, you should not use this
@@ -110,13 +85,6 @@ class ProcessSingleton : public base::NonThreadSafe {
}
#endif // defined(OS_WIN)
- // 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();
@@ -148,6 +116,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 processes 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.
+ 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