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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/modules/webmidi/MIDIOutput.idl ('k') | Source/modules/webmidi/MIDIPort.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef MIDIPort_h 31 #ifndef MIDIPort_h
32 #define MIDIPort_h 32 #define MIDIPort_h
33 33
34 #include "bindings/v8/ScriptWrappable.h" 34 #include "bindings/v8/ScriptWrappable.h"
35 #include "core/dom/ActiveDOMObject.h"
36 #include "core/events/EventTarget.h" 35 #include "core/events/EventTarget.h"
37 #include "wtf/RefCounted.h" 36 #include "wtf/RefCounted.h"
38 #include "wtf/RefPtr.h" 37 #include "wtf/RefPtr.h"
39 #include "wtf/Vector.h" 38 #include "wtf/Vector.h"
40 39
41 namespace WebCore { 40 namespace WebCore {
42 41
43 class MIDIPort : public RefCounted<MIDIPort>, public ScriptWrappable, public Act iveDOMObject, public EventTargetWithInlineData { 42 class MIDIAccess;
43
44 class MIDIPort : public RefCounted<MIDIPort>, public ScriptWrappable, public Eve ntTargetWithInlineData {
44 REFCOUNTED_EVENT_TARGET(MIDIPort); 45 REFCOUNTED_EVENT_TARGET(MIDIPort);
45 public: 46 public:
46 enum MIDIPortTypeCode { 47 enum MIDIPortTypeCode {
47 MIDIPortTypeInput, 48 MIDIPortTypeInput,
48 MIDIPortTypeOutput 49 MIDIPortTypeOutput
49 }; 50 };
50 51
51 virtual ~MIDIPort(); 52 virtual ~MIDIPort() { }
52 53
53 String id() const { return m_id; } 54 String id() const { return m_id; }
54 String manufacturer() const { return m_manufacturer; } 55 String manufacturer() const { return m_manufacturer; }
55 String name() const { return m_name; } 56 String name() const { return m_name; }
56 String type() const; 57 String type() const;
57 String version() const { return m_version; } 58 String version() const { return m_version; }
58 59
60 MIDIAccess* midiAccess() const { return m_access; }
61
59 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); 62 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect);
60 63
61 // EventTarget 64 // EventTarget
62 virtual const AtomicString& interfaceName() const OVERRIDE { return EventTar getNames::MIDIPort; } 65 virtual const AtomicString& interfaceName() const OVERRIDE { return EventTar getNames::MIDIPort; }
63 virtual ExecutionContext* executionContext() const OVERRIDE FINAL { return A ctiveDOMObject::executionContext(); } 66 virtual ExecutionContext* executionContext() const OVERRIDE FINAL;
64 67
65 protected: 68 protected:
66 MIDIPort(ExecutionContext*, const String& id, const String& manufacturer, co nst String& name, MIDIPortTypeCode, const String& version); 69 MIDIPort(MIDIAccess*, const String& id, const String& manufacturer, const St ring& name, MIDIPortTypeCode, const String& version);
67 70
68 private: 71 private:
69 String m_id; 72 String m_id;
70 String m_manufacturer; 73 String m_manufacturer;
71 String m_name; 74 String m_name;
72 MIDIPortTypeCode m_type; 75 MIDIPortTypeCode m_type;
73 String m_version; 76 String m_version;
77 // Hold a raw pointer to avoid a circular reference.
78 // Lifecycle is guaranteed by SetWrapperReferenceTo() IDL annotation.
79 // This will be improved by the oilpan.
80 MIDIAccess* m_access;
74 }; 81 };
75 82
76 typedef Vector<RefPtr<MIDIPort> > MIDIPortVector; 83 typedef Vector<RefPtr<MIDIPort> > MIDIPortVector;
77 84
78 } // namespace WebCore 85 } // namespace WebCore
79 86
80 #endif // MIDIPort_h 87 #endif // MIDIPort_h
OLDNEW
« 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