| 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_
|
|
|