Index: chrome/browser/mac/relauncher.cc |
diff --git a/chrome/browser/mac/relauncher.cc b/chrome/browser/mac/relauncher.cc |
index e659793fe0f45c838f8a6b9483e60b21715c96db..5d8357fc5dcbe428d13a75b38044b7c7ae14b256 100644 |
--- a/chrome/browser/mac/relauncher.cc |
+++ b/chrome/browser/mac/relauncher.cc |
@@ -19,7 +19,6 @@ |
#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" |
@@ -133,8 +132,8 @@ |
// 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. |
- base::ScopedFD pipe_read_fd(pipe_fds[0]); |
- base::ScopedFD pipe_write_fd(pipe_fds[1]); |
+ file_util::ScopedFD pipe_read_fd(&pipe_fds[0]); |
+ file_util::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 |
@@ -145,7 +144,7 @@ |
kRelauncherSyncFD_must_not_conflict_with_stdio_fds); |
base::FileHandleMappingVector fd_map; |
- fd_map.push_back(std::make_pair(pipe_write_fd.get(), kRelauncherSyncFD)); |
+ fd_map.push_back(std::make_pair(*pipe_write_fd, kRelauncherSyncFD)); |
base::LaunchOptions options; |
options.fds_to_remap = &fd_map; |
@@ -161,7 +160,7 @@ |
// Synchronize with the relauncher process. |
char read_char; |
- int read_result = HANDLE_EINTR(read(pipe_read_fd.get(), &read_char, 1)); |
+ int read_result = HANDLE_EINTR(read(*pipe_read_fd, &read_char, 1)); |
if (read_result != 1) { |
if (read_result < 0) { |
PLOG(ERROR) << "read"; |
@@ -186,7 +185,9 @@ |
// 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() { |
- base::ScopedFD relauncher_sync_fd(kRelauncherSyncFD); |
+ // 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); |
int parent_pid = getppid(); |
@@ -200,21 +201,22 @@ |
} |
// Set up a kqueue to monitor the parent process for exit. |
- base::ScopedFD kq(kqueue()); |
- if (!kq.is_valid()) { |
+ int kq = kqueue(); |
+ if (kq < 0) { |
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.get(), &change, 1, NULL, 0, NULL) == -1) { |
+ if (kevent(kq, &change, 1, NULL, 0, NULL) == -1) { |
PLOG(ERROR) << "kevent (add)"; |
return; |
} |
// Write a '\0' character to the pipe. |
- if (HANDLE_EINTR(write(relauncher_sync_fd.get(), "", 1)) != 1) { |
+ if (HANDLE_EINTR(write(relauncher_sync_fd, "", 1)) != 1) { |
PLOG(ERROR) << "write"; |
return; |
} |
@@ -223,7 +225,7 @@ |
// write above to complete. The parent process is now free to exit. Wait for |
// that to happen. |
struct kevent event; |
- int events = kevent(kq.get(), NULL, 0, &event, 1, NULL); |
+ int events = kevent(kq, NULL, 0, &event, 1, NULL); |
if (events != 1) { |
if (events < 0) { |
PLOG(ERROR) << "kevent (monitor)"; |