| OLD | NEW |
| 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 #include "chrome/utility/image_writer/disk_unmounter_mac.h" | 5 #include "chrome/utility/image_writer/disk_unmounter_mac.h" |
| 6 | 6 |
| 7 #include <sys/socket.h> | 7 #include <sys/socket.h> |
| 8 #include <IOKit/storage/IOStorageProtocolCharacteristics.h> | 8 #include <IOKit/storage/IOStorageProtocolCharacteristics.h> |
| 9 | 9 |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 DiskUnmounterMac::~DiskUnmounterMac() { | 25 DiskUnmounterMac::~DiskUnmounterMac() { |
| 26 if (disk_) | 26 if (disk_) |
| 27 DADiskUnclaim(disk_); | 27 DADiskUnclaim(disk_); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void DiskUnmounterMac::Unmount(const std::string& device_path, | 30 void DiskUnmounterMac::Unmount(const std::string& device_path, |
| 31 const base::Closure& success_continuation, | 31 const base::Closure& success_continuation, |
| 32 const base::Closure& failure_continuation) { | 32 const base::Closure& failure_continuation) { |
| 33 // Should only be used once. | 33 // Should only be used once. |
| 34 DCHECK(!original_thread_); | 34 DCHECK(!original_thread_.get()); |
| 35 original_thread_ = base::MessageLoopProxy::current(); | 35 original_thread_ = base::MessageLoopProxy::current(); |
| 36 success_continuation_ = success_continuation; | 36 success_continuation_ = success_continuation; |
| 37 failure_continuation_ = failure_continuation; | 37 failure_continuation_ = failure_continuation; |
| 38 | 38 |
| 39 cf_thread_.message_loop()->PostTask( | 39 cf_thread_.message_loop()->PostTask( |
| 40 FROM_HERE, | 40 FROM_HERE, |
| 41 base::Bind(&DiskUnmounterMac::UnmountOnWorker, | 41 base::Bind(&DiskUnmounterMac::UnmountOnWorker, |
| 42 base::Unretained(this), | 42 base::Unretained(this), |
| 43 device_path)); | 43 device_path)); |
| 44 } | 44 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 this, | 116 this, |
| 117 DiskClaimed, | 117 DiskClaimed, |
| 118 this); | 118 this); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void DiskUnmounterMac::Error() { | 121 void DiskUnmounterMac::Error() { |
| 122 original_thread_->PostTask(FROM_HERE, failure_continuation_); | 122 original_thread_->PostTask(FROM_HERE, failure_continuation_); |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace image_writer | 125 } // namespace image_writer |
| OLD | NEW |