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

Side by Side Diff: Source/modules/webmidi/NavigatorWebMIDI.cpp

Issue 339443004: Revert of Introduce KeepAliveWhilePending to ScriptPromiseResolverWithContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@refactor-webmidi-initialization
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/modules/webmidi/MIDIAccessInitializer.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 19 matching lines...) Expand all
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "modules/webmidi/NavigatorWebMIDI.h" 32 #include "modules/webmidi/NavigatorWebMIDI.h"
33 33
34 #include "bindings/v8/ScriptPromise.h" 34 #include "bindings/v8/ScriptPromise.h"
35 #include "bindings/v8/ScriptPromiseResolver.h" 35 #include "bindings/v8/ScriptPromiseResolver.h"
36 #include "core/dom/DOMError.h" 36 #include "core/dom/DOMError.h"
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/frame/LocalFrame.h" 38 #include "core/frame/LocalFrame.h"
39 #include "core/frame/Navigator.h" 39 #include "core/frame/Navigator.h"
40 #include "modules/webmidi/MIDIAccessInitializer.h" 40 #include "modules/webmidi/MIDIAccess.h"
41 #include "modules/webmidi/MIDIOptions.h" 41 #include "modules/webmidi/MIDIOptions.h"
42 42
43 namespace WebCore { 43 namespace WebCore {
44 44
45 NavigatorWebMIDI::NavigatorWebMIDI(LocalFrame* frame) 45 NavigatorWebMIDI::NavigatorWebMIDI(LocalFrame* frame)
46 : DOMWindowProperty(frame) 46 : DOMWindowProperty(frame)
47 { 47 {
48 } 48 }
49 49
50 NavigatorWebMIDI::~NavigatorWebMIDI() 50 NavigatorWebMIDI::~NavigatorWebMIDI()
(...skipping 23 matching lines...) Expand all
74 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, cons t Dictionary& options) 74 ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState, cons t Dictionary& options)
75 { 75 {
76 if (!frame() || frame()->document()->activeDOMObjectsAreStopped()) { 76 if (!frame() || frame()->document()->activeDOMObjectsAreStopped()) {
77 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(s criptState); 77 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(s criptState);
78 ScriptPromise promise = resolver->promise(); 78 ScriptPromise promise = resolver->promise();
79 // FIXME: Currently this rejection does not work because the context is stopped. 79 // FIXME: Currently this rejection does not work because the context is stopped.
80 resolver->reject(DOMError::create("AbortError")); 80 resolver->reject(DOMError::create("AbortError"));
81 return promise; 81 return promise;
82 } 82 }
83 83
84 return MIDIAccessInitializer::start(scriptState, MIDIOptions(options)); 84 return MIDIAccess::request(MIDIOptions(options), scriptState);
85 } 85 }
86 86
87 } // namespace WebCore 87 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/webmidi/MIDIAccessInitializer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698