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

Unified Diff: media/midi/dynamically_initialized_midi_manager_win.h

Issue 2701783003: Web MIDI: implement receiving for dynamic manager instantiation on Windows (Closed)
Patch Set: remove unused function that clang found Created 3 years, 10 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
Index: media/midi/dynamically_initialized_midi_manager_win.h
diff --git a/media/midi/dynamically_initialized_midi_manager_win.h b/media/midi/dynamically_initialized_midi_manager_win.h
index 5c4f65a4010db484b09ff50fa1f6274fdd6fe8a8..ae492eed719dd7d2efdf54f33443153c891fd18d 100644
--- a/media/midi/dynamically_initialized_midi_manager_win.h
+++ b/media/midi/dynamically_initialized_midi_manager_win.h
@@ -25,13 +25,14 @@ class DynamicallyInitializedMidiManagerWin final
: public MidiManager,
public base::SystemMonitor::DevicesChangedObserver {
public:
+ class PortManager;
+
explicit DynamicallyInitializedMidiManagerWin(MidiService* service);
~DynamicallyInitializedMidiManagerWin() override;
- // Posts a reply task to the I/O thread that hosts MidiManager instance, runs
- // it safely, and ensures that the instance keeps alive while the task is
- // running.
- void PostReplyTask(const base::Closure&);
+ // Returns PortManager that implements interfaces to help implementation.
+ // This hides Windows specific structures, i.e. HMIDIIN in the header.
+ PortManager* port_manager() { return port_manager_.get(); }
// MidiManager overrides:
void StartInitialization() override;
@@ -48,10 +49,20 @@ class DynamicallyInitializedMidiManagerWin final
class InPort;
class OutPort;
+ // Handles MIDI inport event posted from a thread system provides.
+ void ReceiveMidiData(uint32_t index,
+ const std::vector<uint8_t>& data,
+ base::TimeTicks time);
+
// Posts a task to TaskRunner, and ensures that the instance keeps alive while
// the task is running.
void PostTask(const base::Closure&);
+ // Posts a reply task to the I/O thread that hosts MidiManager instance, runs
+ // it safely, and ensures that the instance keeps alive while the task is
+ // running.
+ void PostReplyTask(const base::Closure&);
+
// Initializes instance asynchronously on TaskRunner.
void InitializeOnTaskRunner();
@@ -71,11 +82,9 @@ class DynamicallyInitializedMidiManagerWin final
// Keeps a TaskRunner for the I/O thread.
scoped_refptr<base::SingleThreadTaskRunner> thread_runner_;
- // Following members should be accessed only on TaskRunner.
-
- // Holds all MIDI input or output ports connected once.
- std::vector<std::unique_ptr<InPort>> input_ports_;
- std::vector<std::unique_ptr<OutPort>> output_ports_;
+ // Manages platform dependent implementation for port managegent. Should be
+ // accessed with the task lock.
+ std::unique_ptr<PortManager> port_manager_;
DISALLOW_COPY_AND_ASSIGN(DynamicallyInitializedMidiManagerWin);
};

Powered by Google App Engine
This is Rietveld 408576698