| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_H_ | 5 #ifndef MEDIA_MIDI_MIDI_MANAGER_H_ |
| 6 #define MEDIA_MIDI_MIDI_MANAGER_H_ | 6 #define MEDIA_MIDI_MIDI_MANAGER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/scoped_vector.h" |
| 13 #include "base/message_loop/message_loop_proxy.h" | 14 #include "base/message_loop/message_loop_proxy.h" |
| 14 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 15 #include "media/base/media_export.h" | 16 #include "media/base/media_export.h" |
| 16 #include "media/midi/midi_port_info.h" | 17 #include "media/midi/midi_port_info.h" |
| 17 | 18 |
| 18 namespace base { | 19 namespace base { |
| 19 class Thread; | 20 class Thread; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace media { | 23 namespace media { |
| 23 | 24 |
| 25 class MIDIMessageQueue; |
| 26 |
| 24 // A MIDIManagerClient registers with the MIDIManager to receive MIDI data. | 27 // A MIDIManagerClient registers with the MIDIManager to receive MIDI data. |
| 25 // See MIDIManager::RequestAccess() and MIDIManager::ReleaseAccess() | 28 // See MIDIManager::RequestAccess() and MIDIManager::ReleaseAccess() |
| 26 // for details. | 29 // for details. |
| 27 class MEDIA_EXPORT MIDIManagerClient { | 30 class MEDIA_EXPORT MIDIManagerClient { |
| 28 public: | 31 public: |
| 29 virtual ~MIDIManagerClient() {} | 32 virtual ~MIDIManagerClient() {} |
| 30 | 33 |
| 31 // ReceiveMIDIData() is called when MIDI data has been received from the | 34 // ReceiveMIDIData() is called when MIDI data has been received from the |
| 32 // MIDI system. | 35 // MIDI system. |
| 33 // |port_index| represents the specific input port from input_ports(). | 36 // |port_index| represents the specific input port from input_ports(). |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 113 |
| 111 bool initialized_; | 114 bool initialized_; |
| 112 | 115 |
| 113 // Keeps track of all clients who wish to receive MIDI data. | 116 // Keeps track of all clients who wish to receive MIDI data. |
| 114 typedef std::set<MIDIManagerClient*> ClientList; | 117 typedef std::set<MIDIManagerClient*> ClientList; |
| 115 ClientList clients_; | 118 ClientList clients_; |
| 116 | 119 |
| 117 // Protects access to our clients. | 120 // Protects access to our clients. |
| 118 base::Lock clients_lock_; | 121 base::Lock clients_lock_; |
| 119 | 122 |
| 123 ScopedVector<MIDIMessageQueue> input_message_queues_; |
| 120 MIDIPortInfoList input_ports_; | 124 MIDIPortInfoList input_ports_; |
| 121 MIDIPortInfoList output_ports_; | 125 MIDIPortInfoList output_ports_; |
| 122 | 126 |
| 123 // |send_thread_| is used to send MIDI data by calling the platform-specific | 127 // |send_thread_| is used to send MIDI data by calling the platform-specific |
| 124 // API. | 128 // API. |
| 125 scoped_ptr<base::Thread> send_thread_; | 129 scoped_ptr<base::Thread> send_thread_; |
| 126 scoped_refptr<base::MessageLoopProxy> send_message_loop_; | 130 scoped_refptr<base::MessageLoopProxy> send_message_loop_; |
| 127 | 131 |
| 128 DISALLOW_COPY_AND_ASSIGN(MIDIManager); | 132 DISALLOW_COPY_AND_ASSIGN(MIDIManager); |
| 129 }; | 133 }; |
| 130 | 134 |
| 131 } // namespace media | 135 } // namespace media |
| 132 | 136 |
| 133 #endif // MEDIA_MIDI_MIDI_MANAGER_H_ | 137 #endif // MEDIA_MIDI_MIDI_MANAGER_H_ |
| OLD | NEW |