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

Unified Diff: base/process/kill_posix.cc

Issue 191673003: Implement ScopedFD in terms of ScopedGeneric. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: base/process/kill_posix.cc
diff --git a/base/process/kill_posix.cc b/base/process/kill_posix.cc
index 99d70d9ab5590418566be37a047a6aa67ee58247..8187c38926cd2ce0551861f0e6a09d24db84f8b6 100644
--- a/base/process/kill_posix.cc
+++ b/base/process/kill_posix.cc
@@ -10,6 +10,7 @@
#include <unistd.h>
#include "base/file_util.h"
+#include "base/files/scoped_file.h"
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
#include "base/process/process_iterator.h"
@@ -273,16 +274,15 @@ static bool WaitForSingleNonChildProcess(ProcessHandle handle,
DCHECK_GT(handle, 0);
DCHECK(wait.InMilliseconds() == base::kNoTimeout || wait > base::TimeDelta());
- int kq = kqueue();
- if (kq == -1) {
+ ScopedFD kq(kqueue());
+ if (!kq.is_valid()) {
DPLOG(ERROR) << "kqueue";
return false;
}
- file_util::ScopedFD kq_closer(&kq);
struct kevent change = {0};
EV_SET(&change, handle, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
- int result = HANDLE_EINTR(kevent(kq, &change, 1, NULL, 0, NULL));
+ int result = HANDLE_EINTR(kevent(kq.get(), &change, 1, NULL, 0, NULL));
if (result == -1) {
if (errno == ESRCH) {
// If the process wasn't found, it must be dead.
@@ -316,7 +316,7 @@ static bool WaitForSingleNonChildProcess(ProcessHandle handle,
remaining_timespec_ptr = &remaining_timespec;
}
- result = kevent(kq, NULL, 0, &event, 1, remaining_timespec_ptr);
+ result = kevent(kq.get(), NULL, 0, &event, 1, remaining_timespec_ptr);
if (result == -1 && errno == EINTR) {
if (!wait_forever) {

Powered by Google App Engine
This is Rietveld 408576698