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

Unified Diff: third_party/WebKit/Source/modules/sensor/SensorReading.cpp

Issue 2472403002: [Sensors] Align sensor reading attribute implementation with the specification (Closed)
Patch Set: Comments from Tim Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/sensor/SensorReading.cpp
diff --git a/third_party/WebKit/Source/modules/sensor/SensorReading.cpp b/third_party/WebKit/Source/modules/sensor/SensorReading.cpp
index 391528d80b4242375f8182f1b5e341b68cd503b2..7717e58d66b3100d9d3aa9791074d811ae4f6cf2 100644
--- a/third_party/WebKit/Source/modules/sensor/SensorReading.cpp
+++ b/third_party/WebKit/Source/modules/sensor/SensorReading.cpp
@@ -11,15 +11,11 @@
namespace blink {
-SensorReading::SensorReading(SensorProxy* sensorProxy)
- : m_sensorProxy(sensorProxy) {}
+SensorReading::SensorReading(const device::SensorReading& data)
+ : m_data(data) {}
SensorReading::~SensorReading() = default;
-DEFINE_TRACE(SensorReading) {
- visitor->trace(m_sensorProxy);
-}
-
DOMHighResTimeStamp SensorReading::timeStamp(ScriptState* scriptState) const {
LocalDOMWindow* window = scriptState->domWindow();
if (!window)
@@ -28,17 +24,7 @@ DOMHighResTimeStamp SensorReading::timeStamp(ScriptState* scriptState) const {
Performance* performance = DOMWindowPerformance::performance(*window);
DCHECK(performance);
- if (!m_sensorProxy) {
- // In cases when SensorReading derived classes are constructed from JS
- // side, e.g. to create syntetic SensorReadingEvent for testing
- // purposes, |m_sensorProxy| will be null and SensorReading.timeStamp
- // would return current DOMHighResTimeStamp, while reading value should
- // be provided by derived classes.
- return performance->now();
- }
-
- return performance->monotonicTimeToDOMHighResTimeStamp(
- m_sensorProxy->reading().timestamp);
+ return performance->monotonicTimeToDOMHighResTimeStamp(data().timestamp);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698