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

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

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_service.h ('k') | no next file » | 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 #include "media/midi/midi_service.h"
6
7 #include "media/midi/midi_manager.h"
8
9 namespace midi {
10
11 MidiService::MidiService(std::unique_ptr<MidiManager> manager) {
12 base::AutoLock lock(lock_);
13 if (manager.get())
14 manager_ = std::move(manager);
15 else
16 manager_.reset(MidiManager::Create());
17 }
18
19 MidiService::~MidiService() {
20 base::AutoLock lock(lock_);
21 manager_.reset();
22 }
23
24 void MidiService::Shutdown() {
25 base::AutoLock lock(lock_);
26 manager_->Shutdown();
27 }
28
29 void MidiService::StartSession(MidiManagerClient* client) {
30 base::AutoLock lock(lock_);
31 manager_->StartSession(client);
32 }
33
34 void MidiService::EndSession(MidiManagerClient* client) {
35 base::AutoLock lock(lock_);
36 manager_->EndSession(client);
37 }
38
39 void MidiService::DispatchSendMidiData(MidiManagerClient* client,
40 uint32_t port_index,
41 const std::vector<uint8_t>& data,
42 double timestamp) {
43 base::AutoLock lock(lock_);
44 manager_->DispatchSendMidiData(client, port_index, data, timestamp);
45 }
46
47 } // namespace midi
OLDNEW
« no previous file with comments | « media/midi/midi_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698