OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/html/track/TrackEvent.h" | 27 #include "core/html/track/TrackEvent.h" |
28 | 28 |
29 #include "bindings/core/v8/UnionTypesCore.h" | 29 #include "bindings/core/v8/UnionTypesCore.h" |
30 #include "core/html/track/AudioTrack.h" | 30 #include "core/html/track/AudioTrack.h" |
31 #include "core/html/track/TextTrack.h" | 31 #include "core/html/track/TextTrack.h" |
32 #include "core/html/track/VideoTrack.h" | 32 #include "core/html/track/VideoTrack.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 TrackEventInit::TrackEventInit() | |
37 { | |
38 } | |
39 | |
40 | |
41 TrackEvent::TrackEvent() | 36 TrackEvent::TrackEvent() |
42 { | 37 { |
43 } | 38 } |
44 | 39 |
45 TrackEvent::TrackEvent(const AtomicString& type, const TrackEventInit& initializ
er) | 40 TrackEvent::TrackEvent(const AtomicString& type, const TrackEventInit& initializ
er) |
46 : Event(type, initializer) | 41 : Event(type, initializer) |
47 , m_track(initializer.track) | |
48 { | 42 { |
| 43 if (!initializer.hasTrack()) |
| 44 return; |
| 45 |
| 46 const VideoTrackOrAudioTrackOrTextTrack& track = initializer.track(); |
| 47 if (track.isVideoTrack()) |
| 48 m_track = track.getAsVideoTrack(); |
| 49 else if (track.isAudioTrack()) |
| 50 m_track = track.getAsAudioTrack(); |
| 51 else if (track.isTextTrack()) |
| 52 m_track = track.getAsTextTrack(); |
| 53 else |
| 54 ASSERT_NOT_REACHED(); |
49 } | 55 } |
50 | 56 |
51 TrackEvent::~TrackEvent() | 57 TrackEvent::~TrackEvent() |
52 { | 58 { |
53 } | 59 } |
54 | 60 |
55 const AtomicString& TrackEvent::interfaceName() const | 61 const AtomicString& TrackEvent::interfaceName() const |
56 { | 62 { |
57 return EventNames::TrackEvent; | 63 return EventNames::TrackEvent; |
58 } | 64 } |
(...skipping 19 matching lines...) Expand all Loading... |
78 } | 84 } |
79 | 85 |
80 void TrackEvent::trace(Visitor* visitor) | 86 void TrackEvent::trace(Visitor* visitor) |
81 { | 87 { |
82 visitor->trace(m_track); | 88 visitor->trace(m_track); |
83 Event::trace(visitor); | 89 Event::trace(visitor); |
84 } | 90 } |
85 | 91 |
86 } // namespace blink | 92 } // namespace blink |
87 | 93 |
OLD | NEW |