Chromium Code Reviews| Index: media/midi/midi_manager.h |
| diff --git a/media/midi/midi_manager.h b/media/midi/midi_manager.h |
| index 27e24f92cd9c86937622e5f311977d5e59be2252..c4e55a9906e23b00c2faa6794696d4ae5ffb28b4 100644 |
| --- a/media/midi/midi_manager.h |
| +++ b/media/midi/midi_manager.h |
| @@ -25,6 +25,8 @@ class SingleThreadTaskRunner; |
| namespace midi { |
| +class MidiService; |
| + |
| // A MidiManagerClient registers with the MidiManager to receive MIDI data. |
| // See MidiManager::RequestAccess() and MidiManager::ReleaseAccess() |
| // for details. |
| @@ -73,19 +75,24 @@ class MIDI_EXPORT MidiManagerClient { |
| }; |
| // Manages access to all MIDI hardware. |
| +// *** Note ***: If dynamic instantiation feature is enabled, all MidiManager |
| +// methods will be called on Chrome_IOThread. See comments on Shutdown() too. |
| class MIDI_EXPORT MidiManager { |
| public: |
| static const size_t kMaxPendingClientCount = 128; |
| - MidiManager(); |
| + MidiManager(MidiService* service); |
|
yhirano
2017/02/08 10:04:36
+explicit
Takashi Toyoshima
2017/02/08 11:08:55
Done.
|
| virtual ~MidiManager(); |
| // The constructor and the destructor will be called on the CrBrowserMain |
| // thread. |
| - static MidiManager* Create(); |
| + static MidiManager* Create(MidiService* service); |
| // Called on the CrBrowserMain thread to notify the Chrome_IOThread will stop |
| // and the instance will be destructed on the CrBrowserMain thread soon. |
| + // *** Note ***: If dynamic instantiation feature is enabled, MidiService call |
|
yhirano
2017/02/08 10:04:36
call"s"
Takashi Toyoshima
2017/02/08 11:08:55
Done.
|
| + // this on Chrome_IOThread and ShutdownOnSessionThread() will be called |
| + // synchronously so that MidiService can destruct MidiManager synchronously. |
| void Shutdown(); |
| // A client calls StartSession() to receive and send MIDI data. |
| @@ -174,6 +181,7 @@ class MIDI_EXPORT MidiManager { |
| const MidiPortInfoList& input_ports() const { return input_ports_; } |
| const MidiPortInfoList& output_ports() const { return output_ports_; } |
| + MidiService* service() { return service_; } |
| private: |
| enum class InitializationState { |
| @@ -216,6 +224,9 @@ class MIDI_EXPORT MidiManager { |
| // |input_ports_| and |output_ports_|. |
| base::Lock lock_; |
| + // MidiService outlives MidiManager. |
| + MidiService* const service_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(MidiManager); |
| }; |