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 "media/midi/midi_manager_alsa.h" | 5 #include "media/midi/midi_manager_alsa.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <poll.h> | 8 #include <poll.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 if (err != 0) { | 262 if (err != 0) { |
263 VLOG(1) << "udev_monitor_enable_receiving fails: " | 263 VLOG(1) << "udev_monitor_enable_receiving fails: " |
264 << base::safe_strerror(-err); | 264 << base::safe_strerror(-err); |
265 return CompleteInitialization(Result::INITIALIZATION_ERROR); | 265 return CompleteInitialization(Result::INITIALIZATION_ERROR); |
266 } | 266 } |
267 | 267 |
268 // Success! Now, initialize members from the temporaries. Do not | 268 // Success! Now, initialize members from the temporaries. Do not |
269 // initialize these earlier, since they need to be destroyed by the | 269 // initialize these earlier, since they need to be destroyed by the |
270 // thread that calls Finalize(), not the destructor thread (and we | 270 // thread that calls Finalize(), not the destructor thread (and we |
271 // check this in the destructor). | 271 // check this in the destructor). |
272 in_client_.reset(in_client.release()); | 272 in_client_ = std::move(in_client); |
273 out_client_.reset(out_client.release()); | 273 out_client_ = std::move(out_client); |
274 decoder_.reset(decoder.release()); | 274 decoder_ = std::move(decoder); |
275 udev_.reset(udev.release()); | 275 udev_ = std::move(udev); |
276 udev_monitor_.reset(udev_monitor.release()); | 276 udev_monitor_ = std::move(udev_monitor); |
277 | 277 |
278 // Generate hotplug events for existing ports. | 278 // Generate hotplug events for existing ports. |
279 // TODO(agoode): Check the return value for failure. | 279 // TODO(agoode): Check the return value for failure. |
280 EnumerateAlsaPorts(); | 280 EnumerateAlsaPorts(); |
281 | 281 |
282 // Generate hotplug events for existing udev devices. This must be done | 282 // Generate hotplug events for existing udev devices. This must be done |
283 // after udev_monitor_enable_receiving() is called. See the algorithm | 283 // after udev_monitor_enable_receiving() is called. See the algorithm |
284 // at http://www.signal11.us/oss/udev/. | 284 // at http://www.signal11.us/oss/udev/. |
285 EnumerateUdevCards(); | 285 EnumerateUdevCards(); |
286 | 286 |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 source_map_[AddrToInt(client_id, port_id)] = port_index; | 1398 source_map_[AddrToInt(client_id, port_id)] = port_index; |
1399 return true; | 1399 return true; |
1400 } | 1400 } |
1401 | 1401 |
1402 MidiManager* MidiManager::Create() { | 1402 MidiManager* MidiManager::Create() { |
1403 return new MidiManagerAlsa(); | 1403 return new MidiManagerAlsa(); |
1404 } | 1404 } |
1405 | 1405 |
1406 } // namespace midi | 1406 } // namespace midi |
1407 } // namespace media | 1407 } // namespace media |
OLD | NEW |