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

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

Issue 2580693003: Decouple GamepadSharedMemory into Blink.
Patch Set: Created 4 years 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/GamepadDispatcher.cpp
diff --git a/third_party/WebKit/Source/modules/gamepad/GamepadDispatcher.cpp b/third_party/WebKit/Source/modules/gamepad/GamepadDispatcher.cpp
index 21dd5af0cc058afa6701c940b1782a03324b3405..0ff0436e0e2415443a5a62a427192fd89647128b 100644
--- a/third_party/WebKit/Source/modules/gamepad/GamepadDispatcher.cpp
+++ b/third_party/WebKit/Source/modules/gamepad/GamepadDispatcher.cpp
@@ -4,6 +4,7 @@
#include "modules/gamepad/GamepadDispatcher.h"
+#include "modules/gamepad/GamepadSharedMemoryReader.h"
ke.he 2016/12/15 14:11:01 Actually the GamepadSharedMemory can be merged int
#include "modules/gamepad/NavigatorGamepad.h"
#include "public/platform/Platform.h"
@@ -50,11 +51,17 @@ void GamepadDispatcher::dispatchDidConnectOrDisconnectGamepad(
}
void GamepadDispatcher::startListening() {
- Platform::current()->startListening(WebPlatformEventTypeGamepad, this);
+ if (!m_reader.get()) {
+ m_reader.reset(new GamepadSharedMemoryReader(
+ Platform::current()->interfaceProvider()));
+ }
+ m_reader->start(this);
}
void GamepadDispatcher::stopListening() {
- Platform::current()->stopListening(WebPlatformEventTypeGamepad);
+ if (m_reader) {
+ m_reader->stop();
+ }
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698