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

Unified Diff: device/generic_sensor/sensor_provider_impl.cc

Issue 2402963002: [sensors] Fix crash when nullptr instead of a pointer to sensor is sent (Closed)
Patch Set: 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
« 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: 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..c857ea7d5188026fa84315f3321eacd3acbafbf7 100644
--- a/device/generic_sensor/sensor_provider_impl.cc
+++ b/device/generic_sensor/sensor_provider_impl.cc
@@ -21,18 +21,18 @@ uint64_t GetBufferOffset(mojom::SensorType type) {
}
void RunCallback(mojom::SensorInitParamsPtr init_params,
- SensorImpl* sensor,
+ mojom::SensorClientRequest client,
const SensorProviderImpl::GetSensorCallback& callback) {
- callback.Run(std::move(init_params), sensor->GetClient());
+ callback.Run(std::move(init_params), std::move(client));
}
void NotifySensorCreated(
mojom::SensorInitParamsPtr init_params,
- SensorImpl* sensor,
+ mojom::SensorClientRequest client,
const SensorProviderImpl::GetSensorCallback& callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- base::Bind(RunCallback, base::Passed(&init_params), sensor, callback));
+ FROM_HERE, base::Bind(RunCallback, base::Passed(&init_params),
+ base::Passed(&client), callback));
}
} // namespace
@@ -96,7 +96,8 @@ void SensorProviderImpl::SensorCreated(
init_params->mode = sensor->GetReportingMode();
init_params->default_configuration = sensor->GetDefaultConfiguration();
- NotifySensorCreated(std::move(init_params), sensor_impl.get(), callback);
+ NotifySensorCreated(std::move(init_params), sensor_impl->GetClient(),
+ callback);
mojo::MakeStrongBinding(std::move(sensor_impl), std::move(sensor_request));
}
« 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