Index: Source/modules/webmidi/MIDIAccessInitializer.cpp |
diff --git a/Source/modules/webmidi/MIDIAccessInitializer.cpp b/Source/modules/webmidi/MIDIAccessInitializer.cpp |
index 36d4b00cfd07e27b9eaeafeb009bca442a3078a4..b1fda8518b9de403711e7e3cf868bc9992bff26a 100644 |
--- a/Source/modules/webmidi/MIDIAccessInitializer.cpp |
+++ b/Source/modules/webmidi/MIDIAccessInitializer.cpp |
@@ -22,6 +22,14 @@ MIDIAccessInitializer::MIDIAccessInitializer(ScriptState* scriptState, const MID |
, m_requestSysex(false) |
{ |
#if ENABLE(OILPAN) |
+ // A prefinalizer has already been registered (as a LifecycleObserver); |
+ // remove it and register a combined one, as the infrastructure doesn't |
+ // support multiple prefinalizers for an object. |
+ // |
+ // FIXME: Oilpan: remove LifecycleObserver's need for a prefinalizer, |
+ // and as a consequence, this unregistration step. If the former is independently |
+ // removed, the unregisterPreFinalizer() call will assert. |
+ ThreadState::current()->unregisterPreFinalizer(*static_cast<LifecycleObserver*>(this)); |
ThreadState::current()->registerPreFinalizer(*this); |
#endif |
if (options.hasSysex()) |
@@ -42,6 +50,11 @@ void MIDIAccessInitializer::dispose() |
ASSERT(document); |
if (MIDIController* controller = MIDIController::from(document->frame())) |
controller->cancelSysexPermissionRequest(this); |
+ |
+#if ENABLE(OILPAN) |
+ // Delegate to LifecycleObserver's prefinalizer. |
+ LifecycleObserver::dispose(); |
+#endif |
} |
ScriptPromise MIDIAccessInitializer::start() |