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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "platform/heap/Handle.h" | 45 #include "platform/heap/Handle.h" |
46 #include "wtf/RefCounted.h" | 46 #include "wtf/RefCounted.h" |
47 #include "wtf/RefPtr.h" | 47 #include "wtf/RefPtr.h" |
48 #include "wtf/WeakPtr.h" | 48 #include "wtf/WeakPtr.h" |
49 | 49 |
50 namespace WebCore { | 50 namespace WebCore { |
51 | 51 |
52 class ExecutionContext; | 52 class ExecutionContext; |
53 | 53 |
54 class MIDIAccess FINAL : public RefCountedWillBeRefCountedGarbageCollected<MIDIA
ccess>, public ScriptWrappable, public ActiveDOMObject, public EventTargetWithIn
lineData, public MIDIAccessorClient { | 54 class MIDIAccess FINAL : public RefCountedWillBeRefCountedGarbageCollected<MIDIA
ccess>, public ScriptWrappable, public ActiveDOMObject, public EventTargetWithIn
lineData, public MIDIAccessorClient { |
55 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<M
IDIAccess>); | 55 REFCOUNTED_EVENT_TARGET(MIDIAccess); |
| 56 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess); |
56 public: | 57 public: |
57 virtual ~MIDIAccess(); | 58 virtual ~MIDIAccess(); |
58 // Returns a promise object that will be resolved with this MIDIAccess. | 59 // Returns a promise object that will be resolved with this MIDIAccess. |
59 static ScriptPromise request(const MIDIOptions&, ScriptState*); | 60 static ScriptPromise request(const MIDIOptions&, ScriptState*); |
60 | 61 |
61 MIDIInputVector inputs() const { return m_inputs; } | 62 MIDIInputVector inputs() const { return m_inputs; } |
62 MIDIOutputVector outputs() const { return m_outputs; } | 63 MIDIOutputVector outputs() const { return m_outputs; } |
63 | 64 |
64 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); | 65 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); |
65 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); | 66 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); |
(...skipping 11 matching lines...) Expand all Loading... |
77 | 78 |
78 // MIDIAccessorClient | 79 // MIDIAccessorClient |
79 virtual void didAddInputPort(const String& id, const String& manufacturer, c
onst String& name, const String& version) OVERRIDE; | 80 virtual void didAddInputPort(const String& id, const String& manufacturer, c
onst String& name, const String& version) OVERRIDE; |
80 virtual void didAddOutputPort(const String& id, const String& manufacturer,
const String& name, const String& version) OVERRIDE; | 81 virtual void didAddOutputPort(const String& id, const String& manufacturer,
const String& name, const String& version) OVERRIDE; |
81 virtual void didStartSession(bool success, const String& error, const String
& message) OVERRIDE; | 82 virtual void didStartSession(bool success, const String& error, const String
& message) OVERRIDE; |
82 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat
a, size_t length, double timeStamp) OVERRIDE; | 83 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat
a, size_t length, double timeStamp) OVERRIDE; |
83 | 84 |
84 // |timeStampInMilliseconds| is in the same time coordinate system as perfor
mance.now(). | 85 // |timeStampInMilliseconds| is in the same time coordinate system as perfor
mance.now(). |
85 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng
th, double timeStampInMilliseconds); | 86 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng
th, double timeStampInMilliseconds); |
86 | 87 |
87 void trace(Visitor*); | 88 virtual void trace(Visitor*) OVERRIDE; |
88 | 89 |
89 private: | 90 private: |
90 class PostAction; | 91 class PostAction; |
91 enum State { | 92 enum State { |
92 Requesting, | 93 Requesting, |
93 Resolved, | 94 Resolved, |
94 Stopped, | 95 Stopped, |
95 }; | 96 }; |
96 | 97 |
97 MIDIAccess(const MIDIOptions&, ExecutionContext*); | 98 MIDIAccess(const MIDIOptions&, ExecutionContext*); |
(...skipping 10 matching lines...) Expand all Loading... |
108 MIDIOutputVector m_outputs; | 109 MIDIOutputVector m_outputs; |
109 OwnPtr<MIDIAccessor> m_accessor; | 110 OwnPtr<MIDIAccessor> m_accessor; |
110 MIDIOptions m_options; | 111 MIDIOptions m_options; |
111 bool m_sysexEnabled; | 112 bool m_sysexEnabled; |
112 RefPtr<ScriptPromiseResolverWithContext> m_resolver; | 113 RefPtr<ScriptPromiseResolverWithContext> m_resolver; |
113 }; | 114 }; |
114 | 115 |
115 } // namespace WebCore | 116 } // namespace WebCore |
116 | 117 |
117 #endif // MIDIAccess_h | 118 #endif // MIDIAccess_h |
OLD | NEW |