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

Unified Diff: third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp

Issue 2646383002: Use a new Supplement constructor for (Worker)Navigator supplements (Closed)
Patch Set: temp 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
Index: third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp
diff --git a/third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp b/third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp
index e148ac8cd68c293cec89db3a426e439f5b04f3f3..55f843361123679661997ab8a910b2886af227bf 100644
--- a/third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp
+++ b/third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp
@@ -82,7 +82,7 @@ NavigatorGamepad& NavigatorGamepad::from(Navigator& navigator) {
NavigatorGamepad* supplement = static_cast<NavigatorGamepad*>(
Supplement<Navigator>::from(navigator, supplementName()));
if (!supplement) {
- supplement = new NavigatorGamepad(navigator.frame());
+ supplement = new NavigatorGamepad(navigator);
provideTo(navigator, supplementName(), supplement);
}
return *supplement;
@@ -166,14 +166,17 @@ void NavigatorGamepad::dispatchOneEvent() {
m_dispatchOneEventRunner->runAsync();
}
-NavigatorGamepad::NavigatorGamepad(LocalFrame* frame)
- : ContextLifecycleObserver(frame->document()),
- PlatformEventController(frame ? frame->page() : 0),
+NavigatorGamepad::NavigatorGamepad(Navigator& navigator)
+ : Supplement<Navigator>(navigator),
+ ContextLifecycleObserver(navigator.frame() ? navigator.frame()->document()
+ : nullptr),
+ PlatformEventController(navigator.frame() ? navigator.frame()->page()
+ : nullptr),
m_dispatchOneEventRunner(AsyncMethodRunner<NavigatorGamepad>::create(
this,
&NavigatorGamepad::dispatchOneEvent)) {
- if (frame)
- frame->domWindow()->registerEventListenerObserver(this);
+ if (navigator.frame())
+ navigator.frame()->domWindow()->registerEventListenerObserver(this);
}
NavigatorGamepad::~NavigatorGamepad() {}

Powered by Google App Engine
This is Rietveld 408576698