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_USB_H_ | 5 #ifndef MEDIA_MIDI_MIDI_MANAGER_USB_H_ |
6 #define MEDIA_MIDI_MIDI_MANAGER_USB_H_ | 6 #define MEDIA_MIDI_MIDI_MANAGER_USB_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 const UsbMidiInputStream* input_stream() const { return input_stream_.get(); } | 69 const UsbMidiInputStream* input_stream() const { return input_stream_.get(); } |
70 | 70 |
71 // Initializes this object. | 71 // Initializes this object. |
72 // When the initialization finishes, |callback| will be called with the | 72 // When the initialization finishes, |callback| will be called with the |
73 // result. | 73 // result. |
74 // When this factory is destroyed during the operation, the operation | 74 // When this factory is destroyed during the operation, the operation |
75 // will be canceled silently (i.e. |callback| will not be called). | 75 // will be canceled silently (i.e. |callback| will not be called). |
76 // The function is public just for unit tests. Do not call this function | 76 // The function is public just for unit tests. Do not call this function |
77 // outside code for testing. | 77 // outside code for testing. |
78 void Initialize(base::Callback<void(Result result)> callback); | 78 void Initialize(base::Callback<void(mojom::Result result)> callback); |
79 | 79 |
80 private: | 80 private: |
81 void OnEnumerateDevicesDone(bool result, UsbMidiDevice::Devices* devices); | 81 void OnEnumerateDevicesDone(bool result, UsbMidiDevice::Devices* devices); |
82 bool AddPorts(UsbMidiDevice* device, int device_id); | 82 bool AddPorts(UsbMidiDevice* device, int device_id); |
83 | 83 |
84 std::unique_ptr<UsbMidiDevice::Factory> device_factory_; | 84 std::unique_ptr<UsbMidiDevice::Factory> device_factory_; |
85 ScopedVector<UsbMidiDevice> devices_; | 85 ScopedVector<UsbMidiDevice> devices_; |
86 ScopedVector<UsbMidiOutputStream> output_streams_; | 86 ScopedVector<UsbMidiOutputStream> output_streams_; |
87 std::unique_ptr<UsbMidiInputStream> input_stream_; | 87 std::unique_ptr<UsbMidiInputStream> input_stream_; |
88 | 88 |
89 base::Callback<void(Result result)> initialize_callback_; | 89 base::Callback<void(mojom::Result result)> initialize_callback_; |
90 | 90 |
91 // A map from <endpoint_number, cable_number> to the index of input jacks. | 91 // A map from <endpoint_number, cable_number> to the index of input jacks. |
92 base::hash_map<std::pair<int, int>, size_t> input_jack_dictionary_; | 92 base::hash_map<std::pair<int, int>, size_t> input_jack_dictionary_; |
93 | 93 |
94 // Lock to ensure the MidiScheduler is being destructed only once in | 94 // Lock to ensure the MidiScheduler is being destructed only once in |
95 // Finalize() on Chrome_IOThread. | 95 // Finalize() on Chrome_IOThread. |
96 base::Lock scheduler_lock_; | 96 base::Lock scheduler_lock_; |
97 std::unique_ptr<MidiScheduler> scheduler_; | 97 std::unique_ptr<MidiScheduler> scheduler_; |
98 | 98 |
99 DISALLOW_COPY_AND_ASSIGN(MidiManagerUsb); | 99 DISALLOW_COPY_AND_ASSIGN(MidiManagerUsb); |
100 }; | 100 }; |
101 | 101 |
102 } // namespace midi | 102 } // namespace midi |
103 | 103 |
104 #endif // MEDIA_MIDI_MIDI_MANAGER_USB_H_ | 104 #endif // MEDIA_MIDI_MIDI_MANAGER_USB_H_ |
OLD | NEW |