| 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 "content/browser/device_sensors/device_sensor_host.h" | 5 #include "device/sensors/device_sensor_host.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "content/browser/device_sensors/device_sensor_service.h" | 9 #include "device/sensors/device_sensor_export.h" |
| 10 #include "device/sensors/device_sensor_service.h" |
| 10 #include "mojo/public/cpp/bindings/strong_binding.h" | 11 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 11 | 12 |
| 12 namespace content { | 13 namespace device { |
| 13 | 14 |
| 14 template <typename MojoInterface, ConsumerType consumer_type> | 15 template <typename MojoInterface, ConsumerType consumer_type> |
| 15 void DeviceSensorHost<MojoInterface, consumer_type>::Create( | 16 void DeviceSensorHost<MojoInterface, consumer_type>::Create( |
| 16 mojo::InterfaceRequest<MojoInterface> request) { | 17 mojo::InterfaceRequest<MojoInterface> request) { |
| 17 mojo::MakeStrongBinding( | 18 mojo::MakeStrongBinding( |
| 18 base::WrapUnique(new DeviceSensorHost<MojoInterface, consumer_type>), | 19 base::WrapUnique(new DeviceSensorHost<MojoInterface, consumer_type>), |
| 19 std::move(request)); | 20 std::move(request)); |
| 20 } | 21 } |
| 21 | 22 |
| 22 template <typename MojoInterface, ConsumerType consumer_type> | 23 template <typename MojoInterface, ConsumerType consumer_type> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 53 void DeviceSensorHost<MojoInterface, | 54 void DeviceSensorHost<MojoInterface, |
| 54 consumer_type>::DeviceSensorHost::StopPolling() { | 55 consumer_type>::DeviceSensorHost::StopPolling() { |
| 55 DCHECK(thread_checker_.CalledOnValidThread()); | 56 DCHECK(thread_checker_.CalledOnValidThread()); |
| 56 DCHECK(is_started_); | 57 DCHECK(is_started_); |
| 57 if (!is_started_) | 58 if (!is_started_) |
| 58 return; | 59 return; |
| 59 is_started_ = false; | 60 is_started_ = false; |
| 60 DeviceSensorService::GetInstance()->RemoveConsumer(consumer_type); | 61 DeviceSensorService::GetInstance()->RemoveConsumer(consumer_type); |
| 61 } | 62 } |
| 62 | 63 |
| 63 template class DeviceSensorHost<device::mojom::LightSensor, | 64 template class DEVICE_SENSOR_EXPORT |
| 64 CONSUMER_TYPE_LIGHT>; | 65 DeviceSensorHost<device::mojom::LightSensor, CONSUMER_TYPE_LIGHT>; |
| 65 template class DeviceSensorHost<device::mojom::MotionSensor, | 66 template class DEVICE_SENSOR_EXPORT |
| 66 CONSUMER_TYPE_MOTION>; | 67 DeviceSensorHost<device::mojom::MotionSensor, CONSUMER_TYPE_MOTION>; |
| 67 template class DeviceSensorHost<device::mojom::OrientationSensor, | 68 template class DEVICE_SENSOR_EXPORT |
| 68 CONSUMER_TYPE_ORIENTATION>; | 69 DeviceSensorHost<device::mojom::OrientationSensor, |
| 69 template class DeviceSensorHost<device::mojom::OrientationAbsoluteSensor, | 70 CONSUMER_TYPE_ORIENTATION>; |
| 70 CONSUMER_TYPE_ORIENTATION_ABSOLUTE>; | 71 template class DEVICE_SENSOR_EXPORT |
| 72 DeviceSensorHost<device::mojom::OrientationAbsoluteSensor, |
| 73 CONSUMER_TYPE_ORIENTATION_ABSOLUTE>; |
| 71 | 74 |
| 72 } // namespace content | 75 } // namespace device |
| OLD | NEW |