diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-08 01:37:06 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-08 01:37:06 +0000 |
commit | bab654788c013d4cdf3900fc43927e159362b5ed (patch) | |
tree | 61ad1f994b2130b8fbc67555d08319c14fa5793b | |
parent | e8e0f3691a410d6de40bfff021b0da33425f36cb (diff) | |
download | chromium_src-bab654788c013d4cdf3900fc43927e159362b5ed.zip chromium_src-bab654788c013d4cdf3900fc43927e159362b5ed.tar.gz chromium_src-bab654788c013d4cdf3900fc43927e159362b5ed.tar.bz2 |
* Create unique event in global namespace
so that we can detect Chrome instances across user sessions.
Review URL: http://codereview.chromium.org/10234
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5057 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser_main.cc | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 7cf76df9..cbfd34a 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)) { |