| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/device_sensors/data_fetcher_shared_memory.h" | 5 #include "device/sensors/data_fetcher_shared_memory.h" |
| 6 | 6 |
| 7 #include <GuidDef.h> | 7 #include <GuidDef.h> |
| 8 #include <InitGuid.h> | 8 #include <InitGuid.h> |
| 9 #include <PortableDeviceTypes.h> | 9 #include <PortableDeviceTypes.h> |
| 10 #include <Sensors.h> | 10 #include <Sensors.h> |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
| 15 #include "base/win/iunknown_impl.h" | 15 #include "base/win/iunknown_impl.h" |
| 16 #include "base/win/windows_version.h" | 16 #include "base/win/windows_version.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 const double kMeanGravity = 9.80665; | 20 const double kMeanGravity = 9.80665; |
| 21 | 21 |
| 22 void SetLightBuffer(content::DeviceLightHardwareBuffer* buffer, double lux) { | 22 void SetLightBuffer(device::DeviceLightHardwareBuffer* buffer, double lux) { |
| 23 DCHECK(buffer); | 23 DCHECK(buffer); |
| 24 buffer->seqlock.WriteBegin(); | 24 buffer->seqlock.WriteBegin(); |
| 25 buffer->data.value = lux; | 25 buffer->data.value = lux; |
| 26 buffer->seqlock.WriteEnd(); | 26 buffer->seqlock.WriteEnd(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 | 31 namespace device { |
| 32 namespace content { | |
| 33 | 32 |
| 34 class DataFetcherSharedMemory::SensorEventSink | 33 class DataFetcherSharedMemory::SensorEventSink |
| 35 : public ISensorEvents, public base::win::IUnknownImpl { | 34 : public ISensorEvents, public base::win::IUnknownImpl { |
| 36 public: | 35 public: |
| 37 SensorEventSink() {} | 36 SensorEventSink() {} |
| 38 ~SensorEventSink() override {} | 37 ~SensorEventSink() override {} |
| 39 | 38 |
| 40 // IUnknown interface | 39 // IUnknown interface |
| 41 ULONG STDMETHODCALLTYPE AddRef() override { | 40 ULONG STDMETHODCALLTYPE AddRef() override { |
| 42 return IUnknownImpl::AddRef(); | 41 return IUnknownImpl::AddRef(); |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 motion_buffer_->seqlock.WriteBegin(); | 486 motion_buffer_->seqlock.WriteBegin(); |
| 488 motion_buffer_->data.allAvailableSensorsAreActive = enabled; | 487 motion_buffer_->data.allAvailableSensorsAreActive = enabled; |
| 489 motion_buffer_->seqlock.WriteEnd(); | 488 motion_buffer_->seqlock.WriteEnd(); |
| 490 } | 489 } |
| 491 break; | 490 break; |
| 492 default: | 491 default: |
| 493 NOTREACHED(); | 492 NOTREACHED(); |
| 494 } | 493 } |
| 495 } | 494 } |
| 496 | 495 |
| 497 } // namespace content | 496 } // namespace device |
| OLD | NEW |