OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "device/generic_sensor/platform_sensor_provider_base.h" | 5 #include "services/device/generic_sensor/platform_sensor_provider_base.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom.h" | 10 #include "services/device/public/interfaces/sensor_provider.mojom.h" |
11 | 11 |
12 namespace device { | 12 namespace device { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 const uint64_t kReadingBufferSize = sizeof(SensorReadingSharedBuffer); | 16 const uint64_t kReadingBufferSize = sizeof(SensorReadingSharedBuffer); |
17 const uint64_t kSharedBufferSizeInBytes = | 17 const uint64_t kSharedBufferSizeInBytes = |
18 kReadingBufferSize * static_cast<uint64_t>(mojom::SensorType::LAST); | 18 kReadingBufferSize * static_cast<uint64_t>(mojom::SensorType::LAST); |
19 | 19 |
20 } // namespace | 20 } // namespace |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 mojo::ScopedSharedBufferMapping | 128 mojo::ScopedSharedBufferMapping |
129 PlatformSensorProviderBase::MapSharedBufferForType(mojom::SensorType type) { | 129 PlatformSensorProviderBase::MapSharedBufferForType(mojom::SensorType type) { |
130 mojo::ScopedSharedBufferMapping mapping = shared_buffer_handle_->MapAtOffset( | 130 mojo::ScopedSharedBufferMapping mapping = shared_buffer_handle_->MapAtOffset( |
131 kReadingBufferSize, SensorReadingSharedBuffer::GetOffset(type)); | 131 kReadingBufferSize, SensorReadingSharedBuffer::GetOffset(type)); |
132 memset(mapping.get(), 0, kReadingBufferSize); | 132 memset(mapping.get(), 0, kReadingBufferSize); |
133 return mapping; | 133 return mapping; |
134 } | 134 } |
135 | 135 |
136 } // namespace device | 136 } // namespace device |
OLD | NEW |