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

Side by Side Diff: chrome/installer/util/google_update_util.cc

Issue 71013004: Base: Remove Receive() from ScopedHandle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add constructor Created 7 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 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/installer/util/google_update_util.h" 5 #include "chrome/installer/util/google_update_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // |timeout| to be base::TimeDelta::FromMilliseconds(INFINITE). 90 // |timeout| to be base::TimeDelta::FromMilliseconds(INFINITE).
91 // Returns true if this executes successfully. 91 // Returns true if this executes successfully.
92 // Returns false if command execution fails to execute, or times out. 92 // Returns false if command execution fails to execute, or times out.
93 bool LaunchProcessAndWaitWithTimeout(const string16& cmd_string, 93 bool LaunchProcessAndWaitWithTimeout(const string16& cmd_string,
94 base::TimeDelta timeout) { 94 base::TimeDelta timeout) {
95 bool success = false; 95 bool success = false;
96 base::win::ScopedHandle process; 96 base::win::ScopedHandle process;
97 int exit_code = 0; 97 int exit_code = 0;
98 LOG(INFO) << "Launching: " << cmd_string; 98 LOG(INFO) << "Launching: " << cmd_string;
99 if (!base::LaunchProcess(cmd_string, base::LaunchOptions(), 99 if (!base::LaunchProcess(cmd_string, base::LaunchOptions(),
100 process.Receive())) { 100 &process)) {
101 PLOG(ERROR) << "Failed to launch (" << cmd_string << ")"; 101 PLOG(ERROR) << "Failed to launch (" << cmd_string << ")";
102 } else if (!base::WaitForExitCodeWithTimeout(process, &exit_code, timeout)) { 102 } else if (!base::WaitForExitCodeWithTimeout(process, &exit_code, timeout)) {
103 // The GetExitCodeProcess failed or timed-out. 103 // The GetExitCodeProcess failed or timed-out.
104 LOG(ERROR) <<"Command (" << cmd_string << ") is taking more than " 104 LOG(ERROR) <<"Command (" << cmd_string << ") is taking more than "
105 << timeout.InMilliseconds() << " milliseconds to complete."; 105 << timeout.InMilliseconds() << " milliseconds to complete.";
106 } else if (exit_code != 0) { 106 } else if (exit_code != 0) {
107 LOG(ERROR) << "Command (" << cmd_string << ") exited with code " 107 LOG(ERROR) << "Command (" << cmd_string << ") exited with code "
108 << exit_code; 108 << exit_code;
109 } else { 109 } else {
110 success = true; 110 success = true;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 std::map<std::string, std::string>::const_iterator data_it( 215 std::map<std::string, std::string>::const_iterator data_it(
216 untrusted_data.find(key)); 216 untrusted_data.find(key));
217 if (data_it != untrusted_data.end()) 217 if (data_it != untrusted_data.end())
218 return data_it->second; 218 return data_it->second;
219 } 219 }
220 220
221 return std::string(); 221 return std::string();
222 } 222 }
223 223
224 } // namespace google_update 224 } // namespace google_update
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698