Chromium Code Reviews| 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..ab86100877f4db1cdf5fd39e4503e44c8d2c86d8 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,15 @@ bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { |
| case CONSUMER_TYPE_ORIENTATION: |
| return sensor_manager_->StopFetchingDeviceOrientationData(); |
| case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: |
| + // Even though absolute device orientation is not available on Chrome OS, |
| + // properly cleanup, and fire an all-null event to blink. |
|
timvolodine
2016/05/09 18:20:41
there is no "fire event" here, maybe just remove t
jonross
2016/05/10 18:01:08
Done.
|
| + 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; |