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

Unified Diff: device/gamepad/gamepad_provider.cc

Issue 2491943002: Destroy GamepadDataFetchers on the polling thread. (Closed)
Patch Set: fix build error Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/gamepad/gamepad_provider.cc
diff --git a/device/gamepad/gamepad_provider.cc b/device/gamepad/gamepad_provider.cc
index d5dd358702c74bcdb42ada0696cce0fd2a56f6d3..701e0a41f073a1131bd2dfa13cbad0bccc564598 100644
--- a/device/gamepad/gamepad_provider.cc
+++ b/device/gamepad/gamepad_provider.cc
@@ -72,9 +72,18 @@ GamepadProvider::~GamepadProvider() {
if (monitor)
monitor->RemoveDevicesChangedObserver(this);
+ // Delete GamepadDataFetchers on |polling_thread_|. This is important because
+ // some of them require their destructor to be called on the same sequence as
+ // their other methods.
+ polling_thread_->task_runner()->PostTask(
+ FROM_HERE, base::Bind(&GamepadFetcherVector::clear,
+ base::Unretained(&data_fetchers_)));
+
// Use Stop() to join the polling thread, as there may be pending callbacks
// which dereference |polling_thread_|.
polling_thread_->Stop();
+
+ DCHECK(data_fetchers_.empty());
}
base::SharedMemoryHandle GamepadProvider::GetSharedMemoryHandleForProcess(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698