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

Side by Side Diff: Source/modules/webmidi/MIDIOutput.cpp

Issue 1051903002: Web MIDI: implement implicit open() on send() and setOnmidimessage() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: kouhei review Created 5 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 | « Source/modules/webmidi/MIDIInput.cpp ('k') | Source/modules/webmidi/MIDIPort.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 MIDIOutput::~MIDIOutput() 191 MIDIOutput::~MIDIOutput()
192 { 192 {
193 } 193 }
194 194
195 void MIDIOutput::send(DOMUint8Array* array, double timestamp, ExceptionState& ex ceptionState) 195 void MIDIOutput::send(DOMUint8Array* array, double timestamp, ExceptionState& ex ceptionState)
196 { 196 {
197 if (timestamp == 0.0) 197 if (timestamp == 0.0)
198 timestamp = now(executionContext()); 198 timestamp = now(executionContext());
199 199
200 // Implicit open. It does nothing if the port is already opened.
201 // This should be performed even if |array| is invalid.
202 open();
203
200 if (!array) 204 if (!array)
201 return; 205 return;
202 206
203 if (MessageValidator::validate(array, exceptionState, midiAccess()->sysexEna bled())) 207 if (MessageValidator::validate(array, exceptionState, midiAccess()->sysexEna bled()))
204 midiAccess()->sendMIDIData(m_portIndex, array->data(), array->length(), timestamp); 208 midiAccess()->sendMIDIData(m_portIndex, array->data(), array->length(), timestamp);
205 } 209 }
206 210
207 void MIDIOutput::send(Vector<unsigned> unsignedData, double timestamp, Exception State& exceptionState) 211 void MIDIOutput::send(Vector<unsigned> unsignedData, double timestamp, Exception State& exceptionState)
208 { 212 {
209 if (timestamp == 0.0) 213 if (timestamp == 0.0)
(...skipping 24 matching lines...) Expand all
234 { 238 {
235 send(unsignedData, 0.0, exceptionState); 239 send(unsignedData, 0.0, exceptionState);
236 } 240 }
237 241
238 DEFINE_TRACE(MIDIOutput) 242 DEFINE_TRACE(MIDIOutput)
239 { 243 {
240 MIDIPort::trace(visitor); 244 MIDIPort::trace(visitor);
241 } 245 }
242 246
243 } // namespace blink 247 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/webmidi/MIDIInput.cpp ('k') | Source/modules/webmidi/MIDIPort.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698