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

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

Issue 2614943003: Remove ContextClient from NavigatorMIDI (Closed)
Patch Set: Created 3 years, 11 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 | « third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.cpp
diff --git a/third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.cpp b/third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.cpp
index 90a04e6c29b2033c88b1c55d1f48758c014ab764..2fb589694c2b765b49ed74d6d8fb50cbc576e41b 100644
--- a/third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.cpp
+++ b/third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.cpp
@@ -42,11 +42,11 @@
namespace blink {
-NavigatorWebMIDI::NavigatorWebMIDI(LocalFrame* frame) : ContextClient(frame) {}
+NavigatorWebMIDI::NavigatorWebMIDI(Navigator& navigator)
+ : Supplement<Navigator>(navigator) {}
DEFINE_TRACE(NavigatorWebMIDI) {
Supplement<Navigator>::trace(visitor);
- ContextClient::trace(visitor);
}
const char* NavigatorWebMIDI::supplementName() {
@@ -57,7 +57,7 @@ NavigatorWebMIDI& NavigatorWebMIDI::from(Navigator& navigator) {
NavigatorWebMIDI* supplement = static_cast<NavigatorWebMIDI*>(
Supplement<Navigator>::from(navigator, supplementName()));
if (!supplement) {
- supplement = new NavigatorWebMIDI(navigator.frame());
+ supplement = new NavigatorWebMIDI(navigator);
provideTo(navigator, supplementName(), supplement);
}
return *supplement;
@@ -72,14 +72,15 @@ ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState,
ScriptPromise NavigatorWebMIDI::requestMIDIAccess(ScriptState* scriptState,
const MIDIOptions& options) {
- if (!frame() || frame()->document()->isContextDestroyed()) {
+ if (!scriptState->contextIsValid()) {
haraken 2017/01/06 01:11:19 This is "mostly" equivalent to the previous check
sof 2017/01/06 07:33:33 If |scriptState| represents the script state of th
haraken 2017/01/06 08:13:35 I think the two frames should match. The user scri
sof 2017/01/06 10:21:20 agreed, thanks for clarifying.
return ScriptPromise::rejectWithDOMException(
scriptState,
DOMException::create(AbortError, "The frame is not working."));
}
- UseCounter::countCrossOriginIframe(*frame()->document(),
- UseCounter::RequestMIDIAccessIframe);
+ UseCounter::countCrossOriginIframe(
+ *toDocument(scriptState->getExecutionContext()),
+ UseCounter::RequestMIDIAccessIframe);
return MIDIAccessInitializer::start(scriptState, options);
}
« no previous file with comments | « third_party/WebKit/Source/modules/webmidi/NavigatorWebMIDI.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698