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

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

Issue 1942663003: [sensors]: Introduce the Generic Sensor API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + remove state from global interface listing Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/sensor/Sensor.cpp
diff --git a/third_party/WebKit/Source/modules/sensor/Sensor.cpp b/third_party/WebKit/Source/modules/sensor/Sensor.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..656687b27d004777d1ce4eecefa7acfb0fb41840
--- /dev/null
+++ b/third_party/WebKit/Source/modules/sensor/Sensor.cpp
@@ -0,0 +1,55 @@
+// Copyright 2016 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 "modules/sensor/Sensor.h"
+
+#include "bindings/core/v8/ScriptPromise.h"
+#include "bindings/core/v8/ScriptPromiseResolver.h"
+#include "core/dom/DOMException.h"
timvolodine 2016/05/06 17:04:29 not used?
riju_ 2016/05/12 14:12:45 Acknowledged.
+#include "core/dom/ExceptionCode.h"
+#include "modules/sensor/SensorReading.h"
+
+namespace blink {
+
+Sensor::~Sensor()
+{
+}
+
+Sensor::Sensor(ExecutionContext* executionContext, const SensorOptions& sensorOptions)
timvolodine 2016/05/06 17:04:29 the class doesn't seem to do much at this stage..
riju_ 2016/05/12 14:12:45 Only thing i am adding is m_sensorState(SensorStat
+ : ActiveScriptWrappable(this)
+ , ActiveDOMObject(executionContext)
+{
+}
+
timvolodine 2016/05/06 17:04:29 no state() implementation as you have in the other
riju_ 2016/05/12 14:12:45 I was adding the "state" part in the next CL, but
+// Getters
+SensorReading& Sensor::reading()
+{
+ return *m_sensorReading.get();
timvolodine 2016/05/06 17:04:29 I understand reading can be nullable, how is that
riju_ 2016/05/12 14:12:45 Acknowledged.
+}
+
+void Sensor::suspend()
+{
timvolodine 2016/05/06 17:04:29 will these remain empty? otherwise add todo
riju_ 2016/05/12 14:12:45 As suggested by you (https://codereview.chromium.o
timvolodine 2016/05/17 17:44:39 so yes, maybe Sensor should inherit from PlatformE
riju_ 2016/05/20 11:20:11 Done.
+}
+
+void Sensor::resume()
+{
+}
+
+void Sensor::stop()
+{
+}
+
+bool Sensor::hasPendingActivity() const
+{
+ return false;
timvolodine 2016/05/06 17:04:29 I assume this needs to be overriden in deriving cl
riju_ 2016/05/12 14:12:45 yes. removing it all together from here. In Active
+}
+
+DEFINE_TRACE(Sensor)
+{
+ ActiveDOMObject::trace(visitor);
+ EventTargetWithInlineData::trace(visitor);
+ visitor->trace(m_sensorReading);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698