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

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

Issue 2317743002: [Sensors] Implementation of the Generic Sensor API (Closed)
Patch Set: Comments from Tim and haraken Created 4 years, 3 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 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/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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/SensorReadingEvent.h ('k') | third_party/WebKit/Source/modules/sensor/SensorState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698