Index: chrome/browser/mac/relauncher.cc |
diff --git a/chrome/browser/mac/relauncher.cc b/chrome/browser/mac/relauncher.cc |
index 5d8357fc5dcbe428d13a75b38044b7c7ae14b256..5d32bc563c96bbe67b19ccc79f5e9b9763de7e38 100644 |
--- a/chrome/browser/mac/relauncher.cc |
+++ b/chrome/browser/mac/relauncher.cc |
@@ -19,6 +19,7 @@ |
#include "base/basictypes.h" |
#include "base/file_util.h" |
+#include "base/files/scoped_file.h" |
#include "base/logging.h" |
#include "base/mac/mac_logging.h" |
#include "base/mac/mac_util.h" |
@@ -132,8 +133,8 @@ bool RelaunchAppWithHelper(const std::string& helper, |
// write side of the pipe. In that process, the read side will be closed by |
// base::LaunchApp because it won't be present in fd_map, and the write side |
// will be remapped to kRelauncherSyncFD by fd_map. |
- file_util::ScopedFD pipe_read_fd(&pipe_fds[0]); |
- file_util::ScopedFD pipe_write_fd(&pipe_fds[1]); |
+ base::ScopedFD pipe_read_fd(&pipe_fds[0]); |
+ base::ScopedFD pipe_write_fd(&pipe_fds[1]); |
// Make sure kRelauncherSyncFD is a safe value. base::LaunchProcess will |
// preserve these three FDs in forked processes, so kRelauncherSyncFD should |
@@ -185,9 +186,7 @@ namespace { |
// situations, it can be assumed that something went wrong with the parent |
// process and the best recovery approach is to attempt relaunch anyway. |
void RelauncherSynchronizeWithParent() { |
- // file_util::ScopedFD needs something non-const to operate on. |
- int relauncher_sync_fd = kRelauncherSyncFD; |
- file_util::ScopedFD relauncher_sync_fd_closer(&relauncher_sync_fd); |
+ base::ScopedFD relauncher_sync_fd_closer(kRelauncherSyncFD); |
int parent_pid = getppid(); |
@@ -201,16 +200,15 @@ void RelauncherSynchronizeWithParent() { |
} |
// Set up a kqueue to monitor the parent process for exit. |
- int kq = kqueue(); |
- if (kq < 0) { |
+ base::ScopedFD kq(kqueue()); |
+ if (!kq) { |
PLOG(ERROR) << "kqueue"; |
return; |
} |
- file_util::ScopedFD kq_closer(&kq); |
struct kevent change = { 0 }; |
EV_SET(&change, parent_pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL); |
- if (kevent(kq, &change, 1, NULL, 0, NULL) == -1) { |
+ if (kevent(kq.get(), &change, 1, NULL, 0, NULL) == -1) { |
PLOG(ERROR) << "kevent (add)"; |
return; |
} |
@@ -225,7 +223,7 @@ void RelauncherSynchronizeWithParent() { |
// write above to complete. The parent process is now free to exit. Wait for |
// that to happen. |
struct kevent event; |
- int events = kevent(kq, NULL, 0, &event, 1, NULL); |
+ int events = kevent(kq.get(), NULL, 0, &event, 1, NULL); |
if (events != 1) { |
if (events < 0) { |
PLOG(ERROR) << "kevent (monitor)"; |