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

Side by Side Diff: chrome/browser/process_singleton.h

Issue 981223004: Add test for ProcessSingleton hung rendezvous case. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Now tests the user interaction cases. Created 5 years, 9 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_PROCESS_SINGLETON_H_ 5 #ifndef CHROME_BROWSER_PROCESS_SINGLETON_H_
6 #define CHROME_BROWSER_PROCESS_SINGLETON_H_ 6 #define CHROME_BROWSER_PROCESS_SINGLETON_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // this method, only callers for whom failure is preferred to notifying 85 // this method, only callers for whom failure is preferred to notifying
86 // another process should call this directly. 86 // another process should call this directly.
87 bool Create(); 87 bool Create();
88 88
89 // Clear any lock state during shutdown. 89 // Clear any lock state during shutdown.
90 void Cleanup(); 90 void Cleanup();
91 91
92 #if defined(OS_POSIX) && !defined(OS_ANDROID) 92 #if defined(OS_POSIX) && !defined(OS_ANDROID)
93 static void DisablePromptForTesting(); 93 static void DisablePromptForTesting();
94 #endif 94 #endif
95 #if defined(OS_WIN)
96 typedef base::Callback<bool()> DisplayShouldKillMessageBoxCallback;
97 void OverrideKillMessageBoxCallbackForTesting(
98 const DisplayShouldKillMessageBoxCallback& display_dialog_callback);
99 #endif
95 100
96 protected: 101 protected:
97 // Notify another process, if available. 102 // Notify another process, if available.
98 // Returns true if another process was found and notified, false if we should 103 // Returns true if another process was found and notified, false if we should
99 // continue with the current process. 104 // continue with the current process.
100 // On Windows, Create() has to be called before this. 105 // On Windows, Create() has to be called before this.
101 NotifyResult NotifyOtherProcess(); 106 NotifyResult NotifyOtherProcess();
102 107
103 #if defined(OS_POSIX) && !defined(OS_ANDROID) 108 #if defined(OS_POSIX) && !defined(OS_ANDROID)
104 // Exposed for testing. We use a timeout on Linux, and in tests we want 109 // Exposed for testing. We use a timeout on Linux, and in tests we want
(...skipping 16 matching lines...) Expand all
121 NotificationCallback notification_callback_; // Handler for notifications. 126 NotificationCallback notification_callback_; // Handler for notifications.
122 127
123 #if defined(OS_WIN) 128 #if defined(OS_WIN)
124 bool EscapeVirtualization(const base::FilePath& user_data_dir); 129 bool EscapeVirtualization(const base::FilePath& user_data_dir);
125 130
126 HWND remote_window_; // The HWND_MESSAGE of another browser. 131 HWND remote_window_; // The HWND_MESSAGE of another browser.
127 base::win::MessageWindow window_; // The message-only window. 132 base::win::MessageWindow window_; // The message-only window.
128 bool is_virtualized_; // Stuck inside Microsoft Softricity VM environment. 133 bool is_virtualized_; // Stuck inside Microsoft Softricity VM environment.
129 HANDLE lock_file_; 134 HANDLE lock_file_;
130 base::FilePath user_data_dir_; 135 base::FilePath user_data_dir_;
136 DisplayShouldKillMessageBoxCallback display_should_kill_messagebox_callback_;
131 #elif defined(OS_POSIX) && !defined(OS_ANDROID) 137 #elif defined(OS_POSIX) && !defined(OS_ANDROID)
132 // Return true if the given pid is one of our child processes. 138 // Return true if the given pid is one of our child processes.
133 // Assumes that the current pid is the root of all pids of the current 139 // Assumes that the current pid is the root of all pids of the current
134 // instance. 140 // instance.
135 bool IsSameChromeInstance(pid_t pid); 141 bool IsSameChromeInstance(pid_t pid);
136 142
137 // Extract the process's pid from a symbol link path and if it is on 143 // Extract the process's pid from a symbol link path and if it is on
138 // the same host, kill the process, unlink the lock file and return true. 144 // the same host, kill the process, unlink the lock file and return true.
139 // If the process is part of the same chrome instance, unlink the lock file 145 // If the process is part of the same chrome instance, unlink the lock file
140 // and return true without killing it. 146 // and return true without killing it.
(...skipping 25 matching lines...) Expand all
166 // Helper class for linux specific messages. LinuxWatcher is ref counted 172 // Helper class for linux specific messages. LinuxWatcher is ref counted
167 // because it posts messages between threads. 173 // because it posts messages between threads.
168 class LinuxWatcher; 174 class LinuxWatcher;
169 scoped_refptr<LinuxWatcher> watcher_; 175 scoped_refptr<LinuxWatcher> watcher_;
170 #endif 176 #endif
171 177
172 DISALLOW_COPY_AND_ASSIGN(ProcessSingleton); 178 DISALLOW_COPY_AND_ASSIGN(ProcessSingleton);
173 }; 179 };
174 180
175 #endif // CHROME_BROWSER_PROCESS_SINGLETON_H_ 181 #endif // CHROME_BROWSER_PROCESS_SINGLETON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698