Chromium Code Reviews| Index: athena/system/orientation_controller.cc |
| diff --git a/athena/system/orientation_controller.cc b/athena/system/orientation_controller.cc |
| index 8996d7db1e7b601ca4b9449cc6d61c0d22b2fd33..c2912933637fb60c9ecf82622281a41344ccfe23 100644 |
| --- a/athena/system/orientation_controller.cc |
| +++ b/athena/system/orientation_controller.cc |
| @@ -64,15 +64,21 @@ OrientationController::OrientationController() |
| } |
| void OrientationController::InitWith( |
| - scoped_refptr<base::TaskRunner> io_task_runner) { |
| - io_task_runner->PostTask(FROM_HERE, base::Bind( |
| - &OrientationController::WatchForSocketPathOnIO, this)); |
| + scoped_refptr<base::TaskRunner> file_task_runner) { |
| + file_task_runner->PostTask( |
| + FROM_HERE, |
| + base::Bind(&OrientationController::WatchForSocketPathOnFILE, this)); |
| } |
| OrientationController::~OrientationController() { |
| } |
| -void OrientationController::WatchForSocketPathOnIO() { |
| +void OrientationController::StopWatchingSocketPath() { |
|
flackr
2014/08/21 03:24:55
This doesn't just stop watching for the socket pat
oshima
2014/08/21 15:03:41
Done.
|
| + StopListening(); |
| + watcher_.reset(); |
|
flackr
2014/08/21 03:24:55
I don't think this is safe, since this is now call
oshima
2014/08/21 15:03:41
Thank you for the catch. Fixed. I also added shutd
|
| +} |
| + |
| +void OrientationController::WatchForSocketPathOnFILE() { |
| CHECK(base::MessageLoopForIO::current()); |
| if (base::PathExists(base::FilePath(kSocketPath))) { |
| ui_task_runner_->PostTask(FROM_HERE, |
| @@ -80,13 +86,14 @@ void OrientationController::WatchForSocketPathOnIO() { |
| } else { |
| watcher_.reset(new base::FilePathWatcher); |
| watcher_->Watch( |
| - base::FilePath(kSocketPath), false, |
| - base::Bind(&OrientationController::OnFilePathChangedOnIO, this)); |
| + base::FilePath(kSocketPath), |
| + false, |
| + base::Bind(&OrientationController::OnFilePathChangedOnFILE, this)); |
| } |
| } |
| -void OrientationController::OnFilePathChangedOnIO(const base::FilePath& path, |
| - bool error) { |
| +void OrientationController::OnFilePathChangedOnFILE(const base::FilePath& path, |
| + bool error) { |
| watcher_.reset(); |
| if (error) |
| return; |
| @@ -95,7 +102,7 @@ void OrientationController::OnFilePathChangedOnIO(const base::FilePath& path, |
| base::Bind(&OrientationController::StartListening, this)); |
| } |
| -void OrientationController::OnDataAvailableOnIO(const void* data) { |
| +void OrientationController::OnDataAvailableOnFILE(const void* data) { |
| const DeviceSensorEvent* event = |
| static_cast<const DeviceSensorEvent*>(data); |
| if (event->type != SENSOR_ACCELEROMETER) |
| @@ -131,7 +138,7 @@ void OrientationController::OnDataAvailableOnIO(const void* data) { |
| void OrientationController::RotateOnUI(gfx::Display::Rotation rotation) { |
| ScreenManager* screen_manager = ScreenManager::Get(); |
| - // Since this is called from the IO thread, the screen manager may no longer |
| + // Since this is called from the FILE thread, the screen manager may no longer |
| // exist. |
| if (screen_manager) |
| screen_manager->SetRotation(rotation); |