| OLD | NEW |
| 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 "modules/sensor/Sensor.h" | 5 #include "modules/sensor/Sensor.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
| 9 #include "core/dom/TaskRunnerHelper.h" | 9 #include "core/dom/TaskRunnerHelper.h" |
| 10 #include "core/inspector/ConsoleMessage.h" | 10 #include "core/inspector/ConsoleMessage.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 void Sensor::UpdateReading() { | 303 void Sensor::UpdateReading() { |
| 304 reading_ = sensor_proxy_->reading(); | 304 reading_ = sensor_proxy_->reading(); |
| 305 DispatchEvent(Event::Create(EventTypeNames::change)); | 305 DispatchEvent(Event::Create(EventTypeNames::change)); |
| 306 } | 306 } |
| 307 | 307 |
| 308 void Sensor::NotifyOnActivate() { | 308 void Sensor::NotifyOnActivate() { |
| 309 DispatchEvent(Event::Create(EventTypeNames::activate)); | 309 DispatchEvent(Event::Create(EventTypeNames::activate)); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void Sensor::NotifyError(DOMException* error) { | 312 void Sensor::NotifyError(DOMException* error) { |
| 313 DispatchEvent( | 313 DispatchEvent(SensorErrorEvent::Create(EventTypeNames::error, error)); |
| 314 SensorErrorEvent::Create(EventTypeNames::error, std::move(error))); | |
| 315 } | 314 } |
| 316 | 315 |
| 317 bool Sensor::CanReturnReadings() const { | 316 bool Sensor::CanReturnReadings() const { |
| 318 if (!IsActivated()) | 317 if (!IsActivated()) |
| 319 return false; | 318 return false; |
| 320 DCHECK(sensor_proxy_); | 319 DCHECK(sensor_proxy_); |
| 321 return sensor_proxy_->reading().timestamp != 0.0; | 320 return sensor_proxy_->reading().timestamp != 0.0; |
| 322 } | 321 } |
| 323 | 322 |
| 324 } // namespace blink | 323 } // namespace blink |
| OLD | NEW |