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

Unified Diff: chrome/browser/process_singleton_win.cc

Issue 2271833002: Continue browser startup after killing a hung browser instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/process_singleton_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/process_singleton_win.cc
diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc
index 75918cd646d30acc63b9ec69397b038600f8caa0..442458e086bc0edf3a04ac6040707f7486ff63be 100644
--- a/chrome/browser/process_singleton_win.cc
+++ b/chrome/browser/process_singleton_win.cc
@@ -22,8 +22,6 @@
#include "base/win/registry.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/ui/simple_message_box.h"
#include "chrome/browser/win/chrome_process_finder.h"
@@ -283,16 +281,23 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
ProcessSingleton::NotifyResult
ProcessSingleton::NotifyOtherProcessOrCreate() {
- ProcessSingleton::NotifyResult result = PROCESS_NONE;
- if (!Create()) {
- result = NotifyOtherProcess();
- if (result == PROCESS_NONE)
- result = PROFILE_IN_USE;
- } else {
- g_browser_process->platform_part()->PlatformSpecificCommandLineProcessing(
- *base::CommandLine::ForCurrentProcess());
+ for (int i = 0; i < 2; ++i) {
+ if (Create()) {
grt (UTC plus 2) 2016/08/26 20:24:00 nit: omit braces for single-line conditional and b
+ return PROCESS_NONE; // This is the single browser process.
+ }
+ ProcessSingleton::NotifyResult result = NotifyOtherProcess();
+ if (result == PROCESS_NOTIFIED || result == LOCK_ERROR) {
+ // The single browser process was notified, the user chose not to
+ // terminate a hung browser, or the lock file could not be created.
+ // Nothing more to do.
+ return result;
+ }
+ DCHECK_EQ(PROCESS_NONE, result);
+ // The process could not be notified for some reason, or it was hung and
+ // terminated. Retry once if this is the first time; otherwise, fall through
+ // to report that the process must exit because the profile is in use.
}
- return result;
+ return PROFILE_IN_USE;
}
// Look for a Chrome instance that uses the same profile directory. If there
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/process_singleton_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698