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

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

Issue 23609033: Web MIDI: MIDIPort doesn't have to be ActiveDOMObject (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: revert idl changes Created 6 years, 10 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/MIDIOutput.idl ('k') | Source/modules/webmidi/MIDIPort.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webmidi/MIDIPort.h
diff --git a/Source/modules/webmidi/MIDIPort.h b/Source/modules/webmidi/MIDIPort.h
index 48e33b7ec7d064f07b78ac0dcd755125620f4b3d..1a8351c602cd441e52601c286a12a3a4e71dbe87 100644
--- a/Source/modules/webmidi/MIDIPort.h
+++ b/Source/modules/webmidi/MIDIPort.h
@@ -32,7 +32,6 @@
#define MIDIPort_h
#include "bindings/v8/ScriptWrappable.h"
-#include "core/dom/ActiveDOMObject.h"
#include "core/events/EventTarget.h"
#include "wtf/RefCounted.h"
#include "wtf/RefPtr.h"
@@ -40,7 +39,9 @@
namespace WebCore {
-class MIDIPort : public RefCounted<MIDIPort>, public ScriptWrappable, public ActiveDOMObject, public EventTargetWithInlineData {
+class MIDIAccess;
+
+class MIDIPort : public RefCounted<MIDIPort>, public ScriptWrappable, public EventTargetWithInlineData {
REFCOUNTED_EVENT_TARGET(MIDIPort);
public:
enum MIDIPortTypeCode {
@@ -48,7 +49,7 @@ public:
MIDIPortTypeOutput
};
- virtual ~MIDIPort();
+ virtual ~MIDIPort() { }
String id() const { return m_id; }
String manufacturer() const { return m_manufacturer; }
@@ -56,14 +57,16 @@ public:
String type() const;
String version() const { return m_version; }
+ MIDIAccess* midiAccess() const { return m_access; }
+
DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect);
// EventTarget
virtual const AtomicString& interfaceName() const OVERRIDE { return EventTargetNames::MIDIPort; }
- virtual ExecutionContext* executionContext() const OVERRIDE FINAL { return ActiveDOMObject::executionContext(); }
+ virtual ExecutionContext* executionContext() const OVERRIDE FINAL;
protected:
- MIDIPort(ExecutionContext*, const String& id, const String& manufacturer, const String& name, MIDIPortTypeCode, const String& version);
+ MIDIPort(MIDIAccess*, const String& id, const String& manufacturer, const String& name, MIDIPortTypeCode, const String& version);
private:
String m_id;
@@ -71,6 +74,10 @@ private:
String m_name;
MIDIPortTypeCode m_type;
String m_version;
+ // Hold a raw pointer to avoid a circular reference.
+ // Lifecycle is guaranteed by SetWrapperReferenceTo() IDL annotation.
+ // This will be improved by the oilpan.
+ MIDIAccess* m_access;
};
typedef Vector<RefPtr<MIDIPort> > MIDIPortVector;
« no previous file with comments | « Source/modules/webmidi/MIDIOutput.idl ('k') | Source/modules/webmidi/MIDIPort.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698