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

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

Issue 1947963003: Make deviceorientationabsolute confrom with spec on Chromium OS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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_chromeos.cc
diff --git a/content/browser/device_sensors/data_fetcher_shared_memory_chromeos.cc b/content/browser/device_sensors/data_fetcher_shared_memory_chromeos.cc
index 16abd5ebf8a96847e5f6e63ce601bcb41335b50b..d7d04ed9193879b5b399041f15c7a16f32cdf751 100644
--- a/content/browser/device_sensors/data_fetcher_shared_memory_chromeos.cc
+++ b/content/browser/device_sensors/data_fetcher_shared_memory_chromeos.cc
@@ -28,7 +28,17 @@ bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) {
sensor_manager_->StartFetchingDeviceOrientationData(
static_cast<DeviceOrientationHardwareBuffer*>(buffer));
return true;
- case CONSUMER_TYPE_ORIENTATION_ABSOLUTE:
+ case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: {
+ orientation_absolute_buffer_ =
+ static_cast<DeviceOrientationHardwareBuffer*>(buffer);
+ // Absolute device orientation not available on Chrome OS, 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:
NOTIMPLEMENTED();
return false;
@@ -44,6 +54,13 @@ bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) {
case CONSUMER_TYPE_ORIENTATION:
return sensor_manager_->StopFetchingDeviceOrientationData();
case CONSUMER_TYPE_ORIENTATION_ABSOLUTE:
+ 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:
NOTIMPLEMENTED();
return false;
« 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