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

Side by Side Diff: base/process/process_win.cc

Issue 1086363003: Handled nullptr argument in WaitForExit() and WaitForExitWithTimeout() methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments incorporated. Created 5 years, 7 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
« no previous file with comments | « base/process/process_posix.cc ('k') | chrome/app/chrome_watcher_client_unittest_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/process/process.h" 5 #include "base/process/process.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) { 147 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) {
148 // Limit timeout to INFINITE. 148 // Limit timeout to INFINITE.
149 DWORD timeout_ms = saturated_cast<DWORD>(timeout.InMilliseconds()); 149 DWORD timeout_ms = saturated_cast<DWORD>(timeout.InMilliseconds());
150 if (::WaitForSingleObject(Handle(), timeout_ms) != WAIT_OBJECT_0) 150 if (::WaitForSingleObject(Handle(), timeout_ms) != WAIT_OBJECT_0)
151 return false; 151 return false;
152 152
153 DWORD temp_code; // Don't clobber out-parameters in case of failure. 153 DWORD temp_code; // Don't clobber out-parameters in case of failure.
154 if (!::GetExitCodeProcess(Handle(), &temp_code)) 154 if (!::GetExitCodeProcess(Handle(), &temp_code))
155 return false; 155 return false;
156 156 if (exit_code)
Lei Zhang 2015/05/27 06:42:49 Can you add a blank line above the if statement?
g.mehndiratt 2015/05/27 07:28:35 On 2015/05/27 06:42:49, Lei Zhang wrote: Acknowle
157 *exit_code = temp_code; 157 *exit_code = temp_code;
158 return true; 158 return true;
159 } 159 }
160 160
161 bool Process::IsProcessBackgrounded() const { 161 bool Process::IsProcessBackgrounded() const {
162 DCHECK(IsValid()); 162 DCHECK(IsValid());
163 DWORD priority = GetPriority(); 163 DWORD priority = GetPriority();
164 if (priority == 0) 164 if (priority == 0)
165 return false; // Failure case. 165 return false; // Failure case.
166 return ((priority == BELOW_NORMAL_PRIORITY_CLASS) || 166 return ((priority == BELOW_NORMAL_PRIORITY_CLASS) ||
167 (priority == IDLE_PRIORITY_CLASS)); 167 (priority == IDLE_PRIORITY_CLASS));
(...skipping 28 matching lines...) Expand all
196 196
197 return (::SetPriorityClass(Handle(), priority) != 0); 197 return (::SetPriorityClass(Handle(), priority) != 0);
198 } 198 }
199 199
200 int Process::GetPriority() const { 200 int Process::GetPriority() const {
201 DCHECK(IsValid()); 201 DCHECK(IsValid());
202 return ::GetPriorityClass(Handle()); 202 return ::GetPriorityClass(Handle());
203 } 203 }
204 204
205 } // namespace base 205 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_posix.cc ('k') | chrome/app/chrome_watcher_client_unittest_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698