OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_SENSOR_EVENT_PUMP_H_ | 5 #ifndef CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_SENSOR_EVENT_PUMP_H_ |
6 #define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_SENSOR_EVENT_PUMP_H_ | 6 #define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_SENSOR_EVENT_PUMP_H_ |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
14 #include "content/public/renderer/platform_event_observer.h" | 14 #include "content/public/renderer/platform_event_observer.h" |
15 #include "content/renderer/render_thread_impl.h" | 15 #include "content/renderer/render_thread_impl.h" |
16 #include "mojo/public/cpp/system/platform_handle.h" | 16 #include "mojo/public/cpp/system/platform_handle.h" |
17 #include "services/service_manager/public/cpp/interface_provider.h" | 17 #include "services/service_manager/public/cpp/interface_provider.h" |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 template <typename Base, typename MojoInterface> | 21 template <typename Base, typename MojoInterface> |
22 class CONTENT_EXPORT DeviceSensorMojoClientMixin : public Base { | 22 class CONTENT_EXPORT DeviceSensorMojoClientMixin : public Base { |
23 public: | 23 public: |
24 template <typename... Args> | 24 template <typename... Args> |
25 explicit DeviceSensorMojoClientMixin(Args&&... args) | 25 explicit DeviceSensorMojoClientMixin(Args&&... args) |
26 : Base(std::forward<Args>(args)...) { | 26 : Base(std::forward<Args>(args)...) { |
27 mojo::InterfaceRequest<MojoInterface> request = | 27 mojo::InterfaceRequest<MojoInterface> request(&mojo_interface_); |
28 mojo::MakeRequest(&mojo_interface_); | |
29 | 28 |
30 // When running layout tests, those observers should not listen to the | 29 // When running layout tests, those observers should not listen to the |
31 // actual hardware changes. In order to make that happen, don't connect | 30 // actual hardware changes. In order to make that happen, don't connect |
32 // the other end of the mojo pipe to anything. | 31 // the other end of the mojo pipe to anything. |
33 // | 32 // |
34 // TODO(sammc): Remove this when JS layout test support for shared buffers | 33 // TODO(sammc): Remove this when JS layout test support for shared buffers |
35 // is ready and the layout tests are converted to use that for mocking. | 34 // is ready and the layout tests are converted to use that for mocking. |
36 if (RenderThreadImpl::current() && | 35 if (RenderThreadImpl::current() && |
37 !RenderThreadImpl::current()->layout_test_mode()) { | 36 !RenderThreadImpl::current()->layout_test_mode()) { |
38 RenderThread::Get()->GetRemoteInterfaces()->GetInterface( | 37 RenderThread::Get()->GetRemoteInterfaces()->GetInterface( |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 int pump_delay_microseconds_; | 141 int pump_delay_microseconds_; |
143 PumpState state_; | 142 PumpState state_; |
144 base::RepeatingTimer timer_; | 143 base::RepeatingTimer timer_; |
145 | 144 |
146 DISALLOW_COPY_AND_ASSIGN(DeviceSensorEventPump); | 145 DISALLOW_COPY_AND_ASSIGN(DeviceSensorEventPump); |
147 }; | 146 }; |
148 | 147 |
149 } // namespace content | 148 } // namespace content |
150 | 149 |
151 #endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_SENSOR_EVENT_PUMP_H_ | 150 #endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_SENSOR_EVENT_PUMP_H_ |
OLD | NEW |