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

Side by Side 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, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_SENSORS_PROVIDER_IMPL_H_
6 #define CONTENT_BROWSER_SENSORS_PROVIDER_IMPL_H_
7 #pragma once
8
9 #include "base/memory/ref_counted.h"
10 #include "base/message_loop_proxy.h"
11 #include "base/threading/thread.h"
12 #include "content/browser/sensors/provider.h"
13
14 #include <set>
15
16 template <typename T>
17 struct DefaultSingletonTraits;
18
19 namespace sensors {
20
21 class ConnectionImpl;
22
23 class ProviderImpl : public Provider {
24 public:
25 static ProviderImpl* GetInstance();
26
27 virtual Connection* Open(Listener* listener);
28
29 virtual void FireSensorChanged(Channel channel, const std::string& data);
30
31 private:
32 static const int kIIOMessageSize = 16;
33
34 ProviderImpl();
35 virtual ~ProviderImpl();
36
37 friend class DefaultSingletonTraits<ProviderImpl>;
38 DISALLOW_COPY_AND_ASSIGN(ProviderImpl);
39
40 // Quick hack to support cwolfe's IIO driver
41
42 bool IsOnDeviceThread() const;
43
44 void DeviceStart();
45 void DeviceStop();
46 void DeviceRead();
47 bool DoDeviceRead();
48
49 scoped_refptr<base::MessageLoopProxy> device_proxy_;
50 int device_fd_;
51 unsigned char device_buf_[kIIOMessageSize];
52 int device_buf_end_;
53
54 friend class ConnectionImpl;
55 void ConnectionStarted(ConnectionImpl* conn,
56 Channel channel, const std::string& data);
57 void ConnectionStopped(ConnectionImpl* conn,
58 Channel channel);
59 void ConnectionClosed(ConnectionImpl* conn);
60
61 ObserverList<ConnectionImpl, true> connections_;
62 };
63
64 } // namespace sensors
65
66 DISABLE_RUNNABLE_METHOD_REFCOUNT(sensors::ProviderImpl);
67
68 #endif // CONTENT_BROWSER_SENSORS_PROVIDER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698