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

Unified Diff: content/browser/device_sensors/data_fetcher_shared_memory_mac.cc

Issue 1915273003: [Mac] Make deviceorientationabsolute implementation conform with the specification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add code in Stop() and set absolute to true Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/device_sensors/data_fetcher_shared_memory_mac.cc
diff --git a/content/browser/device_sensors/data_fetcher_shared_memory_mac.cc b/content/browser/device_sensors/data_fetcher_shared_memory_mac.cc
index c8b37986c7d8bddeddfc27f1041f48f5a64f568b..1af22c358cdf59ed8076ed2045cc5c526a680eea 100644
--- a/content/browser/device_sensors/data_fetcher_shared_memory_mac.cc
+++ b/content/browser/device_sensors/data_fetcher_shared_memory_mac.cc
@@ -204,8 +204,15 @@ bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) {
return sudden_motion_sensor_available;
}
case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: {
- NOTIMPLEMENTED();
- break;
+ orientation_absolute_buffer_ =
+ static_cast<DeviceOrientationHardwareBuffer*>(buffer);
+ // Absolute device orientation not available on Mac, let the
+ // implementation fire an all-null event to signal this to blink.
+ orientation_absolute_buffer_->seqlock.WriteBegin();
+ orientation_absolute_buffer_->data.absolute = true;
+ orientation_absolute_buffer_->data.allAvailableSensorsAreActive = true;
+ orientation_absolute_buffer_->seqlock.WriteEnd();
+ return false;
}
case CONSUMER_TYPE_LIGHT: {
if (!ambient_light_sensor_)
@@ -248,8 +255,13 @@ bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) {
}
return true;
case CONSUMER_TYPE_ORIENTATION_ABSOLUTE:
- NOTIMPLEMENTED();
- break;
+ if (orientation_absolute_buffer_) {
+ orientation_absolute_buffer_->seqlock.WriteBegin();
+ orientation_absolute_buffer_->data.allAvailableSensorsAreActive = false;
+ orientation_absolute_buffer_->seqlock.WriteEnd();
+ orientation_absolute_buffer_ = nullptr;
+ }
+ return true;
case CONSUMER_TYPE_LIGHT:
if (light_buffer_) {
light_buffer_->seqlock.WriteBegin();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698