| Index: media/midi/midi_manager.h | 
| diff --git a/media/midi/midi_manager.h b/media/midi/midi_manager.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..131b42d80d31e8ad1748f70f8b69f1541e412e19 | 
| --- /dev/null | 
| +++ b/media/midi/midi_manager.h | 
| @@ -0,0 +1,56 @@ | 
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#ifndef MEDIA_MIDI_MIDI_MANAGER_H_ | 
| +#define MEDIA_MIDI_MIDI_MANAGER_H_ | 
| + | 
| +#include "base/basictypes.h" | 
| +#include "base/synchronization/lock.h" | 
| +#include "media/base/media_export.h" | 
| +#include <set> | 
| + | 
| +namespace media { | 
| + | 
| +// Manages access to all MIDI hardware. | 
| +class MEDIA_EXPORT MIDIManager { | 
| + public: | 
| +  static MIDIManager* Create(); | 
| + | 
| +  MIDIManager(); | 
| +  virtual ~MIDIManager(); | 
| + | 
| +  class Client { | 
| +   public: | 
| +     virtual ~Client() {} | 
| +     virtual void ReceiveMIDIData( | 
| +         int port_index, | 
| +         const uint8* data, | 
| +         size_t length, | 
| +         double time_stamp) = 0; | 
| +  }; | 
| + | 
| +  void AddClient(Client* client); | 
| +  void RemoveClient(Client* client); | 
| + | 
| + protected: | 
| +  // Dispatches to all clients. | 
| +  void ReceiveMIDIData( | 
| +      int port_index, | 
| +      const uint8* data, | 
| +      size_t length, | 
| +      double time_stamp); | 
| + | 
| +  // Keeps track of all clients who wish to receive MIDI data. | 
| +  typedef std::set<Client*> ClientList; | 
| +  ClientList clients_; | 
| + | 
| +  // Protects access to our clients. | 
| +  base::Lock clients_lock_; | 
| + | 
| +  DISALLOW_COPY_AND_ASSIGN(MIDIManager); | 
| +}; | 
| + | 
| +}  // namespace media | 
| + | 
| +#endif  // MEDIA_MIDI_MIDI_MANAGER_H_ | 
|  |