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

Unified Diff: Source/modules/webmidi/MIDIAccessInitializer.cpp

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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/webmidi/MIDIAccessInitializer.cpp
diff --git a/Source/modules/webmidi/MIDIAccessInitializer.cpp b/Source/modules/webmidi/MIDIAccessInitializer.cpp
index 7fff2affa7b652bf8ba6a71304a0d224c7b5a4fb..300f8ebd042bb0bf681999647c415a2f01291c9b 100644
--- a/Source/modules/webmidi/MIDIAccessInitializer.cpp
+++ b/Source/modules/webmidi/MIDIAccessInitializer.cpp
@@ -27,11 +27,17 @@ MIDIAccessInitializer::MIDIAccessInitializer(ScriptState* scriptState, const MID
MIDIAccessInitializer::~MIDIAccessInitializer()
{
- // It is safe to cancel a request which is already finished or canceld.
+#if !ENABLE(OILPAN)
+ dispose();
+#endif
+}
+
+void MIDIAccessInitializer::dispose()
+{
+ // It is safe to cancel a request which is already finished or cancelled.
Document* document = toDocument(executionContext());
ASSERT(document);
- MIDIController* controller = MIDIController::from(document->frame());
- if (controller)
+ if (MIDIController* controller = MIDIController::from(document->frame()))
controller->cancelSysexPermissionRequest(this);
}
@@ -46,12 +52,11 @@ ScriptPromise MIDIAccessInitializer::start()
}
Document* document = toDocument(executionContext());
ASSERT(document);
- MIDIController* controller = MIDIController::from(document->frame());
- if (controller) {
+ if (MIDIController* controller = MIDIController::from(document->frame()))
controller->requestSysexPermission(this);
- } else {
+ else
reject(DOMError::create("SecurityError"));
- }
+
return promise;
}

Powered by Google App Engine
This is Rietveld 408576698