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

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

Issue 171333003: Pass implementation object to supplemental classes by reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 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
Index: Source/modules/webmidi/NavigatorWebMIDI.cpp
diff --git a/Source/modules/webmidi/NavigatorWebMIDI.cpp b/Source/modules/webmidi/NavigatorWebMIDI.cpp
index ae9f39eefef3c5f9a2c1f7eed7d6f3ae3be34064..f847fd82e5456148c26312a1372d5762e6f8595b 100644
--- a/Source/modules/webmidi/NavigatorWebMIDI.cpp
+++ b/Source/modules/webmidi/NavigatorWebMIDI.cpp
@@ -53,19 +53,19 @@ const char* NavigatorWebMIDI::supplementName()
return "NavigatorWebMIDI";
}
-NavigatorWebMIDI* NavigatorWebMIDI::from(Navigator* navigator)
+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.frame());
provideTo(navigator, supplementName(), adoptPtr(supplement));
}
- return supplement;
+ return *supplement;
}
-PassRefPtrWillBeRawPtr<MIDIAccessPromise> NavigatorWebMIDI::requestMIDIAccess(Navigator* navigator, const Dictionary& options)
+PassRefPtrWillBeRawPtr<MIDIAccessPromise> NavigatorWebMIDI::requestMIDIAccess(Navigator& navigator, const Dictionary& options)
{
- return NavigatorWebMIDI::from(navigator)->requestMIDIAccess(options);
+ return NavigatorWebMIDI::from(navigator).requestMIDIAccess(options);
}
PassRefPtrWillBeRawPtr<MIDIAccessPromise> NavigatorWebMIDI::requestMIDIAccess(const Dictionary& options)

Powered by Google App Engine
This is Rietveld 408576698