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

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

Issue 2577053002: ActiveScriptWrappable: GC wrappers in detached ExecutionContexts. (Closed)
Patch Set: component build fix(msvc) 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
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"
11 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h" 11 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h"
12 #include "modules/sensor/SensorErrorEvent.h" 12 #include "modules/sensor/SensorErrorEvent.h"
13 #include "modules/sensor/SensorProviderProxy.h" 13 #include "modules/sensor/SensorProviderProxy.h"
14 #include "modules/sensor/SensorReading.h" 14 #include "modules/sensor/SensorReading.h"
15 #include "modules/sensor/SensorUpdateNotificationStrategy.h" 15 #include "modules/sensor/SensorUpdateNotificationStrategy.h"
16 16
17 using namespace device::mojom::blink; 17 using namespace device::mojom::blink;
18 18
19 namespace blink { 19 namespace blink {
20 20
21 Sensor::Sensor(ExecutionContext* executionContext, 21 Sensor::Sensor(ExecutionContext* executionContext,
22 const SensorOptions& sensorOptions, 22 const SensorOptions& sensorOptions,
23 ExceptionState& exceptionState, 23 ExceptionState& exceptionState,
24 SensorType type) 24 SensorType type)
25 : ActiveScriptWrappable(this), 25 : ActiveScriptWrappable<Sensor>(this),
26 ContextLifecycleObserver(executionContext), 26 ContextLifecycleObserver(executionContext),
27 m_sensorOptions(sensorOptions), 27 m_sensorOptions(sensorOptions),
28 m_type(type), 28 m_type(type),
29 m_state(Sensor::SensorState::Idle) { 29 m_state(Sensor::SensorState::Idle) {
30 // Check secure context. 30 // Check secure context.
31 String errorMessage; 31 String errorMessage;
32 if (!executionContext->isSecureContext(errorMessage)) { 32 if (!executionContext->isSecureContext(errorMessage)) {
33 exceptionState.throwDOMException(SecurityError, errorMessage); 33 exceptionState.throwDOMException(SecurityError, errorMessage);
34 return; 34 return;
35 } 35 }
(...skipping 278 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/sensor/Sensor.h ('k') | third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698