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

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

Issue 2566673002: Web MIDI: introduce MidiService class (Closed)
Patch Set: merge master Created 4 years 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/midi_manager.h ('k') | media/midi/midi_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_MIDI_MIDI_SERVICE_H_
6 #define MEDIA_MIDI_MIDI_SERVICE_H_
7
8 #include <stdint.h>
9
10 #include <memory>
11 #include <vector>
12
13 #include "base/macros.h"
14 #include "base/synchronization/lock.h"
15 #include "media/midi/midi_export.h"
16 #include "media/midi/midi_manager.h"
17
18 namespace midi {
19
20 // Manages MidiManager backends. This class expects to be constructed and
21 // destructed on the browser main thread, but methods can be called on both
22 // the main thread and the I/O thread.
23 class MIDI_EXPORT MidiService final {
24 public:
25 // |MidiManager| can be explicitly specified in the constructor for testing.
26 explicit MidiService(std::unique_ptr<MidiManager> manager = nullptr);
27 ~MidiService();
28
29 // Called on the browser main thread to notify the I/O thread will stop and
30 // the instance will be destructed on the main thread soon.
31 void Shutdown();
32
33 // A client calls StartSession() to receive and send MIDI data.
34 void StartSession(MidiManagerClient* client);
35
36 // A client calls EndSession() to stop receiving MIDI data.
37 void EndSession(MidiManagerClient* client);
38
39 // A client calls DispatchSendMidiData() to send MIDI data.
40 virtual void DispatchSendMidiData(MidiManagerClient* client,
41 uint32_t port_index,
42 const std::vector<uint8_t>& data,
43 double timestamp);
44
45 std::unique_ptr<MidiManager> manager_;
46 base::Lock lock_;
47
48 DISALLOW_COPY_AND_ASSIGN(MidiService);
49 };
50
51 } // namespace midi
52
53 #endif // MEDIA_MIDI_MIDI_SERVICE_H_
OLDNEW
« no previous file with comments | « media/midi/midi_manager.h ('k') | media/midi/midi_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698