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

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: fixed some includes 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..fd9dfcd614ec029a34aa42aa8c41399d95484228
--- /dev/null
+++ b/content/browser/device_orientation/data_fetcher_shared_memory.h
@@ -0,0 +1,50 @@
+// 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:
+ static DataFetcherSharedMemory* instance();
+
+ // 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
bulach 2013/07/09 09:03:29 nit: s/needs/Needs/ here and below..
timvolodine 2013/07/09 18:59:56 Done.
+ // 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();
+ virtual ~DataFetcherSharedMemory();
bulach 2013/07/09 09:03:29 since the only way to get one object is via "insta
timvolodine 2013/07/09 18:59:56 Done.
+
+ protected:
+ DataFetcherSharedMemory() : device_motion_buffer_(NULL) { }
+
bulach 2013/07/09 09:03:29 nit: private: (data members and the DISALLOW_* mac
timvolodine 2013/07/09 18:59:56 Done.
+ 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