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

Unified Diff: chrome/browser/browser_main.cc

Issue 10234: * Create unique event in global namespace (Closed)
Patch Set: Created 12 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_main.cc
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 7cf76df9a014e879675bba4ee5c1c1e52233419b..cbfd34a0f75b756365c1a972d8d8de5b8ca3f349 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -219,13 +219,10 @@ bool CreateUniqueChromeEvent() {
PathService::Get(base::FILE_EXE, &exe);
std::replace(exe.begin(), exe.end(), '\\', '!');
std::transform(exe.begin(), exe.end(), exe.begin(), tolower);
+ exe = L"Global\\" + exe;
HANDLE handle = CreateEvent(NULL, TRUE, TRUE, exe.c_str());
- bool already_running = false;
- if (GetLastError() == ERROR_ALREADY_EXISTS) {
- already_running = true;
- CloseHandle(handle);
- }
- return already_running;
+ int error = GetLastError();
+ return (error == ERROR_ALREADY_EXISTS || error == ERROR_ACCESS_DENIED);
}
// Check if there is any machine level Chrome installed on the current
@@ -438,10 +435,7 @@ int BrowserMain(CommandLine &parsed_command_line, int show_command,
if (message_window.NotifyOtherProcess(show_command))
return ResultCodes::NORMAL_EXIT;
- // Sometimes we end up killing browser process (http://b/1308130) so make
- // sure we recreate unique event to indicate running browser process.
message_window.HuntForZombieChromeProcesses();
- already_running = (already_running && CreateUniqueChromeEvent());
// Do the tasks if chrome has been upgraded while it was last running.
if (!already_running && DoUpgradeTasks(parsed_command_line)) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698