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

Side by Side Diff: device/sensors/device_sensor_host.cc

Issue 2812223006: Replace device_sensor browsertest by service unittest. (Closed)
Patch Set: eliminate "unreachable code" warning. Created 3 years, 8 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 unified diff | Download patch
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 "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 "device/sensors/device_sensor_export.h" 9 #include "device/sensors/device_sensor_export.h"
10 #include "device/sensors/device_sensor_service.h" 10 #include "device/sensors/device_sensor_service.h"
11 #include "mojo/public/cpp/bindings/strong_binding.h" 11 #include "mojo/public/cpp/bindings/strong_binding.h"
12 12
13 namespace device { 13 namespace device {
14 14
15 template <typename MojoInterface, ConsumerType consumer_type> 15 template <typename MojoInterface, ConsumerType consumer_type>
16 void DeviceSensorHost<MojoInterface, consumer_type>::Create( 16 void DeviceSensorHost<MojoInterface, consumer_type>::Create(
17 mojo::InterfaceRequest<MojoInterface> request) { 17 mojo::InterfaceRequest<MojoInterface> request) {
18 mojo::MakeStrongBinding( 18 mojo::MakeStrongBinding(
19 base::WrapUnique(new DeviceSensorHost<MojoInterface, consumer_type>), 19 base::WrapUnique(new DeviceSensorHost<MojoInterface, consumer_type>),
20 std::move(request)); 20 std::move(request));
21 } 21 }
22 22
23 template <typename MojoInterface, ConsumerType consumer_type> 23 template <typename MojoInterface, ConsumerType consumer_type>
24 DeviceSensorHost<MojoInterface, consumer_type>::DeviceSensorHost() 24 DeviceSensorHost<MojoInterface, consumer_type>::DeviceSensorHost()
25 : is_started_(false) { 25 : is_started_(false) {
26 #if defined(OS_ANDROID) 26 #if defined(OS_ANDROID)
27 DCHECK(base::MessageLoopForUI::IsCurrent()); 27 DCHECK(base::MessageLoopForUI::IsCurrent());
28 #else
29 DCHECK(base::MessageLoopForIO::IsCurrent());
30 #endif 28 #endif
31 } 29 }
32 30
33 template <typename MojoInterface, ConsumerType consumer_type> 31 template <typename MojoInterface, ConsumerType consumer_type>
34 DeviceSensorHost<MojoInterface, consumer_type>::~DeviceSensorHost() { 32 DeviceSensorHost<MojoInterface, consumer_type>::~DeviceSensorHost() {
35 DCHECK(thread_checker_.CalledOnValidThread()); 33 DCHECK(thread_checker_.CalledOnValidThread());
36 if (is_started_) 34 if (is_started_)
37 DeviceSensorService::GetInstance()->RemoveConsumer(consumer_type); 35 DeviceSensorService::GetInstance()->RemoveConsumer(consumer_type);
38 } 36 }
39 37
(...skipping 26 matching lines...) Expand all
66 template class DEVICE_SENSOR_EXPORT 64 template class DEVICE_SENSOR_EXPORT
67 DeviceSensorHost<device::mojom::MotionSensor, CONSUMER_TYPE_MOTION>; 65 DeviceSensorHost<device::mojom::MotionSensor, CONSUMER_TYPE_MOTION>;
68 template class DEVICE_SENSOR_EXPORT 66 template class DEVICE_SENSOR_EXPORT
69 DeviceSensorHost<device::mojom::OrientationSensor, 67 DeviceSensorHost<device::mojom::OrientationSensor,
70 CONSUMER_TYPE_ORIENTATION>; 68 CONSUMER_TYPE_ORIENTATION>;
71 template class DEVICE_SENSOR_EXPORT 69 template class DEVICE_SENSOR_EXPORT
72 DeviceSensorHost<device::mojom::OrientationAbsoluteSensor, 70 DeviceSensorHost<device::mojom::OrientationAbsoluteSensor,
73 CONSUMER_TYPE_ORIENTATION_ABSOLUTE>; 71 CONSUMER_TYPE_ORIENTATION_ABSOLUTE>;
74 72
75 } // namespace device 73 } // namespace device
OLDNEW
« no previous file with comments | « content/test/data/device_sensors/device_sensors_null_test_with_alert.html ('k') | device/sensors/device_sensor_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698