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

Unified Diff: content/browser/device_sensors/device_sensor_host.h

Issue 2410123002: Remove content::BrowserThread knowledge from Device Sensors (Closed)
Patch Set: Rebase, avoid object creation on startup 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: content/browser/device_sensors/device_sensor_host.h
diff --git a/content/browser/device_sensors/device_sensor_host.h b/content/browser/device_sensors/device_sensor_host.h
index e7fceb3f255bea1e9327f9010c816f5d0d9259a0..37cf1f698cf42c5afe009d97bbe21e86f469ba93 100644
--- a/content/browser/device_sensors/device_sensor_host.h
+++ b/content/browser/device_sensors/device_sensor_host.h
@@ -7,6 +7,7 @@
#include "base/macros.h"
#include "base/memory/shared_memory.h"
+#include "base/sequenced_task_runner.h"
#include "content/browser/device_sensors/device_sensors_consts.h"
#include "device/sensors/public/interfaces/light.mojom.h"
#include "device/sensors/public/interfaces/motion.mojom.h"
@@ -19,13 +20,15 @@ namespace content {
template <typename MojoInterface, ConsumerType consumer_type>
class DeviceSensorHost : public MojoInterface {
public:
- static void Create(mojo::InterfaceRequest<MojoInterface> request);
+ static void Create(scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
+ mojo::InterfaceRequest<MojoInterface> request);
// All methods below to be called on the IO thread.
~DeviceSensorHost() override;
private:
- DeviceSensorHost();
+ explicit DeviceSensorHost(
+ scoped_refptr<base::SequencedTaskRunner> ui_task_runner);
void StartPolling(
const typename MojoInterface::StartPollingCallback& callback) override;
@@ -33,6 +36,7 @@ class DeviceSensorHost : public MojoInterface {
bool is_started_;
+ scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(DeviceSensorHost);

Powered by Google App Engine
This is Rietveld 408576698