| Index: content/browser/device_sensors/device_sensor_host.cc
|
| diff --git a/content/browser/device_sensors/device_sensor_host.cc b/content/browser/device_sensors/device_sensor_host.cc
|
| index e4b806967e5c16aac8448233141f422249d19874..81a0429c8b6f7d343c030dd3abfa4c8772b2c5d7 100644
|
| --- a/content/browser/device_sensors/device_sensor_host.cc
|
| +++ b/content/browser/device_sensors/device_sensor_host.cc
|
| @@ -4,24 +4,32 @@
|
|
|
| #include "content/browser/device_sensors/device_sensor_host.h"
|
|
|
| +#include "base/message_loop/message_loop.h"
|
| +#include "build/build_config.h"
|
| #include "content/browser/device_sensors/device_sensor_service.h"
|
| -#include "content/public/browser/browser_thread.h"
|
| #include "mojo/public/cpp/bindings/strong_binding.h"
|
|
|
| +#if defined(OS_ANDROID)
|
| +#include "content/browser/device_sensors/sensor_manager_android.h"
|
| +#endif
|
| +
|
| namespace content {
|
|
|
| template <typename MojoInterface, ConsumerType consumer_type>
|
| void DeviceSensorHost<MojoInterface, consumer_type>::Create(
|
| + scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
|
| mojo::InterfaceRequest<MojoInterface> request) {
|
| mojo::MakeStrongBinding(
|
| - base::WrapUnique(new DeviceSensorHost<MojoInterface, consumer_type>),
|
| + base::WrapUnique(
|
| + new DeviceSensorHost<MojoInterface, consumer_type>(ui_task_runner)),
|
| std::move(request));
|
| }
|
|
|
| template <typename MojoInterface, ConsumerType consumer_type>
|
| -DeviceSensorHost<MojoInterface, consumer_type>::DeviceSensorHost()
|
| - : is_started_(false) {
|
| - DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| +DeviceSensorHost<MojoInterface, consumer_type>::DeviceSensorHost(
|
| + scoped_refptr<base::SequencedTaskRunner> ui_task_runner)
|
| + : is_started_(false), ui_task_runner_(ui_task_runner) {
|
| + DCHECK(base::MessageLoopForIO::IsCurrent());
|
| }
|
|
|
| template <typename MojoInterface, ConsumerType consumer_type>
|
| @@ -39,6 +47,9 @@ void DeviceSensorHost<MojoInterface, consumer_type>::DeviceSensorHost::
|
| if (is_started_)
|
| return;
|
| is_started_ = true;
|
| +#if defined(OS_ANDROID)
|
| + SensorManagerAndroid::GetInstance()->SetUITaskRunner(ui_task_runner_);
|
| +#endif
|
| DeviceSensorService::GetInstance()->AddConsumer(consumer_type);
|
| callback.Run(
|
| DeviceSensorService::GetInstance()->GetSharedMemoryHandle(consumer_type));
|
|
|