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 const VideoTrackOrAudioTrackOrTextTrack& track = initializer.track(); | |
44 if (track.isVideoTrack()) | |
45 m_track = track.getAsVideoTrack(); | |
46 if (track.isAudioTrack()) | |
philipj_slow
2014/12/10 08:22:48
I'm guessing the compiler can't figure out that th
bashi
2014/12/10 08:45:56
Done. The compiler checks the type of the given va
| |
47 m_track = track.getAsAudioTrack(); | |
48 if (track.isTextTrack()) | |
49 m_track = track.getAsTextTrack(); | |
49 } | 50 } |
50 | 51 |
51 TrackEvent::~TrackEvent() | 52 TrackEvent::~TrackEvent() |
52 { | 53 { |
53 } | 54 } |
54 | 55 |
55 const AtomicString& TrackEvent::interfaceName() const | 56 const AtomicString& TrackEvent::interfaceName() const |
56 { | 57 { |
57 return EventNames::TrackEvent; | 58 return EventNames::TrackEvent; |
58 } | 59 } |
(...skipping 19 matching lines...) Expand all Loading... | |
78 } | 79 } |
79 | 80 |
80 void TrackEvent::trace(Visitor* visitor) | 81 void TrackEvent::trace(Visitor* visitor) |
81 { | 82 { |
82 visitor->trace(m_track); | 83 visitor->trace(m_track); |
83 Event::trace(visitor); | 84 Event::trace(visitor); |
84 } | 85 } |
85 | 86 |
86 } // namespace blink | 87 } // namespace blink |
87 | 88 |
OLD | NEW |