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

Unified Diff: content/browser/sensors/provider_impl.h

Issue 7273073: Animated Rotation (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 6 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
Index: content/browser/sensors/provider_impl.h
diff --git a/content/browser/sensors/provider_impl.h b/content/browser/sensors/provider_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..d51b1d1436318b32f9dd6f364badfb9daf270cf9
--- /dev/null
+++ b/content/browser/sensors/provider_impl.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2011 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 CONTENT_BROWSER_SENSORS_PROVIDER_IMPL_H_
+#define CONTENT_BROWSER_SENSORS_PROVIDER_IMPL_H_
+#pragma once
+
+#include "base/memory/ref_counted.h"
+#include "base/message_loop_proxy.h"
+#include "base/threading/thread.h"
+#include "content/browser/sensors/provider.h"
+
+#include <set>
+
+template <typename T>
+struct DefaultSingletonTraits;
+
+namespace sensors {
+
+class ConnectionImpl;
+
+class ProviderImpl : public Provider {
+ public:
+ static ProviderImpl* GetInstance();
+
+ virtual Connection* Open(Listener* listener);
+
+ virtual void FireSensorChanged(Channel channel, const std::string& data);
+
+ private:
+ static const int kIIOMessageSize = 16;
+
+ ProviderImpl();
+ virtual ~ProviderImpl();
+
+ friend class DefaultSingletonTraits<ProviderImpl>;
+ DISALLOW_COPY_AND_ASSIGN(ProviderImpl);
+
+ // Quick hack to support cwolfe's IIO driver
+
+ bool IsOnDeviceThread() const;
+
+ void DeviceStart();
+ void DeviceStop();
+ void DeviceRead();
+ bool DoDeviceRead();
+
+ scoped_refptr<base::MessageLoopProxy> device_proxy_;
+ int device_fd_;
+ unsigned char device_buf_[kIIOMessageSize];
+ int device_buf_end_;
+
+ friend class ConnectionImpl;
+ void ConnectionStarted(ConnectionImpl* conn,
+ Channel channel, const std::string& data);
+ void ConnectionStopped(ConnectionImpl* conn,
+ Channel channel);
+ void ConnectionClosed(ConnectionImpl* conn);
+
+ ObserverList<ConnectionImpl, true> connections_;
+};
+
+} // namespace sensors
+
+DISABLE_RUNNABLE_METHOD_REFCOUNT(sensors::ProviderImpl);
+
+#endif // CONTENT_BROWSER_SENSORS_PROVIDER_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698