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

Unified Diff: athena/system/device_socket_listener.h

Issue 571283006: Revert of Use chromeos accelerometer reader and support only lid accelerometer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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 | « athena/main/athena_main.cc ('k') | athena/system/device_socket_listener.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/system/device_socket_listener.h
diff --git a/athena/system/device_socket_listener.h b/athena/system/device_socket_listener.h
new file mode 100644
index 0000000000000000000000000000000000000000..6bdb649e2c6767f8f4f24a6f98ffbc9ab684872d
--- /dev/null
+++ b/athena/system/device_socket_listener.h
@@ -0,0 +1,48 @@
+// 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_
« no previous file with comments | « athena/main/athena_main.cc ('k') | athena/system/device_socket_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698