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

Side by Side Diff: content/renderer/device_sensors/device_light_event_pump.cc

Issue 604483003: Increase device orientation event frequency to 60 Hz. Change constants (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync Created 6 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 unified diff | Download patch
OLDNEW
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 "base/time/time.h"
7 #include "content/common/device_sensors/device_light_messages.h" 8 #include "content/common/device_sensors/device_light_messages.h"
8 #include "content/public/renderer/render_thread.h" 9 #include "content/public/renderer/render_thread.h"
9 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" 10 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h"
10 11
11 namespace { 12 namespace {
12 // Default delay between subsequent firing of DeviceLight events. 13 // Default rate for firing of DeviceLight events.
13 const int kDefaultLightPumpDelayMillis = 200; 14 const int kDefaultLightPumpFrequencyHz = 5;
15 const int kDefaultLightPumpDelayMicroseconds =
16 base::Time::kMicrosecondsPerSecond / kDefaultLightPumpFrequencyHz;
14 } // namespace 17 } // namespace
15 18
16 namespace content { 19 namespace content {
17 20
18 DeviceLightEventPump::DeviceLightEventPump(RenderThread* thread) 21 DeviceLightEventPump::DeviceLightEventPump(RenderThread* thread)
19 : DeviceSensorEventPump<blink::WebDeviceLightListener>(thread), 22 : DeviceSensorEventPump<blink::WebDeviceLightListener>(thread),
20 last_seen_data_(-1) { 23 last_seen_data_(-1) {
21 pump_delay_millis_ = kDefaultLightPumpDelayMillis; 24 pump_delay_microseconds_ = kDefaultLightPumpDelayMicroseconds;
22 } 25 }
23 26
24 DeviceLightEventPump::~DeviceLightEventPump() { 27 DeviceLightEventPump::~DeviceLightEventPump() {
25 } 28 }
26 29
27 bool DeviceLightEventPump::OnControlMessageReceived( 30 bool DeviceLightEventPump::OnControlMessageReceived(
28 const IPC::Message& message) { 31 const IPC::Message& message) {
29 bool handled = true; 32 bool handled = true;
30 IPC_BEGIN_MESSAGE_MAP(DeviceLightEventPump, message) 33 IPC_BEGIN_MESSAGE_MAP(DeviceLightEventPump, message)
31 IPC_MESSAGE_HANDLER(DeviceLightMsg_DidStartPolling, OnDidStart) 34 IPC_MESSAGE_HANDLER(DeviceLightMsg_DidStartPolling, OnDidStart)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 RenderThread::Get()->Send(new DeviceLightHostMsg_StopPolling()); 73 RenderThread::Get()->Send(new DeviceLightHostMsg_StopPolling());
71 } 74 }
72 75
73 void DeviceLightEventPump::SendFakeDataForTesting(void* fake_data) { 76 void DeviceLightEventPump::SendFakeDataForTesting(void* fake_data) {
74 double data = *static_cast<double*>(fake_data); 77 double data = *static_cast<double*>(fake_data);
75 78
76 listener()->didChangeDeviceLight(data); 79 listener()->didChangeDeviceLight(data);
77 } 80 }
78 81
79 } // namespace content 82 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698