Index: content/browser/browser_main_loop.cc |
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc |
index c9a409a84366080919510b2baa62585c25cd27a8..fd67b56b58740e8999654cb2a8e1141a3dcb6d1a 100644 |
--- a/content/browser/browser_main_loop.cc |
+++ b/content/browser/browser_main_loop.cc |
@@ -507,8 +507,6 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
#endif |
BrowserGpuChannelHostFactory::Terminate(); |
- GamepadService::GetInstance()->Terminate(); |
- |
// The device monitors are using |system_monitor_| as dependency, so delete |
// them before |system_monitor_| goes away. |
// On Mac and windows, the monitor needs to be destroyed on the same thread |
@@ -608,6 +606,10 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
// more head start for those operations to finish. |
BrowserThreadImpl::ShutdownThreadPool(); |
+ // Must happen after the I/O thread is shutdown since this class lives on the |
+ // I/O thread and isn't threadsafe. |
+ GamepadService::GetInstance()->Terminate(); |
+ |
if (parts_.get()) |
parts_->PostDestroyThreads(); |
} |