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

Unified Diff: content/browser/gamepad/gamepad_provider.cc

Issue 14328036: Implement support for USB Xbox360 controllers without a driver on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move conversions back to xbox-specific code; #if out the TYPE_UI stuff just for mac. Created 7 years, 7 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: content/browser/gamepad/gamepad_provider.cc
diff --git a/content/browser/gamepad/gamepad_provider.cc b/content/browser/gamepad/gamepad_provider.cc
index 1dad4829f8d0a11222fad76cbeea0bbcd7d257d8..b4fe67fc81e2a7e54b6f74b4f233a687263d95b9 100644
--- a/content/browser/gamepad/gamepad_provider.cc
+++ b/content/browser/gamepad/gamepad_provider.cc
@@ -113,8 +113,17 @@ void GamepadProvider::Initialize(scoped_ptr<GamepadDataFetcher> fetcher) {
memset(hwbuf, 0, sizeof(GamepadHardwareBuffer));
polling_thread_.reset(new base::Thread("Gamepad polling thread"));
- polling_thread_->StartWithOptions(
- base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
+#if defined(OS_MACOSX)
+ // On Mac, the data fetcher uses IOKit which depends on CFRunLoop, so the
+ // message loop needs to be a UI-type loop.
+ const base::MessageLoop::Type kMessageLoopType = base::MessageLoop::TYPE_UI;
+#else
+ // On Linux, the data fetcher needs to watch file descriptors, so the message
+ // loop needs to be a libevent loop. On Windows it doesn't matter what the
+ // loop is.
+ const base::MessageLoop::Type kMessageLoopType = base::MessageLoop::TYPE_IO;
+#endif
+ polling_thread_->StartWithOptions(base::Thread::Options(kMessageLoopType, 0));
polling_thread_->message_loop()->PostTask(
FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698