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

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

Issue 2481363003: [Sensors] Implement Sensor.onactivate (Closed)
Patch Set: 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/Sensor.cpp
diff --git a/third_party/WebKit/Source/modules/sensor/Sensor.cpp b/third_party/WebKit/Source/modules/sensor/Sensor.cpp
index c9f902d42ad470d7f9d58be39494524c9fa69d63..a66b1905615ffeb27602d7a68dcef009d878fd3e 100644
--- a/third_party/WebKit/Source/modules/sensor/Sensor.cpp
+++ b/third_party/WebKit/Source/modules/sensor/Sensor.cpp
@@ -288,9 +288,9 @@ void Sensor::updateState(Sensor::SensorState newState) {
if (newState == m_state)
return;
m_state = newState;
- if (getExecutionContext()) {
+ if (m_state == SensorState::ACTIVE && getExecutionContext()) {
shalamov 2016/11/09 11:17:16 if (m_state == ACTIVATING && newState == ACTIVE &&
getExecutionContext()->postTask(
- BLINK_FROM_HERE, createSameThreadTask(&Sensor::notifyStateChanged,
+ BLINK_FROM_HERE, createSameThreadTask(&Sensor::notifyOnActivate,
wrapWeakPersistent(this)));
}
@@ -327,8 +327,8 @@ void Sensor::notifySensorReadingChanged() {
dispatchEvent(Event::create(EventTypeNames::change));
}
-void Sensor::notifyStateChanged() {
- dispatchEvent(Event::create(EventTypeNames::statechange));
+void Sensor::notifyOnActivate() {
+ dispatchEvent(Event::create(EventTypeNames::activate));
}
void Sensor::notifyError(DOMException* error) {
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/Sensor.h ('k') | third_party/WebKit/Source/modules/sensor/Sensor.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698