OLD | NEW |
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/browser/mac/relauncher.h" | 5 #include "chrome/browser/mac/relauncher.h" |
6 | 6 |
7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
8 #include <AvailabilityMacros.h> | 8 #include <AvailabilityMacros.h> |
9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 file_util::ScopedFD pipe_write_fd(&pipe_fds[1]); | 144 file_util::ScopedFD pipe_write_fd(&pipe_fds[1]); |
145 | 145 |
146 // Make sure kRelauncherSyncFD is a safe value. base::LaunchProcess will | 146 // Make sure kRelauncherSyncFD is a safe value. base::LaunchProcess will |
147 // preserve these three FDs in forked processes, so kRelauncherSyncFD should | 147 // preserve these three FDs in forked processes, so kRelauncherSyncFD should |
148 // not conflict with them. | 148 // not conflict with them. |
149 COMPILE_ASSERT(kRelauncherSyncFD != STDIN_FILENO && | 149 COMPILE_ASSERT(kRelauncherSyncFD != STDIN_FILENO && |
150 kRelauncherSyncFD != STDOUT_FILENO && | 150 kRelauncherSyncFD != STDOUT_FILENO && |
151 kRelauncherSyncFD != STDERR_FILENO, | 151 kRelauncherSyncFD != STDERR_FILENO, |
152 kRelauncherSyncFD_must_not_conflict_with_stdio_fds); | 152 kRelauncherSyncFD_must_not_conflict_with_stdio_fds); |
153 | 153 |
154 base::file_handle_mapping_vector fd_map; | 154 base::FileHandleMappingVector fd_map; |
155 fd_map.push_back(std::make_pair(*pipe_write_fd, kRelauncherSyncFD)); | 155 fd_map.push_back(std::make_pair(*pipe_write_fd, kRelauncherSyncFD)); |
156 | 156 |
157 base::LaunchOptions options; | 157 base::LaunchOptions options; |
158 options.fds_to_remap = &fd_map; | 158 options.fds_to_remap = &fd_map; |
159 if (!base::LaunchProcess(relaunch_args, options, NULL)) { | 159 if (!base::LaunchProcess(relaunch_args, options, NULL)) { |
160 LOG(ERROR) << "base::LaunchProcess failed"; | 160 LOG(ERROR) << "base::LaunchProcess failed"; |
161 return false; | 161 return false; |
162 } | 162 } |
163 | 163 |
164 // The relauncher process is now starting up, or has started up. The | 164 // The relauncher process is now starting up, or has started up. The |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 if (!dmg_bsd_device_name.empty()) { | 382 if (!dmg_bsd_device_name.empty()) { |
383 EjectAndTrashDiskImage(dmg_bsd_device_name); | 383 EjectAndTrashDiskImage(dmg_bsd_device_name); |
384 } | 384 } |
385 | 385 |
386 return 0; | 386 return 0; |
387 } | 387 } |
388 | 388 |
389 } // namespace internal | 389 } // namespace internal |
390 | 390 |
391 } // namespace mac_relauncher | 391 } // namespace mac_relauncher |
OLD | NEW |