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

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

Issue 962523005: Web MIDI: add open() and close() to MIDIPort (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review #14 Created 5 years, 9 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/MIDIOutput.h ('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 23 matching lines...) Expand all
34 #include "bindings/core/v8/ExceptionState.h" 34 #include "bindings/core/v8/ExceptionState.h"
35 #include "core/dom/ExceptionCode.h" 35 #include "core/dom/ExceptionCode.h"
36 #include "core/dom/ExecutionContext.h" 36 #include "core/dom/ExecutionContext.h"
37 #include "core/frame/LocalDOMWindow.h" 37 #include "core/frame/LocalDOMWindow.h"
38 #include "core/timing/DOMWindowPerformance.h" 38 #include "core/timing/DOMWindowPerformance.h"
39 #include "core/timing/Performance.h" 39 #include "core/timing/Performance.h"
40 #include "modules/webmidi/MIDIAccess.h" 40 #include "modules/webmidi/MIDIAccess.h"
41 41
42 namespace blink { 42 namespace blink {
43 43
44 using PortState = MIDIAccessor::MIDIPortState;
45
44 namespace { 46 namespace {
45 47
46 double now(ExecutionContext* context) 48 double now(ExecutionContext* context)
47 { 49 {
48 LocalDOMWindow* window = context ? context->executingWindow() : nullptr; 50 LocalDOMWindow* window = context ? context->executingWindow() : nullptr;
49 Performance* performance = window ? DOMWindowPerformance::performance(*windo w) : nullptr; 51 Performance* performance = window ? DOMWindowPerformance::performance(*windo w) : nullptr;
50 return performance ? performance->now() : 0.0; 52 return performance ? performance->now() : 0.0;
51 } 53 }
52 54
53 class MessageValidator { 55 class MessageValidator {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 169
168 String getPositionString() { return "at index " + String::number(m_offset) + " (" + String::number(m_data[m_offset]) + ")."; } 170 String getPositionString() { return "at index " + String::number(m_offset) + " (" + String::number(m_data[m_offset]) + ")."; }
169 171
170 const unsigned char* m_data; 172 const unsigned char* m_data;
171 const size_t m_length; 173 const size_t m_length;
172 size_t m_offset; 174 size_t m_offset;
173 }; 175 };
174 176
175 } // namespace 177 } // namespace
176 178
177 MIDIOutput* MIDIOutput::create(MIDIAccess* access, unsigned portIndex, const Str ing& id, const String& manufacturer, const String& name, const String& version, bool isActive) 179 MIDIOutput* MIDIOutput::create(MIDIAccess* access, unsigned portIndex, const Str ing& id, const String& manufacturer, const String& name, const String& version, PortState state)
178 { 180 {
179 ASSERT(access); 181 ASSERT(access);
180 return new MIDIOutput(access, portIndex, id, manufacturer, name, version, is Active); 182 return new MIDIOutput(access, portIndex, id, manufacturer, name, version, st ate);
181 } 183 }
182 184
183 MIDIOutput::MIDIOutput(MIDIAccess* access, unsigned portIndex, const String& id, const String& manufacturer, const String& name, const String& version, bool isA ctive) 185 MIDIOutput::MIDIOutput(MIDIAccess* access, unsigned portIndex, const String& id, const String& manufacturer, const String& name, const String& version, PortStat e state)
184 : MIDIPort(access, id, manufacturer, name, MIDIPortTypeOutput, version, isAc tive) 186 : MIDIPort(access, id, manufacturer, name, MIDIPortTypeOutput, version, stat e)
185 , m_portIndex(portIndex) 187 , m_portIndex(portIndex)
186 { 188 {
187 } 189 }
188 190
189 MIDIOutput::~MIDIOutput() 191 MIDIOutput::~MIDIOutput()
190 { 192 {
191 } 193 }
192 194
193 void MIDIOutput::send(DOMUint8Array* array, double timestamp, ExceptionState& ex ceptionState) 195 void MIDIOutput::send(DOMUint8Array* array, double timestamp, ExceptionState& ex ceptionState)
194 { 196 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 { 234 {
233 send(unsignedData, 0.0, exceptionState); 235 send(unsignedData, 0.0, exceptionState);
234 } 236 }
235 237
236 DEFINE_TRACE(MIDIOutput) 238 DEFINE_TRACE(MIDIOutput)
237 { 239 {
238 MIDIPort::trace(visitor); 240 MIDIPort::trace(visitor);
239 } 241 }
240 242
241 } // namespace blink 243 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/webmidi/MIDIOutput.h ('k') | Source/modules/webmidi/MIDIPort.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698