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

Side by Side Diff: content/browser/device_orientation/data_fetcher_impl_win.h

Issue 18572014: Implement Android shared memory data fetcher for Device Motion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@renderer-sync-12June-tryASYNC-2-bis-tryRebase-6
Patch Set: fixed comments, added proper singleton implementation and shutdown. Created 7 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_WIN_H_ 5 #ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_WIN_H_
6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_WIN_H_ 6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_WIN_H_
7 7
8 #include <SensorsApi.h> 8 #include <SensorsApi.h>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 18 matching lines...) Expand all
29 public: 29 public:
30 virtual ~DataFetcherImplWin(); 30 virtual ~DataFetcherImplWin();
31 31
32 // Factory function. It returns NULL on error. 32 // Factory function. It returns NULL on error.
33 // The created object listens for events for the whole lifetime. 33 // The created object listens for events for the whole lifetime.
34 static DataFetcher* Create(); 34 static DataFetcher* Create();
35 35
36 // Implement DataFetcher. 36 // Implement DataFetcher.
37 virtual const DeviceData* GetDeviceData(DeviceData::Type type) OVERRIDE; 37 virtual const DeviceData* GetDeviceData(DeviceData::Type type) OVERRIDE;
38 38
39 void Stop();
40
39 private: 41 private:
40 class SensorEventSink; 42 class SensorEventSink;
41 friend SensorEventSink; 43 friend SensorEventSink;
42 44
45 static DataFetcherImplWin* instance();
46
43 DataFetcherImplWin(); 47 DataFetcherImplWin();
44 bool Initialize(); 48 bool Initialize();
45 void OnOrientationData(Orientation* orientation); 49 void OnOrientationData(Orientation* orientation);
46 const Orientation* GetOrientation(); 50 const Orientation* GetOrientation();
47 51
48 base::win::ScopedComPtr<ISensor> sensor_; 52 base::win::ScopedComPtr<ISensor> sensor_;
49 53
50 // Value returned by GetDeviceData. 54 // Value returned by GetDeviceData.
51 scoped_refptr<Orientation> current_orientation_; 55 scoped_refptr<Orientation> current_orientation_;
52 56
53 // The 1-element buffer follows DataFetcherImplAndroid implementation. 57 // The 1-element buffer follows DataFetcherImplAndroid implementation.
54 // It is written by OnOrientationData and read by GetDeviceData. 58 // It is written by OnOrientationData and read by GetDeviceData.
55 base::Lock next_orientation_lock_; 59 base::Lock next_orientation_lock_;
56 scoped_refptr<Orientation> next_orientation_; 60 scoped_refptr<Orientation> next_orientation_;
57 61
58 DISALLOW_COPY_AND_ASSIGN(DataFetcherImplWin); 62 DISALLOW_COPY_AND_ASSIGN(DataFetcherImplWin);
59 }; 63 };
60 64
61 } // namespace content 65 } // namespace content
62 66
63 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_WIN_H_ 67 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698