Index: tools/android/forwarder2/device_forwarder_main.cc |
diff --git a/tools/android/forwarder2/device_forwarder_main.cc b/tools/android/forwarder2/device_forwarder_main.cc |
index fdf5fe54a54a0a8fd9453cdb6af0e349ab91ebbe..09790f98b5f90fc5bea5dbbd6280ba2aca233cd2 100644 |
--- a/tools/android/forwarder2/device_forwarder_main.cc |
+++ b/tools/android/forwarder2/device_forwarder_main.cc |
@@ -52,19 +52,9 @@ class ServerDelegate : public Daemon::ServerDelegate { |
if (!controller_thread_.get()) |
return; |
// The DeviceController instance, if any, is constructed on the controller |
- // thread. Make sure that it gets deleted on that same thread. Note that |
- // DeleteSoon() is not used here since it would imply reading |controller_| |
jbudorick
2016/01/08 21:41:08
I hadn't reviewed yet because I'd like to look int
Xianzhu
2016/01/08 21:47:03
I don't think the previous comment is correct. The
jbudorick
2016/01/08 22:11:37
It looks like the original would avoid that risk b
|
- // from the main thread while it's set on the internal thread. |
- controller_thread_->task_runner()->PostTask( |
- FROM_HERE, |
- base::Bind(&ServerDelegate::DeleteControllerOnInternalThread, |
- base::Unretained(this))); |
- } |
- |
- void DeleteControllerOnInternalThread() { |
- DCHECK( |
- controller_thread_->task_runner()->RunsTasksOnCurrentThread()); |
- controller_.reset(); |
+ // thread. Make sure that it gets deleted on that same thread. |
+ controller_thread_->task_runner()->DeleteSoon( |
+ FROM_HERE, controller_.release()); |
} |
// Daemon::ServerDelegate: |