OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ANDROID_H_ | 5 #ifndef MEDIA_MIDI_MIDI_MANAGER_ANDROID_H_ |
6 #define MEDIA_MIDI_MIDI_MANAGER_ANDROID_H_ | 6 #define MEDIA_MIDI_MIDI_MANAGER_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
11 | 11 |
12 #include <memory> | 12 #include <memory> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/android/scoped_java_ref.h" | 15 #include "base/android/scoped_java_ref.h" |
16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "media/midi/midi_input_port_android.h" | 20 #include "media/midi/midi_input_port_android.h" |
21 #include "media/midi/midi_manager.h" | 21 #include "media/midi/midi_manager.h" |
22 #include "media/midi/midi_scheduler.h" | 22 #include "media/midi/midi_scheduler.h" |
23 | 23 |
24 namespace midi { | 24 namespace midi { |
25 | 25 |
26 class MidiDeviceAndroid; | 26 class MidiDeviceAndroid; |
27 class MidiOutputPortAndroid; | 27 class MidiOutputPortAndroid; |
| 28 class MidiService; |
28 | 29 |
29 // MidiManagerAndroid is a MidiManager subclass for Android M or newer. For | 30 // MidiManagerAndroid is a MidiManager subclass for Android M or newer. For |
30 // older android OSes, we use MidiManagerUsb. | 31 // older android OSes, we use MidiManagerUsb. |
31 class MidiManagerAndroid final : public MidiManager, | 32 class MidiManagerAndroid final : public MidiManager, |
32 public MidiInputPortAndroid::Delegate { | 33 public MidiInputPortAndroid::Delegate { |
33 public: | 34 public: |
34 MidiManagerAndroid(); | 35 explicit MidiManagerAndroid(MidiService* service); |
35 ~MidiManagerAndroid() override; | 36 ~MidiManagerAndroid() override; |
36 | 37 |
37 // MidiManager implementation. | 38 // MidiManager implementation. |
38 void StartInitialization() override; | 39 void StartInitialization() override; |
39 void Finalize() override; | 40 void Finalize() override; |
40 void DispatchSendMidiData(MidiManagerClient* client, | 41 void DispatchSendMidiData(MidiManagerClient* client, |
41 uint32_t port_index, | 42 uint32_t port_index, |
42 const std::vector<uint8_t>& data, | 43 const std::vector<uint8_t>& data, |
43 double timestamp) override; | 44 double timestamp) override; |
44 | 45 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 89 |
89 // Lock to ensure the MidiScheduler is being destructed only once in | 90 // Lock to ensure the MidiScheduler is being destructed only once in |
90 // Finalize() on Chrome_IOThread. | 91 // Finalize() on Chrome_IOThread. |
91 base::Lock scheduler_lock_; | 92 base::Lock scheduler_lock_; |
92 std::unique_ptr<MidiScheduler> scheduler_; // GUARDED_BY(scheduler_lock_) | 93 std::unique_ptr<MidiScheduler> scheduler_; // GUARDED_BY(scheduler_lock_) |
93 }; | 94 }; |
94 | 95 |
95 } // namespace midi | 96 } // namespace midi |
96 | 97 |
97 #endif // MEDIA_MIDI_MIDI_MANAGER_ANDROID_H_ | 98 #endif // MEDIA_MIDI_MIDI_MANAGER_ANDROID_H_ |
OLD | NEW |