| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mediarecorder/BlobEvent.h" | 5 #include "modules/mediarecorder/BlobEvent.h" |
| 6 | 6 |
| 7 #include "modules/mediarecorder/BlobEventInit.h" | 7 #include "modules/mediarecorder/BlobEventInit.h" |
| 8 #include "wtf/dtoa/double.h" |
| 8 | 9 |
| 9 namespace blink { | 10 namespace blink { |
| 10 | 11 |
| 11 // static | 12 // static |
| 12 BlobEvent* BlobEvent::create(const AtomicString& type, | 13 BlobEvent* BlobEvent::create(const AtomicString& type, |
| 13 const BlobEventInit& initializer) { | 14 const BlobEventInit& initializer) { |
| 14 return new BlobEvent(type, initializer); | 15 return new BlobEvent(type, initializer); |
| 15 } | 16 } |
| 16 | 17 |
| 17 // static | 18 // static |
| 18 BlobEvent* BlobEvent::create(const AtomicString& type, Blob* blob) { | 19 BlobEvent* BlobEvent::create(const AtomicString& type, |
| 19 return new BlobEvent(type, blob); | 20 Blob* blob, |
| 21 double timecode) { |
| 22 return new BlobEvent(type, blob, timecode); |
| 20 } | 23 } |
| 21 | 24 |
| 22 const AtomicString& BlobEvent::interfaceName() const { | 25 const AtomicString& BlobEvent::interfaceName() const { |
| 23 return EventNames::BlobEvent; | 26 return EventNames::BlobEvent; |
| 24 } | 27 } |
| 25 | 28 |
| 26 DEFINE_TRACE(BlobEvent) { | 29 DEFINE_TRACE(BlobEvent) { |
| 27 visitor->trace(m_blob); | 30 visitor->trace(m_blob); |
| 28 Event::trace(visitor); | 31 Event::trace(visitor); |
| 29 } | 32 } |
| 30 | 33 |
| 31 BlobEvent::BlobEvent(const AtomicString& type, const BlobEventInit& initializer) | 34 BlobEvent::BlobEvent(const AtomicString& type, const BlobEventInit& initializer) |
| 32 : Event(type, initializer), m_blob(initializer.data()) {} | 35 : Event(type, initializer), |
| 36 m_blob(initializer.data()), |
| 37 m_timecode(initializer.hasTimecode() |
| 38 ? initializer.timecode() |
| 39 : WTF::double_conversion::Double::NaN()) {} |
| 33 | 40 |
| 34 BlobEvent::BlobEvent(const AtomicString& type, Blob* blob) | 41 BlobEvent::BlobEvent(const AtomicString& type, Blob* blob, double timecode) |
| 35 : Event(type, false /* canBubble */, false /* cancelable */), | 42 : Event(type, false /* canBubble */, false /* cancelable */), |
| 36 m_blob(blob) {} | 43 m_blob(blob), |
| 44 m_timecode(timecode) {} |
| 37 | 45 |
| 38 } // namespace blink | 46 } // namespace blink |
| OLD | NEW |