Chromium Code Reviews| Index: device/serial/serial_device_enumerator_mac.cc |
| diff --git a/device/serial/serial_device_enumerator_mac.cc b/device/serial/serial_device_enumerator_mac.cc |
| index 17192759b634cfbeb6783b7752e885e4a650b5ef..94d59f707c4aa559b66bda06db03b40961e50be2 100644 |
| --- a/device/serial/serial_device_enumerator_mac.cc |
| +++ b/device/serial/serial_device_enumerator_mac.cc |
| @@ -7,7 +7,6 @@ |
| #include "base/file_util.h" |
| #include "base/files/file_enumerator.h" |
| #include "base/files/file_path.h" |
| -#include "base/memory/linked_ptr.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/strings/string_util.h" |
| @@ -23,7 +22,7 @@ SerialDeviceEnumeratorMac::SerialDeviceEnumeratorMac() {} |
| SerialDeviceEnumeratorMac::~SerialDeviceEnumeratorMac() {} |
| // TODO(rockot): Use IOKit to enumerate serial interfaces. |
| -void SerialDeviceEnumeratorMac::GetDevices(SerialDeviceInfoList* devices) { |
| +mojo::Array<SerialDeviceInfoPtr> SerialDeviceEnumeratorMac::GetDevices() { |
| const base::FilePath kDevRoot("/dev"); |
| const int kFilesAndSymLinks = |
| base::FileEnumerator::FILES | base::FileEnumerator::SHOW_SYM_LINKS; |
| @@ -37,7 +36,7 @@ void SerialDeviceEnumeratorMac::GetDevices(SerialDeviceInfoList* devices) { |
| valid_patterns.insert("/dev/tty.*"); |
| valid_patterns.insert("/dev/cu.*"); |
| - devices->clear(); |
| + mojo::Array<SerialDeviceInfoPtr> devices; |
| base::FileEnumerator enumerator(kDevRoot, false, kFilesAndSymLinks); |
| do { |
| const base::FilePath next_device_path(enumerator.Next()); |
| @@ -48,13 +47,14 @@ void SerialDeviceEnumeratorMac::GetDevices(SerialDeviceInfoList* devices) { |
| std::set<std::string>::const_iterator i = valid_patterns.begin(); |
| for (; i != valid_patterns.end(); ++i) { |
| if (MatchPattern(next_device, *i)) { |
| - linked_ptr<SerialDeviceInfo> info(new SerialDeviceInfo); |
| - info->path = next_device; |
| - devices->push_back(info); |
| + SerialDeviceInfoPtr info(SerialDeviceInfo::New()); |
| + info->path = mojo::String::From(next_device); |
|
darin (slow to review)
2014/06/16 16:59:19
use of mojo::String::From here is unnecessary. you
Sam McNally
2014/06/17 07:07:20
Done.
|
| + devices.push_back(info.Pass()); |
| break; |
| } |
| } |
| } while (true); |
| + return devices.Pass(); |
| } |
| } // namespace device |