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

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

Issue 19833005: Implement PollingThread for Device Motion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed compilation issues 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_SHARED_MEMORY_H_ 5 #ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_SHARED_MEMORY_H_
6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_SHARED_MEMORY_H_ 6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_SHARED_MEMORY_H_
7 7
8 #include "content/browser/device_orientation/device_data.h" 8 #include "content/browser/device_orientation/device_data.h"
9 #include "content/common/device_motion_hardware_buffer.h" 9 #include "content/common/device_motion_hardware_buffer.h"
10 10
11 namespace WebKit { 11 namespace WebKit {
12 class WebDeviceMotionData; 12 class WebDeviceMotionData;
13 } 13 }
14 14
15 namespace content { 15 namespace content {
16 16
17 class DataFetcherSharedMemory { 17 class CONTENT_EXPORT DataFetcherSharedMemory {
piman 2013/07/26 17:47:48 This class is now used from multiple threads. Plea
timvolodine 2013/07/29 12:06:25 Done.
18 public: 18 public:
19 DataFetcherSharedMemory() : device_motion_buffer_(NULL) { } 19 DataFetcherSharedMemory()
20 : device_motion_buffer_(NULL),
21 started_(false) { }
20 virtual ~DataFetcherSharedMemory(); 22 virtual ~DataFetcherSharedMemory();
21 23
22 // Returns true if this fetcher needs explicit calls to fetch the data. 24 // Returns true if this fetcher needs explicit calls to fetch the data.
23 virtual bool NeedsPolling(); 25 virtual bool NeedsPolling();
24 26
25 // If this fetcher NeedsPolling() is true, this method will update the 27 // If this fetcher NeedsPolling() is true, this method will update the
26 // buffer with the latest device motion data. 28 // buffer with the latest device motion data.
27 // This method will do nothing if NeedsPolling() is false. 29 // This method will do nothing if NeedsPolling() is false.
28 // Returns true if there was any motion data to update the buffer with. 30 // Returns true if there was any motion data to update the buffer with.
29 virtual bool FetchDeviceMotionDataIntoBuffer(); 31 virtual bool FetchDeviceMotionDataIntoBuffer();
30 32
31 // Returns true if the relevant sensors could be successfully activated. 33 // Returns true if the relevant sensors could be successfully activated.
32 // This method should be called before any calls to 34 // This method should be called before any calls to
33 // FetchDeviceMotionDataIntoBuffer(). 35 // FetchDeviceMotionDataIntoBuffer().
34 virtual bool StartFetchingDeviceMotionData( 36 virtual bool StartFetchingDeviceMotionData(
35 DeviceMotionHardwareBuffer* buffer); 37 DeviceMotionHardwareBuffer* buffer);
36 38
37 // Indicates to the fetcher to stop fetching device data. 39 // Indicates to the fetcher to stop fetching device data.
38 virtual void StopFetchingDeviceMotionData(); 40 virtual void StopFetchingDeviceMotionData();
39 41
40 private: 42 private:
41 DeviceMotionHardwareBuffer* device_motion_buffer_; 43 DeviceMotionHardwareBuffer* device_motion_buffer_;
44 bool started_;
42 45
43 DISALLOW_COPY_AND_ASSIGN(DataFetcherSharedMemory); 46 DISALLOW_COPY_AND_ASSIGN(DataFetcherSharedMemory);
44 }; 47 };
45 48
46 } // namespace content 49 } // namespace content
47 50
48 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_SHARED_MEMORY_H_ 51 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_SHARED_MEMORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698