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

Side by Side Diff: media/midi/dynamically_initialized_midi_manager_win.h

Issue 2701783003: Web MIDI: implement receiving for dynamic manager instantiation on Windows (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_MIDI_DYNAMICALLY_INITIALIZED_MIDI_MANAGER_WIN_H_ 5 #ifndef MEDIA_MIDI_DYNAMICALLY_INITIALIZED_MIDI_MANAGER_WIN_H_
6 #define MEDIA_MIDI_DYNAMICALLY_INITIALIZED_MIDI_MANAGER_WIN_H_ 6 #define MEDIA_MIDI_DYNAMICALLY_INITIALIZED_MIDI_MANAGER_WIN_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 10 matching lines...) Expand all
21 namespace midi { 21 namespace midi {
22 22
23 // New backend for legacy Windows that support dynamic instantiation. 23 // New backend for legacy Windows that support dynamic instantiation.
24 class DynamicallyInitializedMidiManagerWin final 24 class DynamicallyInitializedMidiManagerWin final
25 : public MidiManager, 25 : public MidiManager,
26 public base::SystemMonitor::DevicesChangedObserver { 26 public base::SystemMonitor::DevicesChangedObserver {
27 public: 27 public:
28 explicit DynamicallyInitializedMidiManagerWin(MidiService* service); 28 explicit DynamicallyInitializedMidiManagerWin(MidiService* service);
29 ~DynamicallyInitializedMidiManagerWin() override; 29 ~DynamicallyInitializedMidiManagerWin() override;
30 30
31 // Calculates event time from elapsed time that system provides.
32 base::TimeTicks CalculateInEventTime(size_t index, uint32_t elapsed_ms) const;
33
34 // Handles MIDI inport event posted from a thread system provides.
35 void ReceiveMidiData(uint32_t index,
36 const std::vector<uint8_t>& data,
37 base::TimeTicks time);
38
31 // Posts a reply task to the I/O thread that hosts MidiManager instance, runs 39 // Posts a reply task to the I/O thread that hosts MidiManager instance, runs
32 // it safely, and ensures that the instance keeps alive while the task is 40 // it safely, and ensures that the instance keeps alive while the task is
33 // running. 41 // running.
34 void PostReplyTask(const base::Closure&); 42 void PostReplyTask(const base::Closure&);
35 43
36 // MidiManager overrides: 44 // MidiManager overrides:
37 void StartInitialization() override; 45 void StartInitialization() override;
38 void Finalize() override; 46 void Finalize() override;
39 void DispatchSendMidiData(MidiManagerClient* client, 47 void DispatchSendMidiData(MidiManagerClient* client,
40 uint32_t port_index, 48 uint32_t port_index,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // Holds all MIDI input or output ports connected once. 83 // Holds all MIDI input or output ports connected once.
76 std::vector<std::unique_ptr<InPort>> input_ports_; 84 std::vector<std::unique_ptr<InPort>> input_ports_;
77 std::vector<std::unique_ptr<OutPort>> output_ports_; 85 std::vector<std::unique_ptr<OutPort>> output_ports_;
78 86
79 DISALLOW_COPY_AND_ASSIGN(DynamicallyInitializedMidiManagerWin); 87 DISALLOW_COPY_AND_ASSIGN(DynamicallyInitializedMidiManagerWin);
80 }; 88 };
81 89
82 } // namespace midi 90 } // namespace midi
83 91
84 #endif // MEDIA_MIDI_DYNAMICALLY_INITIALIZED_MIDI_MANAGER_WIN_H_ 92 #endif // MEDIA_MIDI_DYNAMICALLY_INITIALIZED_MIDI_MANAGER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698