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

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

Issue 805263004: Oilpan: cancel MIDI permission request when prefinalizing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use a pre-finalizer instead Created 6 years 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
« no previous file with comments | « no previous file | Source/modules/webmidi/MIDIAccessInitializer.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MIDIAccessInitializer_h 5 #ifndef MIDIAccessInitializer_h
6 #define MIDIAccessInitializer_h 6 #define MIDIAccessInitializer_h
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "modules/webmidi/MIDIAccessor.h" 10 #include "modules/webmidi/MIDIAccessor.h"
11 #include "modules/webmidi/MIDIAccessorClient.h" 11 #include "modules/webmidi/MIDIAccessorClient.h"
12 #include "modules/webmidi/MIDIPort.h" 12 #include "modules/webmidi/MIDIPort.h"
13 #include "wtf/OwnPtr.h" 13 #include "wtf/OwnPtr.h"
14 #include "wtf/Vector.h" 14 #include "wtf/Vector.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class MIDIOptions; 18 class MIDIOptions;
19 class ScriptState; 19 class ScriptState;
20 20
21 class MIDIAccessInitializer : public ScriptPromiseResolver, public MIDIAccessorC lient { 21 class MIDIAccessInitializer : public ScriptPromiseResolver, public MIDIAccessorC lient {
22 #if ENABLE(OILPAN)
23 USING_PRE_FINALIZER(MIDIAccessInitializer, dispose);
haraken 2014/12/19 03:47:16 Just to confirm: The reason we cannot use WeakMemb
24 #endif
22 public: 25 public:
23 struct PortDescriptor { 26 struct PortDescriptor {
24 String id; 27 String id;
25 String manufacturer; 28 String manufacturer;
26 String name; 29 String name;
27 MIDIPort::MIDIPortTypeCode type; 30 MIDIPort::MIDIPortTypeCode type;
28 String version; 31 String version;
29 bool isActive; 32 bool isActive;
30 33
31 PortDescriptor(const String& id, const String& manufacturer, const Strin g& name, MIDIPort::MIDIPortTypeCode type, const String& version, bool isActive) 34 PortDescriptor(const String& id, const String& manufacturer, const Strin g& name, MIDIPort::MIDIPortTypeCode type, const String& version, bool isActive)
(...skipping 20 matching lines...) Expand all
52 virtual void didAddOutputPort(const String& id, const String& manufacturer, const String& name, const String& version, bool isActive) override; 55 virtual void didAddOutputPort(const String& id, const String& manufacturer, const String& name, const String& version, bool isActive) override;
53 virtual void didSetInputPortState(unsigned portIndex, bool isActive) overrid e; 56 virtual void didSetInputPortState(unsigned portIndex, bool isActive) overrid e;
54 virtual void didSetOutputPortState(unsigned portIndex, bool isActive) overri de; 57 virtual void didSetOutputPortState(unsigned portIndex, bool isActive) overri de;
55 virtual void didStartSession(bool success, const String& error, const String & message) override; 58 virtual void didStartSession(bool success, const String& error, const String & message) override;
56 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat a, size_t length, double timeStamp) override { } 59 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat a, size_t length, double timeStamp) override { }
57 60
58 void resolveSysexPermission(bool allowed); 61 void resolveSysexPermission(bool allowed);
59 SecurityOrigin* securityOrigin() const; 62 SecurityOrigin* securityOrigin() const;
60 63
61 private: 64 private:
62 ScriptPromise start();
63
64 MIDIAccessInitializer(ScriptState*, const MIDIOptions&); 65 MIDIAccessInitializer(ScriptState*, const MIDIOptions&);
65 66
66 ExecutionContext* executionContext() const; 67 ExecutionContext* executionContext() const;
68 ScriptPromise start();
69 void dispose();
67 70
68 OwnPtr<MIDIAccessor> m_accessor; 71 OwnPtr<MIDIAccessor> m_accessor;
72 Vector<PortDescriptor> m_portDescriptors;
69 bool m_requestSysex; 73 bool m_requestSysex;
70 Vector<PortDescriptor> m_portDescriptors;
71 }; 74 };
72 75
73 } // namespace blink 76 } // namespace blink
74 77
75 78
76 #endif // MIDIAccessInitializer_h 79 #endif // MIDIAccessInitializer_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/webmidi/MIDIAccessInitializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698