| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #ifndef MIDIAccess_h | 31 #ifndef MIDIAccess_h |
| 32 #define MIDIAccess_h | 32 #define MIDIAccess_h |
| 33 | 33 |
| 34 #include "bindings/v8/ScriptWrappable.h" | 34 #include "bindings/v8/ScriptWrappable.h" |
| 35 #include "core/dom/ActiveDOMObject.h" | 35 #include "core/dom/ActiveDOMObject.h" |
| 36 #include "core/dom/EventTarget.h" | 36 #include "core/dom/EventTarget.h" |
| 37 #include "core/platform/midi/MIDIAccessor.h" | 37 #include "core/platform/midi/MIDIAccessor.h" |
| 38 #include "core/platform/midi/MIDIAccessorClient.h" | 38 #include "core/platform/midi/MIDIAccessorClient.h" |
| 39 #include "modules/webmidi/MIDIInput.h" | 39 #include "modules/webmidi/MIDIInput.h" |
| 40 #include "modules/webmidi/MIDIOptions.h" |
| 40 #include "modules/webmidi/MIDIOutput.h" | 41 #include "modules/webmidi/MIDIOutput.h" |
| 41 #include "wtf/RefCounted.h" | 42 #include "wtf/RefCounted.h" |
| 42 #include "wtf/RefPtr.h" | 43 #include "wtf/RefPtr.h" |
| 43 #include "wtf/Vector.h" | 44 #include "wtf/Vector.h" |
| 44 | 45 |
| 45 namespace WebCore { | 46 namespace WebCore { |
| 46 | 47 |
| 47 class ScriptExecutionContext; | 48 class ScriptExecutionContext; |
| 48 class MIDIAccessPromise; | 49 class MIDIAccessPromise; |
| 49 | 50 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 69 virtual bool canSuspend() const OVERRIDE { return true; } | 70 virtual bool canSuspend() const OVERRIDE { return true; } |
| 70 virtual void stop(); | 71 virtual void stop(); |
| 71 | 72 |
| 72 // MIDIAccessorClient | 73 // MIDIAccessorClient |
| 73 virtual void didAddInputPort(const String& id, const String& manufacturer, c
onst String& name, const String& version) OVERRIDE; | 74 virtual void didAddInputPort(const String& id, const String& manufacturer, c
onst String& name, const String& version) OVERRIDE; |
| 74 virtual void didAddOutputPort(const String& id, const String& manufacturer,
const String& name, const String& version) OVERRIDE; | 75 virtual void didAddOutputPort(const String& id, const String& manufacturer,
const String& name, const String& version) OVERRIDE; |
| 75 virtual void didAllowAccess() OVERRIDE; | 76 virtual void didAllowAccess() OVERRIDE; |
| 76 virtual void didBlockAccess() OVERRIDE; | 77 virtual void didBlockAccess() OVERRIDE; |
| 77 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat
a, size_t length, double timeStamp) OVERRIDE; | 78 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat
a, size_t length, double timeStamp) OVERRIDE; |
| 78 | 79 |
| 80 // |timeStampInMilliseconds| is in the same time coordinate system as perfor
mance.now(). |
| 81 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng
th, double timeStampInMilliseconds); |
| 82 |
| 79 private: | 83 private: |
| 80 explicit MIDIAccess(ScriptExecutionContext*, MIDIAccessPromise*); | 84 explicit MIDIAccess(ScriptExecutionContext*, MIDIAccessPromise*); |
| 81 | 85 |
| 82 // EventTarget | 86 // EventTarget |
| 83 virtual void refEventTarget() OVERRIDE { ref(); } | 87 virtual void refEventTarget() OVERRIDE { ref(); } |
| 84 virtual void derefEventTarget() OVERRIDE { deref(); } | 88 virtual void derefEventTarget() OVERRIDE { deref(); } |
| 85 virtual EventTargetData* eventTargetData() OVERRIDE { return &m_eventTargetD
ata; } | 89 virtual EventTargetData* eventTargetData() OVERRIDE { return &m_eventTargetD
ata; } |
| 86 virtual EventTargetData* ensureEventTargetData() OVERRIDE { return &m_eventT
argetData; } | 90 virtual EventTargetData* ensureEventTargetData() OVERRIDE { return &m_eventT
argetData; } |
| 87 | 91 |
| 88 MIDIInputVector m_inputs; | 92 MIDIInputVector m_inputs; |
| 89 MIDIOutputVector m_outputs; | 93 MIDIOutputVector m_outputs; |
| 90 EventTargetData m_eventTargetData; | 94 EventTargetData m_eventTargetData; |
| 91 MIDIAccessPromise* m_promise; | 95 MIDIAccessPromise* m_promise; |
| 92 | 96 |
| 93 OwnPtr<MIDIAccessor> m_accessor; | 97 OwnPtr<MIDIAccessor> m_accessor; |
| 94 bool m_hasAccess; | 98 bool m_hasAccess; |
| 99 MIDIOptions m_midiOptions; |
| 95 }; | 100 }; |
| 96 | 101 |
| 97 } // namespace WebCore | 102 } // namespace WebCore |
| 98 | 103 |
| 99 #endif // MIDIAccess_h | 104 #endif // MIDIAccess_h |
| OLD | NEW |