summaryrefslogtreecommitdiffstats
path: root/athena
diff options
context:
space:
mode:
authorflackr <flackr@chromium.org>2014-09-17 09:19:11 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-17 16:19:49 +0000
commitb34f096d711a37bcd620113fc9d370a5ca88804b (patch)
treebdc202ab25de3b93841ed0431ade6d6ffd354b6c /athena
parent4264d2c4b5d217e1c5dbc2ae80ab6ce595f9b6d3 (diff)
downloadchromium_src-b34f096d711a37bcd620113fc9d370a5ca88804b.zip
chromium_src-b34f096d711a37bcd620113fc9d370a5ca88804b.tar.gz
chromium_src-b34f096d711a37bcd620113fc9d370a5ca88804b.tar.bz2
Reland "Use chromeos accelerometer reader and support only lid accelerometer. (patchset #3 id:60001 of https://codereview.chromium.org/574113002/)"
Relands commit and fixes compiler error. TBR=oshima,derat BUG=380831 TEST=Glimmer/clapper still work, manually tested not having a base accelerometer. Review URL: https://codereview.chromium.org/576113002 Cr-Commit-Position: refs/heads/master@{#295285}
Diffstat (limited to 'athena')
-rw-r--r--athena/athena.gyp2
-rw-r--r--athena/main/athena_launcher.cc4
-rw-r--r--athena/main/athena_main.cc5
-rw-r--r--athena/system/device_socket_listener.cc310
-rw-r--r--athena/system/device_socket_listener.h48
-rw-r--r--athena/system/orientation_controller.cc115
-rw-r--r--athena/system/orientation_controller.h47
-rw-r--r--athena/system/system_ui_impl.cc14
-rw-r--r--athena/test/athena_test_helper.cc1
9 files changed, 33 insertions, 513 deletions
diff --git a/athena/athena.gyp b/athena/athena.gyp
index 37ff404..3a8f8b0 100644
--- a/athena/athena.gyp
+++ b/athena/athena.gyp
@@ -88,8 +88,6 @@
'screen/screen_manager_impl.cc',
'system/background_controller.cc',
'system/background_controller.h',
- 'system/device_socket_listener.cc',
- 'system/device_socket_listener.h',
'system/network_selector.cc',
'system/network_selector.h',
'system/orientation_controller.cc',
diff --git a/athena/main/athena_launcher.cc b/athena/main/athena_launcher.cc
index e85975d..f971ae6 100644
--- a/athena/main/athena_launcher.cc
+++ b/athena/main/athena_launcher.cc
@@ -83,7 +83,7 @@ class VirtualKeyboardObserver : public keyboard::KeyboardControllerObserver {
DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardObserver);
};
-void StartAthenaEnv(scoped_refptr<base::TaskRunner> file_runner) {
+void StartAthenaEnv(scoped_refptr<base::TaskRunner> blocking_task_runner) {
athena::AthenaEnv::Create();
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
@@ -109,7 +109,7 @@ void StartAthenaEnv(scoped_refptr<base::TaskRunner> file_runner) {
athena::InputManager::Create()->OnRootWindowCreated(root_window);
athena::ScreenManager::Create(root_window);
- athena::SystemUI::Create(file_runner);
+ athena::SystemUI::Create(blocking_task_runner);
athena::WindowManager::Create();
athena::AppRegistry::Create();
SetupBackgroundImage();
diff --git a/athena/main/athena_main.cc b/athena/main/athena_main.cc
index da0b392..cc2cacd 100644
--- a/athena/main/athena_main.cc
+++ b/athena/main/athena_main.cc
@@ -142,8 +142,9 @@ class AthenaBrowserMainDelegate : public extensions::ShellBrowserMainDelegate {
extension_system->LoadApp(app_absolute_dir);
}
- athena::StartAthenaEnv(content::BrowserThread::GetMessageLoopProxyForThread(
- content::BrowserThread::FILE));
+ athena::StartAthenaEnv(content::BrowserThread::GetBlockingPool()->
+ GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
athena::ExtensionsDelegate::CreateExtensionsDelegateForShell(context);
athena::CreateVirtualKeyboardWithContext(context);
athena::StartAthenaSessionWithContext(context);
diff --git a/athena/system/device_socket_listener.cc b/athena/system/device_socket_listener.cc
deleted file mode 100644
index 032b3f5..0000000
--- a/athena/system/device_socket_listener.cc
+++ /dev/null
@@ -1,310 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "athena/system/device_socket_listener.h"
-
-#include <errno.h>
-#include <map>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/files/file_path.h"
-#include "base/message_loop/message_loop.h"
-#include "base/observer_list.h"
-#include "base/stl_util.h"
-#include "ipc/unix_domain_socket_util.h"
-
-namespace athena {
-
-namespace {
-
-typedef ObserverList<DeviceSocketListener> DeviceSocketListeners;
-
-// Reads from a device socket blocks of a particular size. When that amount of
-// data is read DeviceSocketManager::OnDataAvailable is called on the singleton
-// instance which then informs all of the listeners on that socket.
-class DeviceSocketReader : public base::MessagePumpLibevent::Watcher {
- public:
- DeviceSocketReader(const std::string& socket_path,
- size_t data_size)
- : socket_path_(socket_path),
- data_size_(data_size),
- data_(new char[data_size]) {
- }
- virtual ~DeviceSocketReader() {}
-
- private:
- // Overidden from base::MessagePumpLibevent::Watcher.
- virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
- virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
-
- std::string socket_path_;
- size_t data_size_;
- scoped_ptr<char[]> data_;
-
- DISALLOW_COPY_AND_ASSIGN(DeviceSocketReader);
-};
-
-class DeviceSocketManager;
-DeviceSocketManager* device_socket_manager_instance_ = NULL;
-
-// A singleton instance for managing all connections to sockets.
-class DeviceSocketManager {
- public:
- static void Create(scoped_refptr<base::TaskRunner> file_task_runner) {
- device_socket_manager_instance_ = new DeviceSocketManager(file_task_runner);
- }
-
- static void Shutdown() {
- CHECK(device_socket_manager_instance_);
- device_socket_manager_instance_->ScheduleDelete();
- // Once scheduled to be deleted, no-one should be
- // able to access it.
- device_socket_manager_instance_ = NULL;
- }
-
- static DeviceSocketManager* GetInstanceUnsafe() {
- return device_socket_manager_instance_;
- }
-
- static DeviceSocketManager* GetInstance() {
- CHECK(device_socket_manager_instance_);
- return device_socket_manager_instance_;
- }
-
- // If there isn't an existing connection to |socket_path|, then opens a
- // connection to |socket_path| and starts listening for data. All listeners
- // for |socket_path| receives data when data is available on the socket.
- void StartListening(const std::string& socket_path,
- size_t data_size,
- DeviceSocketListener* listener);
-
- // Removes |listener| from the list of listeners that receive data from
- // |socket_path|. If this is the last listener, then this closes the
- // connection to the socket.
- void StopListening(const std::string& socket_path,
- DeviceSocketListener* listener);
-
- // Sends data to all the listeners registered to receive data from
- // |socket_path|.
- void OnDataAvailable(const std::string& socket_path,
- const void* data);
-
- // Notifies listeners of errors reading from the socket and closes it.
- void OnError(const std::string& socket_path, int err);
- void OnEOF(const std::string& socket_path);
-
- private:
- struct SocketData {
- SocketData()
- : fd(-1) {
- }
-
- int fd;
- DeviceSocketListeners observers;
- scoped_ptr<base::MessagePumpLibevent::FileDescriptorWatcher> controller;
- scoped_ptr<DeviceSocketReader> watcher;
- };
-
- static void DeleteOnFILE(DeviceSocketManager* manager) { delete manager; }
-
- DeviceSocketManager(scoped_refptr<base::TaskRunner> file_task_runner)
- : file_task_runner_(file_task_runner) {}
-
- ~DeviceSocketManager() {
- STLDeleteContainerPairSecondPointers(socket_data_.begin(),
- socket_data_.end());
- }
-
- void ScheduleDelete();
-
- void StartListeningOnFILE(const std::string& socket_path,
- size_t data_size,
- DeviceSocketListener* listener);
-
- void StopListeningOnFILE(const std::string& socket_path,
- DeviceSocketListener* listener);
-
- void CloseSocket(const std::string& socket_path);
-
- std::map<std::string, SocketData*> socket_data_;
- scoped_refptr<base::TaskRunner> file_task_runner_;
-
- DISALLOW_COPY_AND_ASSIGN(DeviceSocketManager);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// DeviceSocketReader
-
-void DeviceSocketReader::OnFileCanReadWithoutBlocking(int fd) {
- ssize_t read_size = recv(fd, data_.get(), data_size_, 0);
- if (read_size < 0) {
- if (errno == EINTR)
- return;
- DeviceSocketManager::GetInstance()->OnError(socket_path_, errno);
- return;
- }
- if (read_size == 0) {
- DeviceSocketManager::GetInstance()->OnEOF(socket_path_);
- return;
- }
- if (read_size != static_cast<ssize_t>(data_size_))
- return;
- DeviceSocketManager::GetInstance()->OnDataAvailable(socket_path_,
- data_.get());
-}
-
-void DeviceSocketReader::OnFileCanWriteWithoutBlocking(int fd) {
- NOTREACHED();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// DeviceSocketManager
-
-void DeviceSocketManager::StartListening(const std::string& socket_path,
- size_t data_size,
- DeviceSocketListener* listener) {
- file_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&DeviceSocketManager::StartListeningOnFILE,
- base::Unretained(this),
- socket_path,
- data_size,
- listener));
-}
-
-void DeviceSocketManager::StopListening(const std::string& socket_path,
- DeviceSocketListener* listener) {
- file_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&DeviceSocketManager::StopListeningOnFILE,
- base::Unretained(this),
- socket_path,
- listener));
-}
-
-void DeviceSocketManager::OnDataAvailable(const std::string& socket_path,
- const void* data) {
- CHECK_GT(socket_data_.count(socket_path), 0UL);
- DeviceSocketListeners& listeners = socket_data_[socket_path]->observers;
- FOR_EACH_OBSERVER(
- DeviceSocketListener, listeners, OnDataAvailableOnFILE(data));
-}
-
-void DeviceSocketManager::CloseSocket(const std::string& socket_path) {
- if (!socket_data_.count(socket_path))
- return;
- SocketData* socket_data = socket_data_[socket_path];
- close(socket_data->fd);
- delete socket_data;
- socket_data_.erase(socket_path);
-}
-
-void DeviceSocketManager::OnError(const std::string& socket_path, int err) {
- LOG(ERROR) << "Error reading from socket: " << socket_path << ": "
- << strerror(err);
- CloseSocket(socket_path);
- // TODO(flackr): Notify listeners that the socket was closed unexpectedly.
-}
-
-void DeviceSocketManager::OnEOF(const std::string& socket_path) {
- LOG(ERROR) << "EOF reading from socket: " << socket_path;
- CloseSocket(socket_path);
-}
-
-void DeviceSocketManager::StartListeningOnFILE(const std::string& socket_path,
- size_t data_size,
- DeviceSocketListener* listener) {
- CHECK(file_task_runner_->RunsTasksOnCurrentThread());
- SocketData* socket_data = NULL;
- if (!socket_data_.count(socket_path)) {
- int socket_fd = -1;
- if (!IPC::CreateClientUnixDomainSocket(base::FilePath(socket_path),
- &socket_fd)) {
- LOG(ERROR) << "Error connecting to socket: " << socket_path;
- return;
- }
-
- socket_data = new SocketData;
- socket_data_[socket_path] = socket_data;
-
- socket_data->fd = socket_fd;
-
- socket_data->controller.reset(
- new base::MessagePumpLibevent::FileDescriptorWatcher());
- socket_data->watcher.reset(
- new DeviceSocketReader(socket_path, data_size));
-
- base::MessageLoopForIO::current()->WatchFileDescriptor(
- socket_fd,
- true,
- base::MessageLoopForIO::WATCH_READ,
- socket_data->controller.get(),
- socket_data->watcher.get());
- } else {
- socket_data = socket_data_[socket_path];
- }
- socket_data->observers.AddObserver(listener);
-}
-
-void DeviceSocketManager::StopListeningOnFILE(const std::string& socket_path,
- DeviceSocketListener* listener) {
- if (!socket_data_.count(socket_path))
- return; // Happens if unable to create a socket.
-
- CHECK(file_task_runner_->RunsTasksOnCurrentThread());
- DeviceSocketListeners& listeners = socket_data_[socket_path]->observers;
- listeners.RemoveObserver(listener);
- if (!listeners.might_have_observers()) {
- // All listeners for this socket has been removed. Close the socket.
- CloseSocket(socket_path);
- }
-}
-
-void DeviceSocketManager::ScheduleDelete() {
- // Schedule a task to delete on FILE thread because
- // there may be a task scheduled on |file_task_runner_|.
- file_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&DeleteOnFILE, base::Unretained(this)));
-}
-
-} // namespace
-
-DeviceSocketListener::DeviceSocketListener(const std::string& socket_path,
- size_t data_size)
- : socket_path_(socket_path),
- data_size_(data_size) {
-}
-
-DeviceSocketListener::~DeviceSocketListener() {
- StopListening();
-}
-
-// static
-void DeviceSocketListener::CreateSocketManager(
- scoped_refptr<base::TaskRunner> file_task_runner) {
- DeviceSocketManager::Create(file_task_runner);
-}
-
-// static
-void DeviceSocketListener::ShutdownSocketManager() {
- DeviceSocketManager::Shutdown();
-}
-
-void DeviceSocketListener::StartListening() {
- DeviceSocketManager::GetInstance()->StartListening(socket_path_,
- data_size_,
- this);
-}
-
-void DeviceSocketListener::StopListening() {
- DeviceSocketManager* instance = DeviceSocketManager::GetInstanceUnsafe();
- if (instance)
- instance->StopListening(socket_path_, this);
-}
-
-} // namespace athena
diff --git a/athena/system/device_socket_listener.h b/athena/system/device_socket_listener.h
deleted file mode 100644
index 6bdb649..0000000
--- a/athena/system/device_socket_listener.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ATHENA_SYSTEM_DEVICE_SOCKET_LISTENER_H_
-#define ATHENA_SYSTEM_DEVICE_SOCKET_LISTENER_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-
-namespace base {
-class TaskRunner;
-}
-
-namespace athena {
-
-// This class reads device-data from a socket.
-class DeviceSocketListener {
- public:
- DeviceSocketListener(const std::string& socket_parth,
- size_t data_size);
- virtual ~DeviceSocketListener();
-
- static void CreateSocketManager(
- scoped_refptr<base::TaskRunner> io_task_runner);
- static void ShutdownSocketManager();
-
- // This is called on the FILE thread when data is available on the socket.
- // |data| is guaranteed to be of exactly |data_size| length. Note that the
- // implementation must not mutate or free the data.
- virtual void OnDataAvailableOnFILE(const void* data) = 0;
-
- protected:
- void StartListening();
- void StopListening();
-
- private:
- const std::string socket_path_;
- size_t data_size_;
-
- DISALLOW_COPY_AND_ASSIGN(DeviceSocketListener);
-};
-
-} // namespace athena
-
-#endif // ATHENA_SYSTEM_DEVICE_SOCKET_LISTENER_H_
diff --git a/athena/system/orientation_controller.cc b/athena/system/orientation_controller.cc
index a4dfa1c..93d0bf1 100644
--- a/athena/system/orientation_controller.cc
+++ b/athena/system/orientation_controller.cc
@@ -14,112 +14,34 @@ namespace athena {
namespace {
-// Path of the socket which the sensor daemon creates.
-const char kSocketPath[] = "/dev/sensors/orientation";
-
// Threshold after which to rotate in a given direction.
const int kGravityThreshold = 6.0f;
-// Minimum delay before triggering another orientation change.
-const int kOrientationChangeDelayNS = 500000000;
-
-enum SensorType {
- SENSOR_ACCELEROMETER,
- SENSOR_LIGHT,
- SENSOR_PROXIMITY
-};
-
-// A sensor event from the device.
-struct DeviceSensorEvent {
- // The type of event from the SensorType enum above.
- int32_t type;
-
- // The time in nanoseconds at which the event happened.
- int64_t timestamp;
-
- union {
- // Accelerometer X,Y,Z values in SI units (m/s^2) including gravity.
- // The orientation is described at
- // http://www.html5rocks.com/en/tutorials/device/orientation/.
- float data[3];
-
- // Ambient (room) temperature in degrees Celcius.
- float temperature;
-
- // Proximity sensor distance in centimeters.
- float distance;
-
- // Ambient light level in SI lux units.
- float light;
- };
-};
-
} // namespace
-OrientationController::OrientationController()
- : DeviceSocketListener(kSocketPath, sizeof(DeviceSensorEvent)),
- last_orientation_change_time_(0),
- shutdown_(false) {
- CHECK(base::MessageLoopForUI::current());
- ui_task_runner_ = base::MessageLoopForUI::current()->task_runner();
+OrientationController::OrientationController() {
}
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> blocking_task_runner) {
+ accelerometer_reader_.reset(
+ new chromeos::AccelerometerReader(blocking_task_runner, this));
}
OrientationController::~OrientationController() {
}
void OrientationController::Shutdown() {
- CHECK(file_task_runner_.get());
- StopListening();
- file_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&OrientationController::ShutdownOnFILE, this));
-}
-
-void OrientationController::ShutdownOnFILE() {
- shutdown_ = true;
- watcher_.reset();
+ accelerometer_reader_.reset();
}
-void OrientationController::WatchForSocketPathOnFILE() {
- CHECK(base::MessageLoopForIO::current());
- if (base::PathExists(base::FilePath(kSocketPath))) {
- ui_task_runner_->PostTask(FROM_HERE,
- base::Bind(&OrientationController::StartListening, this));
- } else {
- watcher_.reset(new base::FilePathWatcher);
- watcher_->Watch(
- base::FilePath(kSocketPath),
- false,
- base::Bind(&OrientationController::OnFilePathChangedOnFILE, this));
- }
-}
-
-void OrientationController::OnFilePathChangedOnFILE(const base::FilePath& path,
- bool error) {
- watcher_.reset();
- if (error || shutdown_)
+void OrientationController::HandleAccelerometerUpdate(
+ const ui::AccelerometerUpdate& update) {
+ if (!update.has(ui::ACCELEROMETER_SOURCE_SCREEN))
return;
- ui_task_runner_->PostTask(FROM_HERE,
- base::Bind(&OrientationController::StartListening, this));
-}
-
-void OrientationController::OnDataAvailableOnFILE(const void* data) {
- const DeviceSensorEvent* event =
- static_cast<const DeviceSensorEvent*>(data);
- if (event->type != SENSOR_ACCELEROMETER)
- return;
-
- float gravity_x = event->data[0];
- float gravity_y = event->data[1];
+ float gravity_x = update.get(ui::ACCELEROMETER_SOURCE_SCREEN).x();
+ float gravity_y = update.get(ui::ACCELEROMETER_SOURCE_SCREEN).y();
gfx::Display::Rotation rotation;
if (gravity_x < -kGravityThreshold) {
rotation = gfx::Display::ROTATE_270;
@@ -134,24 +56,11 @@ void OrientationController::OnDataAvailableOnFILE(const void* data) {
return;
}
- if (rotation == current_rotation_ ||
- event->timestamp - last_orientation_change_time_ <
- kOrientationChangeDelayNS) {
+ if (rotation == current_rotation_)
return;
- }
- last_orientation_change_time_ = event->timestamp;
current_rotation_ = rotation;
- ui_task_runner_->PostTask(FROM_HERE,
- base::Bind(&OrientationController::RotateOnUI, this, rotation));
-}
-
-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
- // exist.
- if (screen_manager)
- screen_manager->SetRotation(rotation);
+ ScreenManager::Get()->SetRotation(rotation);
}
} // namespace athena
diff --git a/athena/system/orientation_controller.h b/athena/system/orientation_controller.h
index 9388788..c02a5b0 100644
--- a/athena/system/orientation_controller.h
+++ b/athena/system/orientation_controller.h
@@ -5,16 +5,14 @@
#ifndef ATHENA_SYSTEM_ORIENTATION_CONTROLLER_H_
#define ATHENA_SYSTEM_ORIENTATION_CONTROLLER_H_
-#include "athena/system/device_socket_listener.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "chromeos/accelerometer/accelerometer_reader.h"
#include "ui/gfx/display.h"
namespace base {
-class FilePath;
-class FilePathWatcher;
class TaskRunner;
}
@@ -23,50 +21,23 @@ namespace athena {
// Monitors accelerometers, detecting orientation changes. When a change is
// detected rotates the root window to match.
class OrientationController
- : public DeviceSocketListener,
- public base::RefCountedThreadSafe<OrientationController> {
+ : public chromeos::AccelerometerReader::Delegate {
public:
OrientationController();
-
- void InitWith(scoped_refptr<base::TaskRunner> file_task_runner);
-
- void Shutdown();
-
- private:
- friend class base::RefCountedThreadSafe<OrientationController>;
-
virtual ~OrientationController();
- void ShutdownOnFILE();
- // Watch for the socket path to be created, called on the FILE thread.
- void WatchForSocketPathOnFILE();
- void OnFilePathChangedOnFILE(const base::FilePath& path, bool error);
-
- // Overridden from device::DeviceSocketListener:
- virtual void OnDataAvailableOnFILE(const void* data) OVERRIDE;
+ void InitWith(scoped_refptr<base::TaskRunner> blocking_task_runner);
+ void Shutdown();
- // Rotates the display to |rotation|, called on the UI thread.
- void RotateOnUI(gfx::Display::Rotation rotation);
+ // chromeos::AccelerometerReader::Delegate
+ virtual void HandleAccelerometerUpdate(
+ const ui::AccelerometerUpdate& update) OVERRIDE;
+ private:
// The last configured rotation.
gfx::Display::Rotation current_rotation_;
- // The timestamp of the last applied orientation change.
- int64_t last_orientation_change_time_;
-
- // True if the OrientaionController has already been shutdown.
- // This is initialized on UI thread, but must be accessed / modified
- // only on FILE thread.
- bool shutdown_;
-
- // A task runner for the UI thread.
- scoped_refptr<base::TaskRunner> ui_task_runner_;
-
- // A task runner for the FILE thread.
- scoped_refptr<base::TaskRunner> file_task_runner_;
-
- // File path watcher used to detect when sensors are present.
- scoped_ptr<base::FilePathWatcher> watcher_;
+ scoped_ptr<chromeos::AccelerometerReader> accelerometer_reader_;
DISALLOW_COPY_AND_ASSIGN(OrientationController);
};
diff --git a/athena/system/system_ui_impl.cc b/athena/system/system_ui_impl.cc
index 2081921..67076e5 100644
--- a/athena/system/system_ui_impl.cc
+++ b/athena/system/system_ui_impl.cc
@@ -6,7 +6,6 @@
#include "athena/screen/public/screen_manager.h"
#include "athena/system/background_controller.h"
-#include "athena/system/device_socket_listener.h"
#include "athena/system/orientation_controller.h"
#include "athena/system/power_button_controller.h"
#include "athena/system/status_icon_container_view.h"
@@ -75,12 +74,12 @@ class SystemInfoView : public views::View {
class SystemUIImpl : public SystemUI {
public:
- SystemUIImpl(scoped_refptr<base::TaskRunner> file_task_runner)
+ SystemUIImpl(scoped_refptr<base::TaskRunner> blocking_task_runner)
: orientation_controller_(new OrientationController()),
power_button_controller_(new PowerButtonController),
background_container_(NULL),
system_modal_container_(NULL) {
- orientation_controller_->InitWith(file_task_runner);
+ orientation_controller_->InitWith(blocking_task_runner);
}
virtual ~SystemUIImpl() {
@@ -113,7 +112,7 @@ class SystemUIImpl : public SystemUI {
}
private:
- scoped_refptr<OrientationController> orientation_controller_;
+ scoped_ptr<OrientationController> orientation_controller_;
scoped_ptr<PowerButtonController> power_button_controller_;
scoped_ptr<BackgroundController> background_controller_;
@@ -129,9 +128,9 @@ class SystemUIImpl : public SystemUI {
} // namespace
// static
-SystemUI* SystemUI::Create(scoped_refptr<base::TaskRunner> file_task_runner) {
- DeviceSocketListener::CreateSocketManager(file_task_runner);
- SystemUIImpl* system_ui = new SystemUIImpl(file_task_runner);
+SystemUI* SystemUI::Create(
+ scoped_refptr<base::TaskRunner> blocking_task_runner) {
+ SystemUIImpl* system_ui = new SystemUIImpl(blocking_task_runner);
instance = system_ui;
system_ui->Init();
return instance;
@@ -148,7 +147,6 @@ void SystemUI::Shutdown() {
CHECK(instance);
delete instance;
instance = NULL;
- DeviceSocketListener::ShutdownSocketManager();
}
} // namespace athena
diff --git a/athena/test/athena_test_helper.cc b/athena/test/athena_test_helper.cc
index ec0fe2e..b20490c 100644
--- a/athena/test/athena_test_helper.cc
+++ b/athena/test/athena_test_helper.cc
@@ -60,6 +60,7 @@ void AthenaTestHelper::SetUp(ui::ContextFactory* context_factory) {
aura::test::EnvTestHelper(aura::Env::GetInstance())
.SetInputStateLookup(scoped_ptr<aura::InputStateLookup>());
+ // TODO(oshima): Use a BlockingPool task runner.
athena::StartAthenaEnv(file_thread_->message_loop_proxy());
athena::ExtensionsDelegate::CreateExtensionsDelegateForTest();
athena::StartAthenaSession(new SampleActivityFactory(),