| Index: content/renderer/device_sensors/device_light_event_pump.cc
|
| diff --git a/content/renderer/device_sensors/device_light_event_pump.cc b/content/renderer/device_sensors/device_light_event_pump.cc
|
| deleted file mode 100644
|
| index 2ab0057c6b47bdd452212170ebef4bcbce0a066f..0000000000000000000000000000000000000000
|
| --- a/content/renderer/device_sensors/device_light_event_pump.cc
|
| +++ /dev/null
|
| @@ -1,65 +0,0 @@
|
| -// Copyright 2014 The Chromium Authors. All rights reserved.
|
| -// Use of this source code is governed by a BSD-style license that can be
|
| -// found in the LICENSE file.
|
| -
|
| -#include "content/renderer/device_sensors/device_light_event_pump.h"
|
| -
|
| -#include "base/time/time.h"
|
| -#include "content/public/renderer/render_thread.h"
|
| -#include "device/sensors/public/cpp/device_sensors_consts.h"
|
| -#include "third_party/WebKit/public/platform/WebDeviceLightListener.h"
|
| -
|
| -namespace {
|
| -// Default rate for firing of DeviceLight events.
|
| -const int kDefaultLightPumpDelayMicroseconds =
|
| - base::Time::kMicrosecondsPerSecond /
|
| - device::kDefaultAmbientLightFrequencyHz;
|
| -} // namespace
|
| -
|
| -namespace content {
|
| -
|
| -DeviceLightEventPump::DeviceLightEventPump(RenderThread* thread)
|
| - : DeviceSensorMojoClientMixin<
|
| - DeviceSensorEventPump<blink::WebDeviceLightListener>,
|
| - device::mojom::LightSensor>(thread),
|
| - last_seen_data_(-1) {
|
| - pump_delay_microseconds_ = kDefaultLightPumpDelayMicroseconds;
|
| -}
|
| -
|
| -DeviceLightEventPump::~DeviceLightEventPump() {
|
| -}
|
| -
|
| -void DeviceLightEventPump::FireEvent() {
|
| - DCHECK(listener());
|
| - device::DeviceLightData data;
|
| - if (reader_->GetLatestData(&data) && ShouldFireEvent(data.value)) {
|
| - last_seen_data_ = data.value;
|
| - listener()->DidChangeDeviceLight(data.value);
|
| - }
|
| -}
|
| -
|
| -bool DeviceLightEventPump::ShouldFireEvent(double lux) const {
|
| - if (lux < 0)
|
| - return false;
|
| -
|
| - if (lux == std::numeric_limits<double>::infinity()) {
|
| - // no sensor data can be provided, fire an Infinity event to Blink.
|
| - return true;
|
| - }
|
| -
|
| - return lux != last_seen_data_;
|
| -}
|
| -
|
| -bool DeviceLightEventPump::InitializeReader(base::SharedMemoryHandle handle) {
|
| - if (!reader_)
|
| - reader_.reset(new DeviceLightSharedMemoryReader());
|
| - return reader_->Initialize(handle);
|
| -}
|
| -
|
| -void DeviceLightEventPump::SendFakeDataForTesting(void* fake_data) {
|
| - double data = *static_cast<double*>(fake_data);
|
| -
|
| - listener()->DidChangeDeviceLight(data);
|
| -}
|
| -
|
| -} // namespace content
|
|
|