OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |