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

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

Issue 2673423002: Web MIDI: add dynamic MidiManager instantiation support for Linux (Closed)
Patch Set: rebase again 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
« no previous file with comments | « media/midi/midi_manager_mac.h ('k') | media/midi/midi_manager_mac_unittest.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "media/midi/midi_manager_mac.h" 5 #include "media/midi/midi_manager_mac.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return static_cast<double>(nanoseconds) / 1.0e9; 97 return static_cast<double>(nanoseconds) / 1.0e9;
98 } 98 }
99 99
100 MIDITimeStamp SecondsToMIDITimeStamp(double seconds) { 100 MIDITimeStamp SecondsToMIDITimeStamp(double seconds) {
101 UInt64 nanos = UInt64(seconds * 1.0e9); 101 UInt64 nanos = UInt64(seconds * 1.0e9);
102 return AudioConvertNanosToHostTime(nanos); 102 return AudioConvertNanosToHostTime(nanos);
103 } 103 }
104 104
105 } // namespace 105 } // namespace
106 106
107 MidiManager* MidiManager::Create() { 107 MidiManager* MidiManager::Create(MidiService* service) {
108 return new MidiManagerMac(); 108 return new MidiManagerMac(service);
109 } 109 }
110 110
111 MidiManagerMac::MidiManagerMac() 111 MidiManagerMac::MidiManagerMac(MidiService* service)
112 : midi_client_(0), 112 : MidiManager(service),
113 midi_client_(0),
113 coremidi_input_(0), 114 coremidi_input_(0),
114 coremidi_output_(0), 115 coremidi_output_(0),
115 client_thread_("MidiClientThread"), 116 client_thread_("MidiClientThread"),
116 shutdown_(false) { 117 shutdown_(false) {}
117 }
118 118
119 MidiManagerMac::~MidiManagerMac() = default; 119 MidiManagerMac::~MidiManagerMac() = default;
120 120
121 void MidiManagerMac::StartInitialization() { 121 void MidiManagerMac::StartInitialization() {
122 // MIDIClient should be created on |client_thread_| to receive CoreMIDI event 122 // MIDIClient should be created on |client_thread_| to receive CoreMIDI event
123 // notifications. 123 // notifications.
124 RunOnClientThread( 124 RunOnClientThread(
125 base::Bind(&MidiManagerMac::InitializeCoreMIDI, base::Unretained(this))); 125 base::Bind(&MidiManagerMac::InitializeCoreMIDI, base::Unretained(this)));
126 } 126 }
127 127
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 &data[sent_size]); 381 &data[sent_size]);
382 DCHECK(midi_packet); 382 DCHECK(midi_packet);
383 383
384 MIDISend(coremidi_output_, destination, packet_list); 384 MIDISend(coremidi_output_, destination, packet_list);
385 } 385 }
386 386
387 AccumulateMidiBytesSent(client, data.size()); 387 AccumulateMidiBytesSent(client, data.size());
388 } 388 }
389 389
390 } // namespace midi 390 } // namespace midi
OLDNEW
« no previous file with comments | « media/midi/midi_manager_mac.h ('k') | media/midi/midi_manager_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698