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

Unified Diff: content/browser/device_orientation/data_fetcher_shared_memory_default.cc

Issue 19833005: Implement PollingThread for Device Motion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed comments 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_default.cc
diff --git a/content/browser/device_orientation/data_fetcher_shared_memory_default.cc b/content/browser/device_orientation/data_fetcher_shared_memory_default.cc
index 819605cb8abbfbe2728dd7e01bc4bc1f029ca102..0f66fc797730a0d4a1751f31e1f54e005b39b92e 100644
--- a/content/browser/device_orientation/data_fetcher_shared_memory_default.cc
+++ b/content/browser/device_orientation/data_fetcher_shared_memory_default.cc
@@ -9,7 +9,8 @@
namespace content {
DataFetcherSharedMemory::~DataFetcherSharedMemory() {
- StopFetchingDeviceMotionData();
+ if (started_)
+ StopFetchingDeviceMotionData();
}
bool DataFetcherSharedMemory::NeedsPolling() {
@@ -24,9 +25,11 @@ bool DataFetcherSharedMemory::FetchDeviceMotionDataIntoBuffer() {
bool DataFetcherSharedMemory::StartFetchingDeviceMotionData(
DeviceMotionHardwareBuffer* buffer) {
DCHECK(buffer);
+ device_motion_buffer_ = buffer;
device_motion_buffer_->seqlock.WriteBegin();
device_motion_buffer_->data.allAvailableSensorsAreActive = true;
device_motion_buffer_->seqlock.WriteEnd();
+ started_ = true;
return true;
}
@@ -34,6 +37,7 @@ void DataFetcherSharedMemory::StopFetchingDeviceMotionData() {
device_motion_buffer_->seqlock.WriteBegin();
device_motion_buffer_->data.allAvailableSensorsAreActive = false;
device_motion_buffer_->seqlock.WriteEnd();
+ started_ = false;
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698