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

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

Issue 207583005: Revert of Make WebMIDI use blink Promise. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/webmidi/NavigatorWebMIDI.h ('k') | Source/modules/webmidi/NavigatorWebMIDI.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webmidi/NavigatorWebMIDI.cpp
diff --git a/Source/modules/webmidi/NavigatorWebMIDI.cpp b/Source/modules/webmidi/NavigatorWebMIDI.cpp
index 278986bea50a555b2da94945df82376a028aea27..03263b3aff62219a9da539caf24106408038ca54 100644
--- a/Source/modules/webmidi/NavigatorWebMIDI.cpp
+++ b/Source/modules/webmidi/NavigatorWebMIDI.cpp
@@ -31,14 +31,11 @@
#include "config.h"
#include "modules/webmidi/NavigatorWebMIDI.h"
-#include "bindings/v8/ScriptPromise.h"
-#include "bindings/v8/ScriptPromiseResolver.h"
-#include "core/dom/DOMError.h"
#include "core/dom/Document.h"
+#include "core/dom/ExecutionContext.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/Navigator.h"
-#include "modules/webmidi/MIDIAccess.h"
-#include "modules/webmidi/MIDIOptions.h"
+#include "modules/webmidi/MIDIAccessPromise.h"
namespace WebCore {
@@ -66,22 +63,20 @@
return *supplement;
}
-ScriptPromise NavigatorWebMIDI::requestMIDIAccess(Navigator& navigator, const Dictionary& options)
+PassRefPtrWillBeRawPtr<MIDIAccessPromise> NavigatorWebMIDI::requestMIDIAccess(Navigator& navigator, const Dictionary& options)
{
return NavigatorWebMIDI::from(navigator).requestMIDIAccess(options);
}
-ScriptPromise NavigatorWebMIDI::requestMIDIAccess(const Dictionary& options)
+PassRefPtrWillBeRawPtr<MIDIAccessPromise> NavigatorWebMIDI::requestMIDIAccess(const Dictionary& options)
{
- if (!frame()) {
- RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(v8::Isolate::GetCurrent());
- ScriptPromise promise = resolver->promise();
- // FIXME: Currently this rejection does not work because the context is stopped.
- resolver->reject(DOMError::create("AbortError"));
- return promise;
- }
+ if (!frame())
+ return nullptr;
- return MIDIAccess::request(MIDIOptions(options), frame()->document());
+ ExecutionContext* context = frame()->document();
+ ASSERT(context);
+
+ return MIDIAccessPromise::create(context, options);
}
} // namespace WebCore
« no previous file with comments | « Source/modules/webmidi/NavigatorWebMIDI.h ('k') | Source/modules/webmidi/NavigatorWebMIDI.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698