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

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

Issue 1805843002: [v8 gc] Introduce a base class for all objects that can have pending activity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 4 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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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 MIDIAccess_h 31 #ifndef MIDIAccess_h
32 #define MIDIAccess_h 32 #define MIDIAccess_h
33 33
34 #include "bindings/core/v8/ActiveScriptWrappable.h"
34 #include "bindings/core/v8/ScriptPromise.h" 35 #include "bindings/core/v8/ScriptPromise.h"
35 #include "core/dom/ActiveDOMObject.h" 36 #include "core/dom/ActiveDOMObject.h"
36 #include "modules/EventTargetModules.h" 37 #include "modules/EventTargetModules.h"
37 #include "modules/webmidi/MIDIAccessInitializer.h" 38 #include "modules/webmidi/MIDIAccessInitializer.h"
38 #include "modules/webmidi/MIDIAccessor.h" 39 #include "modules/webmidi/MIDIAccessor.h"
39 #include "modules/webmidi/MIDIAccessorClient.h" 40 #include "modules/webmidi/MIDIAccessorClient.h"
40 #include "platform/heap/Handle.h" 41 #include "platform/heap/Handle.h"
41 #include "wtf/Vector.h" 42 #include "wtf/Vector.h"
42 43
43 namespace blink { 44 namespace blink {
44 45
45 class ExecutionContext; 46 class ExecutionContext;
46 class MIDIInput; 47 class MIDIInput;
47 class MIDIInputMap; 48 class MIDIInputMap;
48 class MIDIOutput; 49 class MIDIOutput;
49 class MIDIOutputMap; 50 class MIDIOutputMap;
50 51
51 class MIDIAccess final : public RefCountedGarbageCollectedEventTargetWithInlineD ata<MIDIAccess>, public ActiveDOMObject, public MIDIAccessorClient { 52 class MIDIAccess final : public RefCountedGarbageCollectedEventTargetWithInlineD ata<MIDIAccess>, public ActiveScriptWrappable, public ActiveDOMObject, public MI DIAccessorClient {
52 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MIDIAccess); 53 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MIDIAccess);
53 DEFINE_WRAPPERTYPEINFO(); 54 DEFINE_WRAPPERTYPEINFO();
54 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess); 55 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess);
55 public: 56 public:
56 static MIDIAccess* create(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabl ed, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext * executionContext) 57 static MIDIAccess* create(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabl ed, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext * executionContext)
57 { 58 {
58 MIDIAccess* access = new MIDIAccess(accessor, sysexEnabled, ports, execu tionContext); 59 MIDIAccess* access = new MIDIAccess(accessor, sysexEnabled, ports, execu tionContext);
59 access->suspendIfNeeded(); 60 access->suspendIfNeeded();
60 return access; 61 return access;
61 } 62 }
62 ~MIDIAccess() override; 63 ~MIDIAccess() override;
63 64
64 MIDIInputMap* inputs() const; 65 MIDIInputMap* inputs() const;
65 MIDIOutputMap* outputs() const; 66 MIDIOutputMap* outputs() const;
66 67
67 EventListener* onstatechange(); 68 EventListener* onstatechange();
68 void setOnstatechange(PassRefPtrWillBeRawPtr<EventListener>); 69 void setOnstatechange(PassRefPtrWillBeRawPtr<EventListener>);
69 70
70 bool sysexEnabled() const { return m_sysexEnabled; } 71 bool sysexEnabled() const { return m_sysexEnabled; }
71 72
72 // EventTarget 73 // EventTarget
73 const AtomicString& interfaceName() const override { return EventTargetNames ::MIDIAccess; } 74 const AtomicString& interfaceName() const override { return EventTargetNames ::MIDIAccess; }
74 ExecutionContext* getExecutionContext() const override { return ActiveDOMObj ect::getExecutionContext(); } 75 ExecutionContext* getExecutionContext() const override { return ActiveDOMObj ect::getExecutionContext(); }
75 76
77 // ActiveScriptWrappable
78 bool hasPendingActivity() const final;
79
76 // ActiveDOMObject 80 // ActiveDOMObject
77 bool hasPendingActivity() const override;
78 void stop() override; 81 void stop() override;
79 82
80 // MIDIAccessorClient 83 // MIDIAccessorClient
81 void didAddInputPort(const String& id, const String& manufacturer, const Str ing& name, const String& version, MIDIAccessor::MIDIPortState) override; 84 void didAddInputPort(const String& id, const String& manufacturer, const Str ing& name, const String& version, MIDIAccessor::MIDIPortState) override;
82 void didAddOutputPort(const String& id, const String& manufacturer, const St ring& name, const String& version, MIDIAccessor::MIDIPortState) override; 85 void didAddOutputPort(const String& id, const String& manufacturer, const St ring& name, const String& version, MIDIAccessor::MIDIPortState) override;
83 void didSetInputPortState(unsigned portIndex, MIDIAccessor::MIDIPortState) o verride; 86 void didSetInputPortState(unsigned portIndex, MIDIAccessor::MIDIPortState) o verride;
84 void didSetOutputPortState(unsigned portIndex, MIDIAccessor::MIDIPortState) override; 87 void didSetOutputPortState(unsigned portIndex, MIDIAccessor::MIDIPortState) override;
85 void didStartSession(bool success, const String& error, const String& messag e) override 88 void didStartSession(bool success, const String& error, const String& messag e) override
86 { 89 {
87 // This method is for MIDIAccess initialization: MIDIAccessInitializer 90 // This method is for MIDIAccess initialization: MIDIAccessInitializer
(...skipping 17 matching lines...) Expand all
105 OwnPtr<MIDIAccessor> m_accessor; 108 OwnPtr<MIDIAccessor> m_accessor;
106 bool m_sysexEnabled; 109 bool m_sysexEnabled;
107 bool m_hasPendingActivity; 110 bool m_hasPendingActivity;
108 HeapVector<Member<MIDIInput>> m_inputs; 111 HeapVector<Member<MIDIInput>> m_inputs;
109 HeapVector<Member<MIDIOutput>> m_outputs; 112 HeapVector<Member<MIDIOutput>> m_outputs;
110 }; 113 };
111 114
112 } // namespace blink 115 } // namespace blink
113 116
114 #endif // MIDIAccess_h 117 #endif // MIDIAccess_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698