OLD | NEW |
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/SensorReadingEvent.h" | 5 #include "modules/sensor/SensorReadingEvent.h" |
6 | 6 |
7 namespace blink { | 7 namespace blink { |
8 | 8 |
9 SensorReadingEvent::~SensorReadingEvent() | 9 SensorReadingEvent::~SensorReadingEvent() = default; |
| 10 |
| 11 SensorReadingEvent::SensorReadingEvent(const AtomicString& eventType, SensorRead
ing* reading) |
| 12 : Event(eventType, false, false) // Does not bubble and is not cancelable. |
| 13 , m_reading(reading) |
| 14 { |
| 15 DCHECK(m_reading); |
| 16 } |
| 17 |
| 18 SensorReadingEvent::SensorReadingEvent(const AtomicString& eventType, const Sens
orReadingEventInit& initializer) |
| 19 : SensorReadingEvent(eventType, initializer.reading()) |
10 { | 20 { |
11 } | 21 } |
12 | 22 |
13 SensorReadingEvent::SensorReadingEvent(const AtomicString& eventType) | |
14 : Event(eventType, true, false) // let default be bubbles but is not cancela
ble. | |
15 , m_reading(SensorReading::create()) | |
16 { | |
17 } | |
18 | |
19 SensorReadingEvent::SensorReadingEvent(const AtomicString& eventType, SensorRead
ing& reading) | |
20 : Event(eventType, true, false) // let default be bubbles but is not cancela
ble. | |
21 , m_reading(reading) | |
22 { | |
23 } | |
24 | |
25 SensorReadingEvent::SensorReadingEvent(const AtomicString& eventType, const Sens
orReadingEventInit& initializer) | |
26 : Event(eventType, initializer) | |
27 , m_reading(SensorReading::create()) | |
28 { | |
29 setCanBubble(true); | |
30 } | |
31 | |
32 const AtomicString& SensorReadingEvent::interfaceName() const | 23 const AtomicString& SensorReadingEvent::interfaceName() const |
33 { | 24 { |
34 return EventNames::SensorReadingEvent; | 25 return EventNames::SensorReadingEvent; |
35 } | 26 } |
36 | 27 |
37 DEFINE_TRACE(SensorReadingEvent) | 28 DEFINE_TRACE(SensorReadingEvent) |
38 { | 29 { |
39 Event::trace(visitor); | 30 Event::trace(visitor); |
40 visitor->trace(m_reading); | 31 visitor->trace(m_reading); |
41 } | 32 } |
42 | 33 |
43 } // namespace blink | 34 } // namespace blink |
OLD | NEW |