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 <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // AccumulateMidiBytesSent() is called to acknowledge when bytes have | 48 // AccumulateMidiBytesSent() is called to acknowledge when bytes have |
49 // successfully been sent to the hardware. | 49 // successfully been sent to the hardware. |
50 // This happens as a result of the client having previously called | 50 // This happens as a result of the client having previously called |
51 // MidiManager::DispatchSendMidiData(). | 51 // MidiManager::DispatchSendMidiData(). |
52 virtual void AccumulateMidiBytesSent(size_t n) = 0; | 52 virtual void AccumulateMidiBytesSent(size_t n) = 0; |
53 }; | 53 }; |
54 | 54 |
55 // Manages access to all MIDI hardware. | 55 // Manages access to all MIDI hardware. |
56 class MEDIA_EXPORT MidiManager { | 56 class MEDIA_EXPORT MidiManager { |
57 public: | 57 public: |
| 58 static const size_t kMaxPendingClientCount = 128; |
| 59 |
| 60 MidiManager(); |
| 61 virtual ~MidiManager(); |
| 62 |
58 // The constructor and the destructor will be called on the CrBrowserMain | 63 // The constructor and the destructor will be called on the CrBrowserMain |
59 // thread. | 64 // thread. |
60 static MidiManager* Create(); | 65 static MidiManager* Create(); |
61 | 66 |
62 MidiManager(); | |
63 virtual ~MidiManager(); | |
64 | |
65 // A client calls StartSession() to receive and send MIDI data. | 67 // A client calls StartSession() to receive and send MIDI data. |
66 // If the session is ready to start, the MIDI system is lazily initialized | 68 // If the session is ready to start, the MIDI system is lazily initialized |
67 // and the client is registered to receive MIDI data. | 69 // and the client is registered to receive MIDI data. |
68 // CompleteStartSession() is called with MIDI_OK if the session is started. | 70 // CompleteStartSession() is called with MIDI_OK if the session is started. |
69 // Otherwise CompleteStartSession() is called with proper MidiResult code. | 71 // Otherwise CompleteStartSession() is called with proper MidiResult code. |
70 // StartSession() and EndSession() can be called on the Chrome_IOThread. | 72 // StartSession() and EndSession() can be called on the Chrome_IOThread. |
71 // CompleteStartSession() will be invoked on the same Chrome_IOThread. | 73 // CompleteStartSession() will be invoked on the same Chrome_IOThread. |
72 void StartSession(MidiManagerClient* client, int client_id); | 74 void StartSession(MidiManagerClient* client, int client_id); |
73 | 75 |
74 // A client calls EndSession() to stop receiving MIDI data. | 76 // A client calls EndSession() to stop receiving MIDI data. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // Protects access to |clients_|, |pending_clients_|, |initialized_|, and | 173 // Protects access to |clients_|, |pending_clients_|, |initialized_|, and |
172 // |result_|. | 174 // |result_|. |
173 base::Lock lock_; | 175 base::Lock lock_; |
174 | 176 |
175 DISALLOW_COPY_AND_ASSIGN(MidiManager); | 177 DISALLOW_COPY_AND_ASSIGN(MidiManager); |
176 }; | 178 }; |
177 | 179 |
178 } // namespace media | 180 } // namespace media |
179 | 181 |
180 #endif // MEDIA_MIDI_MIDI_MANAGER_H_ | 182 #endif // MEDIA_MIDI_MIDI_MANAGER_H_ |
OLD | NEW |