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

Unified Diff: content/browser/device_orientation/data_fetcher_shared_memory.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: rebased 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/device_orientation/data_fetcher_shared_memory.h
diff --git a/content/browser/device_orientation/data_fetcher_shared_memory.h b/content/browser/device_orientation/data_fetcher_shared_memory.h
new file mode 100644
index 0000000000000000000000000000000000000000..a2f828364d0ce67f1611555a6603e1db1de63ba8
--- /dev/null
+++ b/content/browser/device_orientation/data_fetcher_shared_memory.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2013 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_DEVICE_ORIENTATION_DATA_FETCHER_SHARED_MEMORY_H_
+#define CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_SHARED_MEMORY_H_
+
+#include "content/browser/device_orientation/device_data.h"
+#include "content/common/device_motion_hardware_buffer.h"
+
+namespace WebKit {
+class WebDeviceMotionData;
+}
+
+namespace content {
+
+class DataFetcherSharedMemory {
+ public:
+ DataFetcherSharedMemory() : device_motion_buffer_(NULL) { }
+ virtual ~DataFetcherSharedMemory();
+
+ // Returns true if this fetcher needs explicit calls to fetch the data.
+ virtual bool NeedsPolling();
+
+ // If this fetcher NeedsPolling() is true, this method will update the
+ // buffer with the latest device motion data.
+ // This method will do nothing if NeedsPolling() is false.
+ // Returns true if there was any motion data to update the buffer with.
+ virtual bool FetchDeviceMotionDataIntoBuffer();
+
+ // Returns true if the relevant sensors could be successfully activated.
+ // This method should be called before any calls to
+ // FetchDeviceMotionDataIntoBuffer().
+ virtual bool StartFetchingDeviceMotionData(
+ DeviceMotionHardwareBuffer* buffer);
+
+ // Indicates to the fetcher to stop fetching device data.
+ virtual void StopFetchingDeviceMotionData();
+
+ private:
+ DeviceMotionHardwareBuffer* device_motion_buffer_;
+
+ DISALLOW_COPY_AND_ASSIGN(DataFetcherSharedMemory);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_SHARED_MEMORY_H_

Powered by Google App Engine
This is Rietveld 408576698