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

Side by Side Diff: content/browser/device_sensors/device_sensor_host.cc

Issue 2452083002: [Device Sensors] Remove BrowserThread knowledge (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/device_sensors/sensor_manager_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/browser/device_sensors/device_sensor_host.h"
6 6
7 #include "base/message_loop/message_loop.h"
7 #include "content/browser/device_sensors/device_sensor_service.h" 8 #include "content/browser/device_sensors/device_sensor_service.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "mojo/public/cpp/bindings/strong_binding.h" 9 #include "mojo/public/cpp/bindings/strong_binding.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 template <typename MojoInterface, ConsumerType consumer_type> 13 template <typename MojoInterface, ConsumerType consumer_type>
14 void DeviceSensorHost<MojoInterface, consumer_type>::Create( 14 void DeviceSensorHost<MojoInterface, consumer_type>::Create(
15 mojo::InterfaceRequest<MojoInterface> request) { 15 mojo::InterfaceRequest<MojoInterface> request) {
16 mojo::MakeStrongBinding( 16 mojo::MakeStrongBinding(
17 base::WrapUnique(new DeviceSensorHost<MojoInterface, consumer_type>), 17 base::WrapUnique(new DeviceSensorHost<MojoInterface, consumer_type>),
18 std::move(request)); 18 std::move(request));
19 } 19 }
20 20
21 template <typename MojoInterface, ConsumerType consumer_type> 21 template <typename MojoInterface, ConsumerType consumer_type>
22 DeviceSensorHost<MojoInterface, consumer_type>::DeviceSensorHost() 22 DeviceSensorHost<MojoInterface, consumer_type>::DeviceSensorHost()
23 : is_started_(false) { 23 : is_started_(false) {
24 #if defined(OS_ANDROID) 24 #if defined(OS_ANDROID)
25 DCHECK_CURRENTLY_ON(BrowserThread::UI); 25 DCHECK(base::MessageLoopForUI::IsCurrent());
26 #else 26 #else
27 DCHECK_CURRENTLY_ON(BrowserThread::IO); 27 DCHECK(base::MessageLoopForIO::IsCurrent());
28 #endif 28 #endif
29 } 29 }
30 30
31 template <typename MojoInterface, ConsumerType consumer_type> 31 template <typename MojoInterface, ConsumerType consumer_type>
32 DeviceSensorHost<MojoInterface, consumer_type>::~DeviceSensorHost() { 32 DeviceSensorHost<MojoInterface, consumer_type>::~DeviceSensorHost() {
33 DCHECK(thread_checker_.CalledOnValidThread()); 33 DCHECK(thread_checker_.CalledOnValidThread());
34 if (is_started_) 34 if (is_started_)
35 DeviceSensorService::GetInstance()->RemoveConsumer(consumer_type); 35 DeviceSensorService::GetInstance()->RemoveConsumer(consumer_type);
36 } 36 }
37 37
(...skipping 24 matching lines...) Expand all
62 template class DeviceSensorHost<device::mojom::LightSensor, 62 template class DeviceSensorHost<device::mojom::LightSensor,
63 CONSUMER_TYPE_LIGHT>; 63 CONSUMER_TYPE_LIGHT>;
64 template class DeviceSensorHost<device::mojom::MotionSensor, 64 template class DeviceSensorHost<device::mojom::MotionSensor,
65 CONSUMER_TYPE_MOTION>; 65 CONSUMER_TYPE_MOTION>;
66 template class DeviceSensorHost<device::mojom::OrientationSensor, 66 template class DeviceSensorHost<device::mojom::OrientationSensor,
67 CONSUMER_TYPE_ORIENTATION>; 67 CONSUMER_TYPE_ORIENTATION>;
68 template class DeviceSensorHost<device::mojom::OrientationAbsoluteSensor, 68 template class DeviceSensorHost<device::mojom::OrientationAbsoluteSensor,
69 CONSUMER_TYPE_ORIENTATION_ABSOLUTE>; 69 CONSUMER_TYPE_ORIENTATION_ABSOLUTE>;
70 70
71 } // namespace content 71 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/device_sensors/sensor_manager_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698