Index: trunk/src/athena/system/orientation_controller.cc |
=================================================================== |
--- trunk/src/athena/system/orientation_controller.cc (revision 291393) |
+++ trunk/src/athena/system/orientation_controller.cc (working copy) |
@@ -58,37 +58,21 @@ |
OrientationController::OrientationController() |
: DeviceSocketListener(kSocketPath, sizeof(DeviceSensorEvent)), |
- last_orientation_change_time_(0), |
- shutdown_(false) { |
+ last_orientation_change_time_(0) { |
CHECK(base::MessageLoopForUI::current()); |
ui_task_runner_ = base::MessageLoopForUI::current()->task_runner(); |
} |
void OrientationController::InitWith( |
- scoped_refptr<base::TaskRunner> file_task_runner) { |
- file_task_runner_ = file_task_runner; |
- file_task_runner->PostTask( |
- FROM_HERE, |
- base::Bind(&OrientationController::WatchForSocketPathOnFILE, this)); |
+ scoped_refptr<base::TaskRunner> io_task_runner) { |
+ io_task_runner->PostTask(FROM_HERE, base::Bind( |
+ &OrientationController::WatchForSocketPathOnIO, this)); |
} |
OrientationController::~OrientationController() { |
} |
-void OrientationController::Shutdown() { |
- CHECK(file_task_runner_); |
- StopListening(); |
- file_task_runner_->PostTask( |
- FROM_HERE, |
- base::Bind(&OrientationController::ShutdownOnFILE, this)); |
-} |
- |
-void OrientationController::ShutdownOnFILE() { |
- shutdown_ = true; |
- watcher_.reset(); |
-} |
- |
-void OrientationController::WatchForSocketPathOnFILE() { |
+void OrientationController::WatchForSocketPathOnIO() { |
CHECK(base::MessageLoopForIO::current()); |
if (base::PathExists(base::FilePath(kSocketPath))) { |
ui_task_runner_->PostTask(FROM_HERE, |
@@ -96,23 +80,22 @@ |
} else { |
watcher_.reset(new base::FilePathWatcher); |
watcher_->Watch( |
- base::FilePath(kSocketPath), |
- false, |
- base::Bind(&OrientationController::OnFilePathChangedOnFILE, this)); |
+ base::FilePath(kSocketPath), false, |
+ base::Bind(&OrientationController::OnFilePathChangedOnIO, this)); |
} |
} |
-void OrientationController::OnFilePathChangedOnFILE(const base::FilePath& path, |
- bool error) { |
+void OrientationController::OnFilePathChangedOnIO(const base::FilePath& path, |
+ bool error) { |
watcher_.reset(); |
- if (error || shutdown_) |
+ if (error) |
return; |
ui_task_runner_->PostTask(FROM_HERE, |
base::Bind(&OrientationController::StartListening, this)); |
} |
-void OrientationController::OnDataAvailableOnFILE(const void* data) { |
+void OrientationController::OnDataAvailableOnIO(const void* data) { |
const DeviceSensorEvent* event = |
static_cast<const DeviceSensorEvent*>(data); |
if (event->type != SENSOR_ACCELEROMETER) |
@@ -148,7 +131,7 @@ |
void OrientationController::RotateOnUI(gfx::Display::Rotation rotation) { |
ScreenManager* screen_manager = ScreenManager::Get(); |
- // Since this is called from the FILE thread, the screen manager may no longer |
+ // Since this is called from the IO thread, the screen manager may no longer |
// exist. |
if (screen_manager) |
screen_manager->SetRotation(rotation); |