Chromium Code Reviews| 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 #ifndef SensorReadingEvent_h | 5 #ifndef SensorReadingEvent_h |
| 6 #define SensorReadingEvent_h | 6 #define SensorReadingEvent_h |
| 7 | 7 |
| 8 #include "modules/EventModules.h" | 8 #include "modules/EventModules.h" |
| 9 #include "modules/sensor/SensorReading.h" | 9 #include "modules/sensor/SensorReading.h" |
| 10 #include "modules/sensor/SensorReadingEventInit.h" | 10 #include "modules/sensor/SensorReadingEventInit.h" |
| 11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class SensorReadingEvent : public Event { | 15 class SensorReadingEvent : public Event { |
| 16 DEFINE_WRAPPERTYPEINFO(); | 16 DEFINE_WRAPPERTYPEINFO(); |
| 17 | 17 |
| 18 public: | 18 public: |
| 19 static SensorReadingEvent* create(const AtomicString& eventType) | 19 static SensorReadingEvent* create() |
| 20 { | 20 { |
| 21 return new SensorReadingEvent(eventType); | 21 return new SensorReadingEvent; |
| 22 } | 22 } |
| 23 | 23 |
| 24 static SensorReadingEvent* create(const AtomicString& eventType, SensorReadi ng& reading) | 24 static SensorReadingEvent* create(const AtomicString& eventType, SensorReadi ng* reading) |
|
timvolodine
2016/08/25 17:52:33
should this also be a const SensorReading&?
Mikhail
2016/08/26 16:42:42
it might be 'SensorReading&' to give a hint that r
| |
| 25 { | 25 { |
| 26 return new SensorReadingEvent(eventType, reading); | 26 return new SensorReadingEvent(eventType, reading); |
| 27 } | 27 } |
| 28 | 28 |
| 29 static SensorReadingEvent* create(const AtomicString& eventType, const Senso rReadingEventInit& initializer) | 29 static SensorReadingEvent* create(const AtomicString& eventType, const Senso rReadingEventInit& initializer) |
| 30 { | 30 { |
| 31 return new SensorReadingEvent(eventType, initializer); | 31 return new SensorReadingEvent(eventType, initializer); |
| 32 } | 32 } |
| 33 | 33 |
| 34 ~SensorReadingEvent() override; | 34 ~SensorReadingEvent() override; |
| 35 | 35 |
| 36 // TODO(riju): crbug.com/614797 . | 36 const SensorReading* reading() const { return m_reading.get(); } |
| 37 SensorReading* reading() const { return m_reading.get(); } | 37 SensorReading* reading() { return m_reading.get(); } |
|
timvolodine
2016/08/25 17:52:33
is this method needed?
Mikhail
2016/08/26 16:42:42
Both are used by V8 bindings..
| |
| 38 const AtomicString& interfaceName() const override; | 38 const AtomicString& interfaceName() const override; |
| 39 | 39 |
| 40 DECLARE_VIRTUAL_TRACE(); | 40 DECLARE_VIRTUAL_TRACE(); |
| 41 | 41 |
| 42 protected: | 42 protected: |
| 43 Member<SensorReading> m_reading; | 43 Member<SensorReading> m_reading; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 explicit SensorReadingEvent(const AtomicString& eventType); | 46 SensorReadingEvent(); |
|
timvolodine
2016/08/25 17:52:33
needed?
Mikhail
2016/08/26 16:42:42
actually not :) thanks!
| |
| 47 SensorReadingEvent(const AtomicString& eventType, SensorReading&); | 47 SensorReadingEvent(const AtomicString& eventType, SensorReading*); |
| 48 SensorReadingEvent(const AtomicString& eventType, const SensorReadingEventIn it& initializer); | 48 SensorReadingEvent(const AtomicString& eventType, const SensorReadingEventIn it& initializer); |
| 49 | 49 |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 DEFINE_TYPE_CASTS(SensorReadingEvent, Event, event, event->interfaceName() == Ev entNames::SensorReadingEvent, event.interfaceName() == EventNames::SensorReading Event); | 52 DEFINE_TYPE_CASTS(SensorReadingEvent, Event, event, event->interfaceName() == Ev entNames::SensorReadingEvent, event.interfaceName() == EventNames::SensorReading Event); |
| 53 | 53 |
| 54 } // namepsace blink | 54 } // namepsace blink |
| 55 | 55 |
| 56 #endif // SensorReadingEvent_h | 56 #endif // SensorReadingEvent_h |
| OLD | NEW |