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

Unified Diff: device/generic_sensor/sensor_provider_impl.cc

Issue 2395853003: [Sensors] Improvements in shared buffer managing (Closed)
Patch Set: Test compilation fix + comment from Ken Created 4 years, 2 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
Index: device/generic_sensor/sensor_provider_impl.cc
diff --git a/device/generic_sensor/sensor_provider_impl.cc b/device/generic_sensor/sensor_provider_impl.cc
index dc6e0fd68764b8c2adcf60b246d762fd04252d04..e4576c8134583156ac0912ba14c075f8d6be2108 100644
--- a/device/generic_sensor/sensor_provider_impl.cc
+++ b/device/generic_sensor/sensor_provider_impl.cc
@@ -14,12 +14,6 @@ namespace device {
namespace {
-uint64_t GetBufferOffset(mojom::SensorType type) {
- return (static_cast<uint64_t>(mojom::SensorType::LAST) -
- static_cast<uint64_t>(type)) *
- mojom::SensorInitParams::kReadBufferSize;
-}
-
void RunCallback(mojom::SensorInitParamsPtr init_params,
SensorImpl* sensor,
const SensorProviderImpl::GetSensorCallback& callback) {
@@ -68,8 +62,7 @@ void SensorProviderImpl::GetSensor(mojom::SensorType type,
&SensorProviderImpl::SensorCreated, weak_ptr_factory_.GetWeakPtr(),
type, base::Passed(&cloned_handle), base::Passed(&sensor_request),
callback);
- provider_->CreateSensor(type, mojom::SensorInitParams::kReadBufferSize,
- GetBufferOffset(type), cb);
+ provider_->CreateSensor(type, cb);
return;
}
@@ -92,7 +85,7 @@ void SensorProviderImpl::SensorCreated(
auto init_params = mojom::SensorInitParams::New();
init_params->memory = std::move(cloned_handle);
- init_params->buffer_offset = GetBufferOffset(type);
+ init_params->buffer_offset = SensorReadingSharedBuffer::GetOffset(type);
init_params->mode = sensor->GetReportingMode();
init_params->default_configuration = sensor->GetDefaultConfiguration();

Powered by Google App Engine
This is Rietveld 408576698