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

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

Issue 2834423002: Web MIDI: rename DynamicallyInitializedMidiManagerWin (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « media/midi/dynamically_initialized_midi_manager_win.cc ('k') | media/midi/midi_manager_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_MIDI_MANAGER_WIN_H_
6 #define MEDIA_MIDI_DYNAMICALLY_INITIALIZED_MIDI_MANAGER_WIN_H_ 6 #define MEDIA_MIDI_MIDI_MANAGER_WIN_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/system_monitor/system_monitor.h" 14 #include "base/system_monitor/system_monitor.h"
15 #include "media/midi/midi_manager.h" 15 #include "media/midi/midi_manager.h"
16 16
17 namespace base { 17 namespace base {
18 class SingleThreadTaskRunner; 18 class SingleThreadTaskRunner;
19 class TimeDelta; 19 class TimeDelta;
20 } // namespace base 20 } // namespace base
21 21
22 namespace midi { 22 namespace midi {
23 23
24 // New backend for legacy Windows that support dynamic instantiation. 24 // New backend for legacy Windows that support dynamic instantiation.
25 class DynamicallyInitializedMidiManagerWin final 25 class MidiManagerWin final
26 : public MidiManager, 26 : public MidiManager,
27 public base::SystemMonitor::DevicesChangedObserver { 27 public base::SystemMonitor::DevicesChangedObserver {
28 public: 28 public:
29 class PortManager; 29 class PortManager;
30 30
31 explicit DynamicallyInitializedMidiManagerWin(MidiService* service); 31 explicit MidiManagerWin(MidiService* service);
32 ~DynamicallyInitializedMidiManagerWin() override; 32 ~MidiManagerWin() override;
33 33
34 // Returns PortManager that implements interfaces to help implementation. 34 // Returns PortManager that implements interfaces to help implementation.
35 // This hides Windows specific structures, i.e. HMIDIIN in the header. 35 // This hides Windows specific structures, i.e. HMIDIIN in the header.
36 PortManager* port_manager() { return port_manager_.get(); } 36 PortManager* port_manager() { return port_manager_.get(); }
37 37
38 // MidiManager overrides: 38 // MidiManager overrides:
39 void StartInitialization() override; 39 void StartInitialization() override;
40 void Finalize() override; 40 void Finalize() override;
41 void DispatchSendMidiData(MidiManagerClient* client, 41 void DispatchSendMidiData(MidiManagerClient* client,
42 uint32_t port_index, 42 uint32_t port_index,
(...skipping 24 matching lines...) Expand all
67 67
68 // Initializes instance asynchronously on TaskRunner. 68 // Initializes instance asynchronously on TaskRunner.
69 void InitializeOnTaskRunner(); 69 void InitializeOnTaskRunner();
70 70
71 // Updates device lists on TaskRunner. 71 // Updates device lists on TaskRunner.
72 // Returns true if device lists were changed. 72 // Returns true if device lists were changed.
73 void UpdateDeviceListOnTaskRunner(); 73 void UpdateDeviceListOnTaskRunner();
74 74
75 // Reflect active port list to a device list. 75 // Reflect active port list to a device list.
76 template <typename T> 76 template <typename T>
77 void ReflectActiveDeviceList(DynamicallyInitializedMidiManagerWin* manager, 77 void ReflectActiveDeviceList(MidiManagerWin* manager,
78 std::vector<T>* known_ports, 78 std::vector<T>* known_ports,
79 std::vector<T>* active_ports); 79 std::vector<T>* active_ports);
80 80
81 // Sends MIDI data on TaskRunner. 81 // Sends MIDI data on TaskRunner.
82 void SendOnTaskRunner(MidiManagerClient* client, 82 void SendOnTaskRunner(MidiManagerClient* client,
83 uint32_t port_index, 83 uint32_t port_index,
84 const std::vector<uint8_t>& data); 84 const std::vector<uint8_t>& data);
85 85
86 // Holds an unique instance ID. 86 // Holds an unique instance ID.
87 const int instance_id_; 87 const int instance_id_;
88 88
89 // Keeps a TaskRunner for the I/O thread. 89 // Keeps a TaskRunner for the I/O thread.
90 scoped_refptr<base::SingleThreadTaskRunner> thread_runner_; 90 scoped_refptr<base::SingleThreadTaskRunner> thread_runner_;
91 91
92 // Manages platform dependent implementation for port managegent. Should be 92 // Manages platform dependent implementation for port managegent. Should be
93 // accessed with the task lock. 93 // accessed with the task lock.
94 std::unique_ptr<PortManager> port_manager_; 94 std::unique_ptr<PortManager> port_manager_;
95 95
96 DISALLOW_COPY_AND_ASSIGN(DynamicallyInitializedMidiManagerWin); 96 DISALLOW_COPY_AND_ASSIGN(MidiManagerWin);
97 }; 97 };
98 98
99 } // namespace midi 99 } // namespace midi
100 100
101 #endif // MEDIA_MIDI_DYNAMICALLY_INITIALIZED_MIDI_MANAGER_WIN_H_ 101 #endif // MEDIA_MIDI_MIDI_MANAGER_WIN_H_
OLDNEW
« no previous file with comments | « media/midi/dynamically_initialized_midi_manager_win.cc ('k') | media/midi/midi_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698