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 #ifndef MEDIA_MIDI_MIDI_MANAGER_ALSA_H_ | 5 #ifndef MEDIA_MIDI_MIDI_MANAGER_ALSA_H_ |
6 #define MEDIA_MIDI_MIDI_MANAGER_ALSA_H_ | 6 #define MEDIA_MIDI_MIDI_MANAGER_ALSA_H_ |
7 | 7 |
8 #include <alsa/asoundlib.h> | 8 #include <alsa/asoundlib.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <map> | 10 #include <map> |
| 11 #include <utility> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
16 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
17 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
18 #include "base/values.h" | 19 #include "base/values.h" |
19 #include "device/udev_linux/scoped_udev.h" | 20 #include "device/udev_linux/scoped_udev.h" |
20 #include "media/midi/midi_export.h" | 21 #include "media/midi/midi_export.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 190 |
190 // Given a port, finds a disconnected port, using heuristic matching. | 191 // Given a port, finds a disconnected port, using heuristic matching. |
191 iterator FindDisconnected(const MidiPort& port); | 192 iterator FindDisconnected(const MidiPort& port); |
192 | 193 |
193 iterator begin() { return ports_.begin(); } | 194 iterator begin() { return ports_.begin(); } |
194 iterator end() { return ports_.end(); } | 195 iterator end() { return ports_.end(); } |
195 | 196 |
196 protected: | 197 protected: |
197 MidiPortStateBase(); | 198 MidiPortStateBase(); |
198 iterator erase(iterator position) { return ports_.erase(position); } | 199 iterator erase(iterator position) { return ports_.erase(position); } |
199 void push_back(scoped_ptr<MidiPort> port) { ports_.push_back(port.Pass()); } | 200 void push_back(scoped_ptr<MidiPort> port) { |
| 201 ports_.push_back(std::move(port)); |
| 202 } |
200 | 203 |
201 private: | 204 private: |
202 std::vector<scoped_ptr<MidiPort>> ports_; | 205 std::vector<scoped_ptr<MidiPort>> ports_; |
203 | 206 |
204 DISALLOW_COPY_AND_ASSIGN(MidiPortStateBase); | 207 DISALLOW_COPY_AND_ASSIGN(MidiPortStateBase); |
205 }; | 208 }; |
206 | 209 |
207 class TemporaryMidiPortState final : public MidiPortStateBase { | 210 class TemporaryMidiPortState final : public MidiPortStateBase { |
208 public: | 211 public: |
209 iterator erase(iterator position) { | 212 iterator erase(iterator position) { |
210 return MidiPortStateBase::erase(position); | 213 return MidiPortStateBase::erase(position); |
211 }; | 214 }; |
212 void push_back(scoped_ptr<MidiPort> port) { | 215 void push_back(scoped_ptr<MidiPort> port) { |
213 MidiPortStateBase::push_back(port.Pass()); | 216 MidiPortStateBase::push_back(std::move(port)); |
214 } | 217 } |
215 }; | 218 }; |
216 | 219 |
217 class MidiPortState final : public MidiPortStateBase { | 220 class MidiPortState final : public MidiPortStateBase { |
218 public: | 221 public: |
219 MidiPortState(); | 222 MidiPortState(); |
220 | 223 |
221 // Inserts a port at the end. Returns web_port_index. | 224 // Inserts a port at the end. Returns web_port_index. |
222 uint32_t push_back(scoped_ptr<MidiPort> port); | 225 uint32_t push_back(scoped_ptr<MidiPort> port); |
223 | 226 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 bool event_thread_shutdown_ = false; // guarded by shutdown_lock_ | 430 bool event_thread_shutdown_ = false; // guarded by shutdown_lock_ |
428 base::Lock shutdown_lock_; // guards event_thread_shutdown_ | 431 base::Lock shutdown_lock_; // guards event_thread_shutdown_ |
429 | 432 |
430 DISALLOW_COPY_AND_ASSIGN(MidiManagerAlsa); | 433 DISALLOW_COPY_AND_ASSIGN(MidiManagerAlsa); |
431 }; | 434 }; |
432 | 435 |
433 } // namespace midi | 436 } // namespace midi |
434 } // namespace media | 437 } // namespace media |
435 | 438 |
436 #endif // MEDIA_MIDI_MIDI_MANAGER_ALSA_H_ | 439 #endif // MEDIA_MIDI_MIDI_MANAGER_ALSA_H_ |
OLD | NEW |