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

Side by Side Diff: Source/modules/webmidi/MIDIAccess.h

Issue 962523005: Web MIDI: add open() and close() to MIDIPort (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review #14 Created 5 years, 9 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M IDIAccess>); 52 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M IDIAccess>);
53 DEFINE_WRAPPERTYPEINFO(); 53 DEFINE_WRAPPERTYPEINFO();
54 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess); 54 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess);
55 public: 55 public:
56 static MIDIAccess* create(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabl ed, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext * executionContext) 56 static MIDIAccess* create(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabl ed, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext * executionContext)
57 { 57 {
58 MIDIAccess* access = new MIDIAccess(accessor, sysexEnabled, ports, execu tionContext); 58 MIDIAccess* access = new MIDIAccess(accessor, sysexEnabled, ports, execu tionContext);
59 access->suspendIfNeeded(); 59 access->suspendIfNeeded();
60 return access; 60 return access;
61 } 61 }
62 virtual ~MIDIAccess(); 62 ~MIDIAccess() override;
63 63
64 MIDIInputMap* inputs() const; 64 MIDIInputMap* inputs() const;
65 MIDIOutputMap* outputs() const; 65 MIDIOutputMap* outputs() const;
66 66
67 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); 67 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
68 68
69 bool sysexEnabled() const { return m_sysexEnabled; } 69 bool sysexEnabled() const { return m_sysexEnabled; }
70 70
71 // EventTarget 71 // EventTarget
72 virtual const AtomicString& interfaceName() const override { return EventTar getNames::MIDIAccess; } 72 const AtomicString& interfaceName() const override { return EventTargetNames ::MIDIAccess; }
73 virtual ExecutionContext* executionContext() const override { return ActiveD OMObject::executionContext(); } 73 ExecutionContext* executionContext() const override { return ActiveDOMObject ::executionContext(); }
74 74
75 // ActiveDOMObject 75 // ActiveDOMObject
76 virtual void stop() override; 76 void stop() override;
77 77
78 // MIDIAccessorClient 78 // MIDIAccessorClient
79 virtual void didAddInputPort(const String& id, const String& manufacturer, c onst String& name, const String& version, bool isActive) override; 79 void didAddInputPort(const String& id, const String& manufacturer, const Str ing& name, const String& version, MIDIAccessor::MIDIPortState) override;
80 virtual void didAddOutputPort(const String& id, const String& manufacturer, const String& name, const String& version, bool isActive) override; 80 void didAddOutputPort(const String& id, const String& manufacturer, const St ring& name, const String& version, MIDIAccessor::MIDIPortState) override;
81 virtual void didSetInputPortState(unsigned portIndex, bool isActive) overrid e; 81 void didSetInputPortState(unsigned portIndex, MIDIAccessor::MIDIPortState) o verride;
82 virtual void didSetOutputPortState(unsigned portIndex, bool isActive) overri de; 82 void didSetOutputPortState(unsigned portIndex, MIDIAccessor::MIDIPortState) override;
83 virtual void didStartSession(bool success, const String& error, const String & message) override 83 void didStartSession(bool success, const String& error, const String& messag e) override
84 { 84 {
85 // This method is for MIDIAccess initialization: MIDIAccessInitializer 85 // This method is for MIDIAccess initialization: MIDIAccessInitializer
86 // has the implementation. 86 // has the implementation.
87 ASSERT_NOT_REACHED(); 87 ASSERT_NOT_REACHED();
88 } 88 }
89 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat a, size_t length, double timeStamp) override; 89 void didReceiveMIDIData(unsigned portIndex, const unsigned char* data, size_ t length, double timeStamp) override;
90 90
91 // |timeStampInMilliseconds| is in the same time coordinate system as perfor mance.now(). 91 // |timeStampInMilliseconds| is in the same time coordinate system as perfor mance.now().
92 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng th, double timeStampInMilliseconds); 92 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng th, double timeStampInMilliseconds);
93 93
94 DECLARE_VIRTUAL_TRACE(); 94 DECLARE_VIRTUAL_TRACE();
95 95
96 private: 96 private:
97 MIDIAccess(PassOwnPtr<MIDIAccessor>, bool sysexEnabled, const Vector<MIDIAcc essInitializer::PortDescriptor>&, ExecutionContext*); 97 MIDIAccess(PassOwnPtr<MIDIAccessor>, bool sysexEnabled, const Vector<MIDIAcc essInitializer::PortDescriptor>&, ExecutionContext*);
98 98
99 OwnPtr<MIDIAccessor> m_accessor; 99 OwnPtr<MIDIAccessor> m_accessor;
100 bool m_sysexEnabled; 100 bool m_sysexEnabled;
101 HeapVector<Member<MIDIInput>> m_inputs; 101 HeapVector<Member<MIDIInput>> m_inputs;
102 HeapVector<Member<MIDIOutput>> m_outputs; 102 HeapVector<Member<MIDIOutput>> m_outputs;
103 }; 103 };
104 104
105 } // namespace blink 105 } // namespace blink
106 106
107 #endif // MIDIAccess_h 107 #endif // MIDIAccess_h
OLDNEW
« no previous file with comments | « LayoutTests/webmidi/requestmidiaccess-expected.txt ('k') | Source/modules/webmidi/MIDIAccess.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698