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

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

Issue 2566673002: Web MIDI: introduce MidiService class (Closed)
Patch Set: lock 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
17 namespace midi {
18
19 class MidiManager;
20 class MidiManagerClient;
21
22 // Manages MidiManager backends. This class expects to be constructed and
23 // destructed on the browser main thread, but methods can be called on both
24 // the main thread and the I/O thread.
25 class MIDI_EXPORT MidiService {
yhirano 2016/12/13 04:02:30 +final
Takashi Toyoshima 2016/12/13 05:57:00 Done.
26 public:
27 // |MidiManager| can be explicitly specified in the constructor for testing.
28 explicit MidiService(MidiManager* manager_ = nullptr);
yhirano 2016/12/13 04:02:30 Can this parameter be a std::unique_ptr?
Takashi Toyoshima 2016/12/13 05:57:00 Done.
29 ~MidiService();
30
31 // Called on the browser main thread to notify the I/O thread will stop and
32 // the instance will be destructed on the main thread soon.
33 void Shutdown();
34
35 // A client calls StartSession() to receive and send MIDI data.
36 void StartSession(MidiManagerClient* client);
37
38 // A client calls EndSession() to stop receiving MIDI data.
39 void EndSession(MidiManagerClient* client);
40
41 // A client calls DispatchSendMidiData() to send MIDI data.
42 virtual void DispatchSendMidiData(MidiManagerClient* client,
43 uint32_t port_index,
44 const std::vector<uint8_t>& data,
45 double timestamp);
46
47 std::unique_ptr<MidiManager> manager_;
48 base::Lock lock_;
49
50 DISALLOW_COPY_AND_ASSIGN(MidiService);
51 };
52
53 } // namespace midi
54
55 #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