summaryrefslogtreecommitdiffstats
path: root/chrome/browser/process_singleton.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/process_singleton.h')
-rw-r--r--chrome/browser/process_singleton.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/chrome/browser/process_singleton.h b/chrome/browser/process_singleton.h
index 0e39417..3ef620a 100644
--- a/chrome/browser/process_singleton.h
+++ b/chrome/browser/process_singleton.h
@@ -14,6 +14,9 @@
#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/gfx/native_widget_types.h"
+#include "base/logging.h"
+#include "base/non_thread_safe.h"
+#include "base/ref_counted.h"
// ProcessSingleton ----------------------------------------------------------
//
@@ -26,7 +29,7 @@
// - the Windows implementation uses an invisible global message window;
// - the Linux implementation uses a Unix domain socket in the user data dir.
-class ProcessSingleton {
+class ProcessSingleton : public NonThreadSafe {
public:
explicit ProcessSingleton(const FilePath& user_data_dir);
~ProcessSingleton();
@@ -40,23 +43,30 @@ class ProcessSingleton {
// first one, so this function won't find it.
bool NotifyOtherProcess();
- // Set ourselves up as the singleton instance.
+ // Sets ourself up as the singleton instance.
void Create();
// Blocks the dispatch of CopyData messages. foreground_window refers
// to the window that should be set to the foreground if a CopyData message
// is received while the ProcessSingleton is locked.
void Lock(gfx::NativeWindow foreground_window) {
+ DCHECK(CalledOnValidThread());
locked_ = true;
foreground_window_ = foreground_window;
}
// Allows the dispatch of CopyData messages.
void Unlock() {
+ DCHECK(CalledOnValidThread());
locked_ = false;
foreground_window_ = NULL;
}
+ bool locked() {
+ DCHECK(CalledOnValidThread());
+ return locked_;
+ }
+
private:
bool locked_;
gfx::NativeWindow foreground_window_;
@@ -87,6 +97,11 @@ class ProcessSingleton {
// Path in file system to the socket.
FilePath socket_path_;
+
+ // Helper class for linux specific messages. LinuxWatcher is ref counted
+ // because it posts messages between threads.
+ class LinuxWatcher;
+ scoped_refptr<LinuxWatcher> watcher_;
#endif
DISALLOW_COPY_AND_ASSIGN(ProcessSingleton);