Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2252)

Unified Diff: media/midi/midi_manager.h

Issue 664843002: Web MIDI: distributes MIDIPort information asynchronously (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lifecycle
Patch Set: . => -> Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/midi_message_filter.cc ('k') | media/midi/midi_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/midi/midi_manager.h
diff --git a/media/midi/midi_manager.h b/media/midi/midi_manager.h
index 1e2bcb8dc793ae76ecb5d1787ffb541ec6f9b6f8..d7e7e47a1a65ce38497b316a080c396df21d1068 100644
--- a/media/midi/midi_manager.h
+++ b/media/midi/midi_manager.h
@@ -29,6 +29,17 @@ class MEDIA_EXPORT MidiManagerClient {
public:
virtual ~MidiManagerClient() {}
+ // AddInputPort() and AddOutputPort() are called before CompleteStartSession()
+ // is called to notify existing MIDI ports, and also called after that to
+ // notify new MIDI ports are added.
+ virtual void AddInputPort(const MidiPortInfo& info) = 0;
+ virtual void AddOutputPort(const MidiPortInfo& info) = 0;
+
+ // TODO(toyoshim): DisableInputPort(const MidiPortInfo& info) and
+ // DisableOutputPort(const MidiPortInfo& info) should be added.
+ // On DisableInputPort(), internal states, e.g. received_messages_queues in
+ // MidiHost, should be reset.
+
// CompleteStartSession() is called when platform dependent preparation is
// finished.
virtual void CompleteStartSession(MidiResult result) = 0;
@@ -89,16 +100,6 @@ class MEDIA_EXPORT MidiManager {
const std::vector<uint8>& data,
double timestamp);
- // input_ports() is a list of MIDI ports for receiving MIDI data.
- // Each individual port in this list can be identified by its
- // integer index into this list.
- const MidiPortInfoList& input_ports() const { return input_ports_; }
-
- // output_ports() is a list of MIDI ports for sending MIDI data.
- // Each individual port in this list can be identified by its
- // integer index into this list.
- const MidiPortInfoList& output_ports() const { return output_ports_; }
-
protected:
friend class MidiManagerUsb;
@@ -145,6 +146,7 @@ class MEDIA_EXPORT MidiManager {
private:
void CompleteInitializationInternal(MidiResult result);
+ void AddInitialPorts(MidiManagerClient* client);
// Keeps track of all clients who wish to receive MIDI data.
typedef std::set<MidiManagerClient*> ClientSet;
@@ -164,13 +166,14 @@ class MEDIA_EXPORT MidiManager {
// completed. Otherwise keeps MIDI_NOT_SUPPORTED.
MidiResult result_;
- // Protects access to |clients_|, |pending_clients_|, |initialized_|, and
- // |result_|.
- base::Lock lock_;
-
+ // Keeps all MidiPortInfo.
MidiPortInfoList input_ports_;
MidiPortInfoList output_ports_;
+ // Protects access to |clients_|, |pending_clients_|, |initialized_|,
+ // |result_|, |input_ports_| and |output_ports_|.
+ base::Lock lock_;
+
DISALLOW_COPY_AND_ASSIGN(MidiManager);
};
« no previous file with comments | « content/renderer/media/midi_message_filter.cc ('k') | media/midi/midi_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698