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

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

Issue 1876703002: Oilpan: Replace EAGERLY_FINALIZE in EventTarget's hierarchy with pre-finalizers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 using PortState = MIDIAccessor::MIDIPortState; 48 using PortState = MIDIAccessor::MIDIPortState;
49 49
50 MIDIAccess::MIDIAccess(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabled, con st Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext* execu tionContext) 50 MIDIAccess::MIDIAccess(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabled, con st Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext* execu tionContext)
51 : ActiveScriptWrappable(this) 51 : ActiveScriptWrappable(this)
52 , ActiveDOMObject(executionContext) 52 , ActiveDOMObject(executionContext)
53 , m_accessor(accessor) 53 , m_accessor(accessor)
54 , m_sysexEnabled(sysexEnabled) 54 , m_sysexEnabled(sysexEnabled)
55 , m_hasPendingActivity(false) 55 , m_hasPendingActivity(false)
56 { 56 {
57 ThreadState::current()->registerPreFinalizer(this);
57 m_accessor->setClient(this); 58 m_accessor->setClient(this);
58 for (size_t i = 0; i < ports.size(); ++i) { 59 for (size_t i = 0; i < ports.size(); ++i) {
59 const MIDIAccessInitializer::PortDescriptor& port = ports[i]; 60 const MIDIAccessInitializer::PortDescriptor& port = ports[i];
60 if (port.type == MIDIPort::TypeInput) { 61 if (port.type == MIDIPort::TypeInput) {
61 m_inputs.append(MIDIInput::create(this, port.id, port.manufacturer, port.name, port.version, port.state)); 62 m_inputs.append(MIDIInput::create(this, port.id, port.manufacturer, port.name, port.version, port.state));
62 } else { 63 } else {
63 m_outputs.append(MIDIOutput::create(this, m_outputs.size(), port.id, port.manufacturer, port.name, port.version, port.state)); 64 m_outputs.append(MIDIOutput::create(this, m_outputs.size(), port.id, port.manufacturer, port.name, port.version, port.state));
64 } 65 }
65 } 66 }
66 } 67 }
67 68
68 MIDIAccess::~MIDIAccess() 69 MIDIAccess::~MIDIAccess()
69 { 70 {
70 } 71 }
71 72
73 void MIDIAccess::dispose()
74 {
75 m_accessor.clear();
76 }
77
72 EventListener* MIDIAccess::onstatechange() 78 EventListener* MIDIAccess::onstatechange()
73 { 79 {
74 return getAttributeEventListener(EventTypeNames::statechange); 80 return getAttributeEventListener(EventTypeNames::statechange);
75 } 81 }
76 82
77 void MIDIAccess::setOnstatechange(RawPtr<EventListener> listener) 83 void MIDIAccess::setOnstatechange(RawPtr<EventListener> listener)
78 { 84 {
79 m_hasPendingActivity = listener; 85 m_hasPendingActivity = listener;
80 setAttributeEventListener(EventTypeNames::statechange, listener); 86 setAttributeEventListener(EventTypeNames::statechange, listener);
81 } 87 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 208
203 DEFINE_TRACE(MIDIAccess) 209 DEFINE_TRACE(MIDIAccess)
204 { 210 {
205 visitor->trace(m_inputs); 211 visitor->trace(m_inputs);
206 visitor->trace(m_outputs); 212 visitor->trace(m_outputs);
207 RefCountedGarbageCollectedEventTargetWithInlineData<MIDIAccess>::trace(visit or); 213 RefCountedGarbageCollectedEventTargetWithInlineData<MIDIAccess>::trace(visit or);
208 ActiveDOMObject::trace(visitor); 214 ActiveDOMObject::trace(visitor);
209 } 215 }
210 216
211 } // namespace blink 217 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webmidi/MIDIAccess.h ('k') | third_party/WebKit/Source/modules/webusb/USB.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698