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

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: make map non-global/statically initialized object 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..fc617c9288987c93473e96ff2f8f317c7996716d 100644
--- a/media/midi/dynamically_initialized_midi_manager_win.h
+++ b/media/midi/dynamically_initialized_midi_manager_win.h
@@ -25,9 +25,24 @@ class DynamicallyInitializedMidiManagerWin final
: public MidiManager,
public base::SystemMonitor::DevicesChangedObserver {
public:
+ class PortManager;
+
explicit DynamicallyInitializedMidiManagerWin(MidiService* service);
~DynamicallyInitializedMidiManagerWin() override;
+ // 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(); }
+
+ // 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
Takashi Toyoshima 2017/02/24 08:53:34 Move from private to public so to use this from Po
yhirano 2017/02/24 12:22:58 PortManager is an inner class so it can access to
Takashi Toyoshima 2017/02/27 06:44:49 Oh, thanks. My understanding around access specifi
+ // 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.
@@ -48,10 +63,6 @@ class DynamicallyInitializedMidiManagerWin final
class InPort;
class OutPort;
- // Posts a task to TaskRunner, and ensures that the instance keeps alive while
- // the task is running.
- void PostTask(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