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

Unified Diff: Source/modules/webmidi/MIDIPort.cpp

Issue 13843021: Web MIDI: implement MIDIPort (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: (rebase) Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/webmidi/MIDIPort.h ('k') | Source/modules/webmidi/MIDIPort.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webmidi/MIDIPort.cpp
diff --git a/Source/core/css/CSSFontFaceLoadEvent.cpp b/Source/modules/webmidi/MIDIPort.cpp
similarity index 61%
copy from Source/core/css/CSSFontFaceLoadEvent.cpp
copy to Source/modules/webmidi/MIDIPort.cpp
index 014488a181c823a3b125195e26d09aff666bc95b..9ffa57a6ee304e71d033344806f49e0efdc45a57 100644
--- a/Source/core/css/CSSFontFaceLoadEvent.cpp
+++ b/Source/modules/webmidi/MIDIPort.cpp
@@ -29,38 +29,45 @@
*/
#include "config.h"
-#include "CSSFontFaceLoadEvent.h"
tkent 2013/04/25 04:08:12 This blank line is unnecessary. http://dev.chromiu
-namespace WebCore {
+#include "modules/webmidi/MIDIPort.h"
-CSSFontFaceLoadEvent::CSSFontFaceLoadEvent()
-{
- ScriptWrappable::init(this);
-}
+namespace WebCore {
-CSSFontFaceLoadEvent::CSSFontFaceLoadEvent(const AtomicString& type, PassRefPtr<CSSFontFaceRule> fontface, PassRefPtr<DOMError> error)
- : Event(type, false, false)
- , m_fontface(fontface)
- , m_error(error)
+PassRefPtr<MIDIPort> MIDIPort::create(ScriptExecutionContext* context, const String& id, const String& manufacturer, const String& name, MIDIPortTypeCode type, const String& version)
{
- ScriptWrappable::init(this);
+ RefPtr<MIDIPort> midiPort(adoptRef(new MIDIPort(context, id, manufacturer, name, type, version)));
+ midiPort->suspendIfNeeded();
+ return midiPort.release();
}
-CSSFontFaceLoadEvent::CSSFontFaceLoadEvent(const AtomicString& type, const CSSFontFaceLoadEventInit& initializer)
- : Event(type, initializer)
- , m_fontface(initializer.fontface)
- , m_error(initializer.error)
+MIDIPort::MIDIPort(ScriptExecutionContext* context, const String& id, const String& manufacturer, const String& name, MIDIPortTypeCode type, const String& version)
+ : ActiveDOMObject(context)
+ , m_id(id)
+ , m_manufacturer(manufacturer)
+ , m_name(name)
+ , m_type(type)
+ , m_version(version)
{
- ScriptWrappable::init(this);
+ ASSERT(type == MIDIPortTypeInput || type == MIDIPortTypeOutput);
}
-CSSFontFaceLoadEvent::~CSSFontFaceLoadEvent()
+MIDIPort::~MIDIPort()
{
+ stop();
}
-const AtomicString& CSSFontFaceLoadEvent::interfaceName() const
+String MIDIPort::type() const
{
- return eventNames().interfaceForCSSFontFaceLoadEvent;
+ switch (m_type) {
+ case MIDIPortTypeInput:
+ return "input";
tkent 2013/04/25 04:08:12 Please use ASCIILiteral("input")
+ case MIDIPortTypeOutput:
+ return "output";
tkent 2013/04/25 04:08:12 Ditto.
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ return "";
tkent 2013/04/25 04:08:12 Use emptyString().
}
} // namespace WebCore
« no previous file with comments | « Source/modules/webmidi/MIDIPort.h ('k') | Source/modules/webmidi/MIDIPort.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698