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

Side by Side Diff: third_party/WebKit/Source/modules/sensor/Sensor.cpp

Issue 2571193002: Signal no pending activity in destructed contexts. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ExecutionContextTask.h" 9 #include "core/dom/ExecutionContextTask.h"
10 #include "core/inspector/ConsoleMessage.h" 10 #include "core/inspector/ConsoleMessage.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 visitor->trace(m_sensorProxy); 125 visitor->trace(m_sensorProxy);
126 ActiveScriptWrappable::trace(visitor); 126 ActiveScriptWrappable::trace(visitor);
127 ContextLifecycleObserver::trace(visitor); 127 ContextLifecycleObserver::trace(visitor);
128 EventTargetWithInlineData::trace(visitor); 128 EventTargetWithInlineData::trace(visitor);
129 } 129 }
130 130
131 bool Sensor::hasPendingActivity() const { 131 bool Sensor::hasPendingActivity() const {
132 if (m_state == Sensor::SensorState::Idle || 132 if (m_state == Sensor::SensorState::Idle ||
133 m_state == Sensor::SensorState::Errored) 133 m_state == Sensor::SensorState::Errored)
134 return false; 134 return false;
135 return hasEventListeners(); 135 return getExecutionContext() && hasEventListeners();
136 } 136 }
137 137
138 auto Sensor::createSensorConfig() -> SensorConfigurationPtr { 138 auto Sensor::createSensorConfig() -> SensorConfigurationPtr {
139 auto result = SensorConfiguration::New(); 139 auto result = SensorConfiguration::New();
140 140
141 double defaultFrequency = m_sensorProxy->defaultConfig()->frequency; 141 double defaultFrequency = m_sensorProxy->defaultConfig()->frequency;
142 double maximumFrequency = m_sensorProxy->maximumFrequency(); 142 double maximumFrequency = m_sensorProxy->maximumFrequency();
143 143
144 double frequency = m_sensorOptions.hasFrequency() 144 double frequency = m_sensorOptions.hasFrequency()
145 ? m_sensorOptions.frequency() 145 ? m_sensorOptions.frequency()
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 void Sensor::notifyOnActivate() { 314 void Sensor::notifyOnActivate() {
315 dispatchEvent(Event::create(EventTypeNames::activate)); 315 dispatchEvent(Event::create(EventTypeNames::activate));
316 } 316 }
317 317
318 void Sensor::notifyError(DOMException* error) { 318 void Sensor::notifyError(DOMException* error) {
319 dispatchEvent( 319 dispatchEvent(
320 SensorErrorEvent::create(EventTypeNames::error, std::move(error))); 320 SensorErrorEvent::create(EventTypeNames::error, std::move(error)));
321 } 321 }
322 322
323 } // namespace blink 323 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698