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

Side by Side Diff: chrome_frame/update_launcher.cc

Issue 10991052: Miscellaneous tiny cleanups done while converting files to use ScopedCOMInitializer, pulled out sep… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
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_frame/update_launcher.h" 5 #include "chrome_frame/update_launcher.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <Shellapi.h> 8 #include <Shellapi.h>
9 9
10 #include "google_update/google_update_idl.h" 10 #include "google_update/google_update_idl.h"
11 11
12 namespace { 12 namespace {
13 13
14 const wchar_t kChromeFrameGuid[] = L"{8BA986DA-5100-405E-AA35-86F34A02ACBF}"; 14 const wchar_t kChromeFrameGuid[] = L"{8BA986DA-5100-405E-AA35-86F34A02ACBF}";
15 15
16 const DWORD kLaunchFailureExitCode = 0xFF; 16 const DWORD kLaunchFailureExitCode = 0xFF;
17 17
18 const wchar_t kUpdateCommandFlag[] = L"--update-cmd"; 18 const wchar_t kUpdateCommandFlag[] = L"--update-cmd";
19 19
20 // Waits indefinitely for the provided process to exit. Returns the process's 20 // Waits indefinitely for the provided process to exit. Returns the process's
21 // exit code, or kLaunchFailureExitCode if an error occurs in the waiting. 21 // exit code, or kLaunchFailureExitCode if an error occurs in the waiting.
22 DWORD WaitForProcessExitCode(HANDLE handle) { 22 DWORD WaitForProcessExitCode(HANDLE handle) {
23 DWORD exit_code = 0; 23 DWORD exit_code = 0;
24 24 return ((::WaitForSingleObject(handle, INFINITE) == WAIT_OBJECT_0) &&
25 DWORD wait_result = ::WaitForSingleObject(handle, INFINITE); 25 ::GetExitCodeProcess(handle, &exit_code)) ?
26 26 exit_code : kLaunchFailureExitCode;
27 if (wait_result == WAIT_OBJECT_0 && ::GetExitCodeProcess(handle, &exit_code))
28 return exit_code;
29
30 return kLaunchFailureExitCode;
31 } 27 }
32 28
33 } // namespace 29 } // namespace
34 30
35 namespace update_launcher { 31 namespace update_launcher {
36 32
37 std::wstring GetUpdateCommandFromArguments(const wchar_t* command_line) { 33 std::wstring GetUpdateCommandFromArguments(const wchar_t* command_line) {
38 std::wstring command; 34 std::wstring command;
39 35
40 if (command_line != NULL) { 36 if (command_line != NULL) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (ipl) 81 if (ipl)
86 ipl->Release(); 82 ipl->Release();
87 83
88 ::CoUninitialize(); 84 ::CoUninitialize();
89 } 85 }
90 86
91 return exit_code; 87 return exit_code;
92 } 88 }
93 89
94 } // namespace process_launcher 90 } // namespace process_launcher
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698