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

Side by Side Diff: chrome/browser/first_run/upgrade_util_win.cc

Issue 1410333006: Enough hacks to make wstring printfs unneeded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 #include "chrome/browser/first_run/upgrade_util.h" 5 #include "chrome/browser/first_run/upgrade_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <psapi.h> 8 #include <psapi.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 10
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // On Windows 7 we use delegate_execute for re-launching chrome into Windows 172 // On Windows 7 we use delegate_execute for re-launching chrome into Windows
173 // ASH. 173 // ASH.
174 // 174 //
175 // Pass this Chrome's Start Menu shortcut path to the relauncher so it can re- 175 // Pass this Chrome's Start Menu shortcut path to the relauncher so it can re-
176 // activate chrome via ShellExecute which will wait until we exit. Since 176 // activate chrome via ShellExecute which will wait until we exit. Since
177 // ShellExecute does not support handle passing to the child process we create 177 // ShellExecute does not support handle passing to the child process we create
178 // a uniquely named mutex that we aquire and never release. So when we exit, 178 // a uniquely named mutex that we aquire and never release. So when we exit,
179 // Windows marks our mutex as abandoned and the wait is satisfied. The format 179 // Windows marks our mutex as abandoned and the wait is satisfied. The format
180 // of the named mutex is important. See DelegateExecuteOperation for more 180 // of the named mutex is important. See DelegateExecuteOperation for more
181 // details. 181 // details.
182 base::string16 mutex_name = 182 base::string16 mutex_name = L"";
183 base::StringPrintf(L"chrome.relaunch.%d", ::GetCurrentProcessId()); 183 //base::StringPrintf(L"chrome.relaunch.%d", ::GetCurrentProcessId());
184 HANDLE mutex = ::CreateMutexW(NULL, TRUE, mutex_name.c_str()); 184 HANDLE mutex = ::CreateMutexW(NULL, TRUE, mutex_name.c_str());
185 // The |mutex| handle needs to be leaked. See comment above. 185 // The |mutex| handle needs to be leaked. See comment above.
186 if (!mutex) { 186 if (!mutex) {
187 NOTREACHED(); 187 NOTREACHED();
188 return false; 188 return false;
189 } 189 }
190 if (::GetLastError() == ERROR_ALREADY_EXISTS) { 190 if (::GetLastError() == ERROR_ALREADY_EXISTS) {
191 NOTREACHED() << "Relaunch mutex already exists"; 191 NOTREACHED() << "Relaunch mutex already exists";
192 return false; 192 return false;
193 } 193 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 return false; 310 return false;
311 // At this point the chrome.exe has been swapped with the new one. 311 // At this point the chrome.exe has been swapped with the new one.
312 if (!RelaunchChromeBrowser(command_line)) { 312 if (!RelaunchChromeBrowser(command_line)) {
313 // The re-launch fails. Feel free to panic now. 313 // The re-launch fails. Feel free to panic now.
314 NOTREACHED(); 314 NOTREACHED();
315 } 315 }
316 return true; 316 return true;
317 } 317 }
318 318
319 } // namespace upgrade_util 319 } // namespace upgrade_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698