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

Side by Side Diff: components/storage_monitor/storage_monitor_linux.cc

Issue 759903002: Upgrade the windows specific version of LaunchProcess to avoid raw handles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix chrome build Created 6 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // StorageMonitorLinux implementation. 5 // StorageMonitorLinux implementation.
6 6
7 #include "components/storage_monitor/storage_monitor_linux.h" 7 #include "components/storage_monitor/storage_monitor_linux.h"
8 8
9 #include <mntent.h> 9 #include <mntent.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 base::LaunchOptions options; 216 base::LaunchOptions options;
217 base::ProcessHandle handle; 217 base::ProcessHandle handle;
218 if (!base::LaunchProcess(command, options, &handle)) 218 if (!base::LaunchProcess(command, options, &handle))
219 return StorageMonitor::EJECT_FAILURE; 219 return StorageMonitor::EJECT_FAILURE;
220 220
221 int exit_code = -1; 221 int exit_code = -1;
222 if (!base::WaitForExitCodeWithTimeout(handle, &exit_code, 222 if (!base::WaitForExitCodeWithTimeout(handle, &exit_code,
223 base::TimeDelta::FromMilliseconds(3000))) { 223 base::TimeDelta::FromMilliseconds(3000))) {
224 base::KillProcess(handle, -1, false); 224 base::KillProcess(handle, -1, false);
225 base::EnsureProcessTerminated(handle); 225 base::EnsureProcessTerminated(base::Process(handle));
226 return StorageMonitor::EJECT_FAILURE; 226 return StorageMonitor::EJECT_FAILURE;
227 } 227 }
228 228
229 // TODO(gbillock): Make sure this is found in documentation 229 // TODO(gbillock): Make sure this is found in documentation
230 // somewhere. Experimentally it seems to hold that exit code 230 // somewhere. Experimentally it seems to hold that exit code
231 // 1 means device is in use. 231 // 1 means device is in use.
232 if (exit_code == 1) 232 if (exit_code == 1)
233 return StorageMonitor::EJECT_IN_USE; 233 return StorageMonitor::EJECT_IN_USE;
234 if (exit_code != 0) 234 if (exit_code != 0)
235 return StorageMonitor::EJECT_FAILURE; 235 return StorageMonitor::EJECT_FAILURE;
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 mount_priority_map_[mount_device][mount_point] = removable; 500 mount_priority_map_[mount_device][mount_point] = removable;
501 receiver()->ProcessAttach(*storage_info); 501 receiver()->ProcessAttach(*storage_info);
502 } 502 }
503 503
504 StorageMonitor* StorageMonitor::CreateInternal() { 504 StorageMonitor* StorageMonitor::CreateInternal() {
505 const base::FilePath kDefaultMtabPath("/etc/mtab"); 505 const base::FilePath kDefaultMtabPath("/etc/mtab");
506 return new StorageMonitorLinux(kDefaultMtabPath); 506 return new StorageMonitorLinux(kDefaultMtabPath);
507 } 507 }
508 508
509 } // namespace storage_monitor 509 } // namespace storage_monitor
OLDNEW
« no previous file with comments | « cloud_print/virtual_driver/win/install/setup.cc ('k') | content/browser/child_process_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698