Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: media/midi/midi_manager_usb.h

Issue 2893953002: Revert of Remove ScopedVector from all other codes in media/ (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/midi/midi_manager_unittest.cc ('k') | media/midi/midi_manager_usb.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 base::TimeTicks time) override; 57 base::TimeTicks time) override;
58 void OnDeviceAttached(std::unique_ptr<UsbMidiDevice> device) override; 58 void OnDeviceAttached(std::unique_ptr<UsbMidiDevice> device) override;
59 void OnDeviceDetached(size_t index) override; 59 void OnDeviceDetached(size_t index) override;
60 60
61 // UsbMidiInputStream::Delegate implementation. 61 // UsbMidiInputStream::Delegate implementation.
62 void OnReceivedData(size_t jack_index, 62 void OnReceivedData(size_t jack_index,
63 const uint8_t* data, 63 const uint8_t* data,
64 size_t size, 64 size_t size,
65 base::TimeTicks time) override; 65 base::TimeTicks time) override;
66 66
67 const std::vector<std::unique_ptr<UsbMidiOutputStream>>& output_streams() 67 const ScopedVector<UsbMidiOutputStream>& output_streams() const {
68 const {
69 return output_streams_; 68 return output_streams_;
70 } 69 }
71 const UsbMidiInputStream* input_stream() const { return input_stream_.get(); } 70 const UsbMidiInputStream* input_stream() const { return input_stream_.get(); }
72 71
73 // Initializes this object. 72 // Initializes this object.
74 // When the initialization finishes, |callback| will be called with the 73 // When the initialization finishes, |callback| will be called with the
75 // result. 74 // result.
76 // When this factory is destroyed during the operation, the operation 75 // When this factory is destroyed during the operation, the operation
77 // will be canceled silently (i.e. |callback| will not be called). 76 // will be canceled silently (i.e. |callback| will not be called).
78 // The function is public just for unit tests. Do not call this function 77 // The function is public just for unit tests. Do not call this function
79 // outside code for testing. 78 // outside code for testing.
80 void Initialize(base::Callback<void(mojom::Result result)> callback); 79 void Initialize(base::Callback<void(mojom::Result result)> callback);
81 80
82 private: 81 private:
83 void OnEnumerateDevicesDone(bool result, UsbMidiDevice::Devices* devices); 82 void OnEnumerateDevicesDone(bool result, UsbMidiDevice::Devices* devices);
84 bool AddPorts(UsbMidiDevice* device, int device_id); 83 bool AddPorts(UsbMidiDevice* device, int device_id);
85 84
86 std::unique_ptr<UsbMidiDevice::Factory> device_factory_; 85 std::unique_ptr<UsbMidiDevice::Factory> device_factory_;
87 std::vector<std::unique_ptr<UsbMidiDevice>> devices_; 86 ScopedVector<UsbMidiDevice> devices_;
88 std::vector<std::unique_ptr<UsbMidiOutputStream>> output_streams_; 87 ScopedVector<UsbMidiOutputStream> output_streams_;
89 std::unique_ptr<UsbMidiInputStream> input_stream_; 88 std::unique_ptr<UsbMidiInputStream> input_stream_;
90 89
91 base::Callback<void(mojom::Result result)> initialize_callback_; 90 base::Callback<void(mojom::Result result)> initialize_callback_;
92 91
93 // A map from <endpoint_number, cable_number> to the index of input jacks. 92 // A map from <endpoint_number, cable_number> to the index of input jacks.
94 base::hash_map<std::pair<int, int>, size_t> input_jack_dictionary_; 93 base::hash_map<std::pair<int, int>, size_t> input_jack_dictionary_;
95 94
96 // Lock to ensure the MidiScheduler is being destructed only once in 95 // Lock to ensure the MidiScheduler is being destructed only once in
97 // Finalize() on Chrome_IOThread. 96 // Finalize() on Chrome_IOThread.
98 base::Lock scheduler_lock_; 97 base::Lock scheduler_lock_;
99 std::unique_ptr<MidiScheduler> scheduler_; 98 std::unique_ptr<MidiScheduler> scheduler_;
100 99
101 DISALLOW_COPY_AND_ASSIGN(MidiManagerUsb); 100 DISALLOW_COPY_AND_ASSIGN(MidiManagerUsb);
102 }; 101 };
103 102
104 } // namespace midi 103 } // namespace midi
105 104
106 #endif // MEDIA_MIDI_MIDI_MANAGER_USB_H_ 105 #endif // MEDIA_MIDI_MIDI_MANAGER_USB_H_
OLDNEW
« no previous file with comments | « media/midi/midi_manager_unittest.cc ('k') | media/midi/midi_manager_usb.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698