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 #include "content/renderer/device_sensors/device_light_event_pump.h" | 5 #include "content/renderer/device_sensors/device_light_event_pump.h" |
6 | 6 |
7 #include "content/common/device_sensors/device_light_messages.h" | 7 #include "content/common/device_sensors/device_light_messages.h" |
8 #include "content/public/renderer/render_thread.h" | 8 #include "content/public/renderer/render_thread.h" |
9 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" | 9 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" |
10 | 10 |
11 namespace { | 11 namespace { |
12 // Default delay between subsequent firing of DeviceLight events. | 12 // Default delay between subsequent firing of DeviceLight events. |
13 const int kDefaultLightPumpDelayMillis = 200; | 13 const int kDefaultLightPumpDelayMicroseconds = 1000000 / 5; |
timvolodine
2014/09/25 21:30:51
same here
jdarpinian
2014/09/25 22:36:18
Done.
| |
14 } // namespace | 14 } // namespace |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 DeviceLightEventPump::DeviceLightEventPump(RenderThread* thread) | 18 DeviceLightEventPump::DeviceLightEventPump(RenderThread* thread) |
19 : DeviceSensorEventPump<blink::WebDeviceLightListener>(thread), | 19 : DeviceSensorEventPump<blink::WebDeviceLightListener>(thread), |
20 last_seen_data_(-1) { | 20 last_seen_data_(-1) { |
21 pump_delay_millis_ = kDefaultLightPumpDelayMillis; | 21 pump_delay_microseconds_ = kDefaultLightPumpDelayMicroseconds; |
22 } | 22 } |
23 | 23 |
24 DeviceLightEventPump::~DeviceLightEventPump() { | 24 DeviceLightEventPump::~DeviceLightEventPump() { |
25 } | 25 } |
26 | 26 |
27 bool DeviceLightEventPump::OnControlMessageReceived( | 27 bool DeviceLightEventPump::OnControlMessageReceived( |
28 const IPC::Message& message) { | 28 const IPC::Message& message) { |
29 bool handled = true; | 29 bool handled = true; |
30 IPC_BEGIN_MESSAGE_MAP(DeviceLightEventPump, message) | 30 IPC_BEGIN_MESSAGE_MAP(DeviceLightEventPump, message) |
31 IPC_MESSAGE_HANDLER(DeviceLightMsg_DidStartPolling, OnDidStart) | 31 IPC_MESSAGE_HANDLER(DeviceLightMsg_DidStartPolling, OnDidStart) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 RenderThread::Get()->Send(new DeviceLightHostMsg_StopPolling()); | 70 RenderThread::Get()->Send(new DeviceLightHostMsg_StopPolling()); |
71 } | 71 } |
72 | 72 |
73 void DeviceLightEventPump::SendFakeDataForTesting(void* fake_data) { | 73 void DeviceLightEventPump::SendFakeDataForTesting(void* fake_data) { |
74 double data = *static_cast<double*>(fake_data); | 74 double data = *static_cast<double*>(fake_data); |
75 | 75 |
76 listener()->didChangeDeviceLight(data); | 76 listener()->didChangeDeviceLight(data); |
77 } | 77 } |
78 | 78 |
79 } // namespace content | 79 } // namespace content |
OLD | NEW |