| Index: Source/modules/webmidi/MIDIPort.h
|
| diff --git a/Source/modules/mediasource/SourceBufferList.h b/Source/modules/webmidi/MIDIPort.h
|
| similarity index 53%
|
| copy from Source/modules/mediasource/SourceBufferList.h
|
| copy to Source/modules/webmidi/MIDIPort.h
|
| index 7c5b2156c6e21f9e49cdd7af05ddddc055c0231f..4352b2c2a7bb60456ec92969b0cd9d73aa175ecf 100644
|
| --- a/Source/modules/mediasource/SourceBufferList.h
|
| +++ b/Source/modules/webmidi/MIDIPort.h
|
| @@ -1,5 +1,5 @@
|
| /*
|
| - * Copyright (C) 2012 Google Inc. All rights reserved.
|
| + * Copyright (C) 2013 Google Inc. All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions are
|
| @@ -28,59 +28,65 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef SourceBufferList_h
|
| -#define SourceBufferList_h
|
| +#ifndef MIDIPort_h
|
| +#define MIDIPort_h
|
|
|
| +#include "core/dom/ActiveDOMObject.h"
|
| #include "core/dom/EventTarget.h"
|
| #include "wtf/RefCounted.h"
|
| +#include "wtf/RefPtr.h"
|
| #include "wtf/Vector.h"
|
|
|
| namespace WebCore {
|
|
|
| -class SourceBuffer;
|
| -class GenericEventQueue;
|
| -
|
| -class SourceBufferList : public RefCounted<SourceBufferList>, public EventTarget {
|
| +class MIDIPort : public ActiveDOMObject, public RefCounted<MIDIPort>, public EventTarget {
|
| public:
|
| - static PassRefPtr<SourceBufferList> create(ScriptExecutionContext* context, GenericEventQueue* asyncEventQueue)
|
| - {
|
| - return adoptRef(new SourceBufferList(context, asyncEventQueue));
|
| - }
|
| - virtual ~SourceBufferList() { }
|
| + enum MIDIPortTypeCode {
|
| + MIDIPortTypeInput,
|
| + MIDIPortTypeOutput
|
| + };
|
|
|
| - unsigned long length() const;
|
| - SourceBuffer* item(unsigned index) const;
|
| + static PassRefPtr<MIDIPort> create(ScriptExecutionContext*, const String& id, const String& manufacturer, const String& name, MIDIPortTypeCode, const String& version);
|
| + virtual ~MIDIPort();
|
|
|
| - void add(PassRefPtr<SourceBuffer>);
|
| - bool remove(SourceBuffer*);
|
| - void clear();
|
| + String id() const { return m_id; }
|
| + String manufacturer() const { return m_manufacturer; }
|
| + String name() const { return m_name; }
|
| + String type() const;
|
| + String version() const { return m_version; }
|
|
|
| - // EventTarget interface
|
| - virtual const AtomicString& interfaceName() const OVERRIDE;
|
| - virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
|
| + using RefCounted<MIDIPort>::ref;
|
| + using RefCounted<MIDIPort>::deref;
|
|
|
| - using RefCounted<SourceBufferList>::ref;
|
| - using RefCounted<SourceBufferList>::deref;
|
| + DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect);
|
|
|
| -protected:
|
| - virtual EventTargetData* eventTargetData() OVERRIDE;
|
| - virtual EventTargetData* ensureEventTargetData() OVERRIDE;
|
| + // EventTarget
|
| + virtual const AtomicString& interfaceName() const OVERRIDE { return eventNames().interfaceForMIDIPort; }
|
| + virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE { return ActiveDOMObject::scriptExecutionContext(); }
|
|
|
| -private:
|
| - SourceBufferList(ScriptExecutionContext*, GenericEventQueue*);
|
| + // ActiveDOMObject
|
| + virtual bool canSuspend() const OVERRIDE { return true; }
|
|
|
| - void createAndFireEvent(const AtomicString&);
|
| +protected:
|
| + MIDIPort(ScriptExecutionContext*, const String& id, const String& manufacturer, const String& name, MIDIPortTypeCode, const String& version);
|
|
|
| +private:
|
| + // EventTarget
|
| virtual void refEventTarget() OVERRIDE { ref(); }
|
| virtual void derefEventTarget() OVERRIDE { deref(); }
|
| -
|
| + virtual EventTargetData* eventTargetData() OVERRIDE { return &m_eventTargetData; }
|
| + virtual EventTargetData* ensureEventTargetData() OVERRIDE { return &m_eventTargetData; }
|
| +
|
| + String m_id;
|
| + String m_manufacturer;
|
| + String m_name;
|
| + MIDIPortTypeCode m_type;
|
| + String m_version;
|
| EventTargetData m_eventTargetData;
|
| - ScriptExecutionContext* m_scriptExecutionContext;
|
| - GenericEventQueue* m_asyncEventQueue;
|
| -
|
| - Vector<RefPtr<SourceBuffer> > m_list;
|
| };
|
|
|
| +typedef Vector<RefPtr<MIDIPort> > MIDIPortVector;
|
| +
|
| } // namespace WebCore
|
|
|
| -#endif
|
| +#endif // MIDIPort_h
|
|
|