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

Side by Side Diff: Source/core/html/track/TextTrack.cpp

Issue 244493002: Oilpan: add transition types to track interface objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add crbug.com/365260 crashing test + expectation Created 6 years, 8 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
« no previous file with comments | « Source/core/html/track/TextTrack.h ('k') | Source/core/html/track/TextTrack.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 const AtomicString& TextTrack::showingKeyword() 92 const AtomicString& TextTrack::showingKeyword()
93 { 93 {
94 DEFINE_STATIC_LOCAL(const AtomicString, ended, ("showing", AtomicString::Con structFromLiteral)); 94 DEFINE_STATIC_LOCAL(const AtomicString, ended, ("showing", AtomicString::Con structFromLiteral));
95 return ended; 95 return ended;
96 } 96 }
97 97
98 TextTrack::TextTrack(Document& document, const AtomicString& kind, const AtomicS tring& label, const AtomicString& language, const AtomicString& id, TextTrackTyp e type) 98 TextTrack::TextTrack(Document& document, const AtomicString& kind, const AtomicS tring& label, const AtomicString& language, const AtomicString& id, TextTrackTyp e type)
99 : TrackBase(TrackBase::TextTrack, label, language, id) 99 : TrackBase(TrackBase::TextTrack, label, language, id)
100 , m_cues(nullptr) 100 , m_cues(nullptr)
101 , m_regions(nullptr) 101 , m_regions(nullptr)
102 , m_document(&document) 102 , m_trackList(nullptr)
103 , m_trackList(0)
104 , m_mode(disabledKeyword()) 103 , m_mode(disabledKeyword())
105 , m_trackType(type) 104 , m_trackType(type)
106 , m_readinessState(NotLoaded) 105 , m_readinessState(NotLoaded)
107 , m_trackIndex(invalidTrackIndex) 106 , m_trackIndex(invalidTrackIndex)
108 , m_renderedTrackIndex(invalidTrackIndex) 107 , m_renderedTrackIndex(invalidTrackIndex)
109 , m_hasBeenConfigured(false) 108 , m_hasBeenConfigured(false)
110 { 109 {
111 ScriptWrappable::init(this); 110 ScriptWrappable::init(this);
112 setKind(kind); 111 setKind(kind);
113 } 112 }
114 113
115 TextTrack::~TextTrack() 114 TextTrack::~TextTrack()
116 { 115 {
116 #if !ENABLE(OILPAN)
117 ASSERT(!m_trackList); 117 ASSERT(!m_trackList);
118 118
119 if (m_cues) { 119 if (m_cues) {
120 for (size_t i = 0; i < m_cues->length(); ++i) 120 for (size_t i = 0; i < m_cues->length(); ++i)
121 m_cues->item(i)->setTrack(0); 121 m_cues->item(i)->setTrack(0);
122 } 122 }
123
124 if (m_regions) { 123 if (m_regions) {
125 for (size_t i = 0; i < m_regions->length(); ++i) 124 for (size_t i = 0; i < m_regions->length(); ++i)
126 m_regions->item(i)->setTrack(0); 125 m_regions->item(i)->setTrack(0);
127 } 126 }
127 #endif
128 } 128 }
129 129
130 bool TextTrack::isValidKindKeyword(const AtomicString& value) 130 bool TextTrack::isValidKindKeyword(const AtomicString& value)
131 { 131 {
132 if (value == subtitlesKeyword()) 132 if (value == subtitlesKeyword())
133 return true; 133 return true;
134 if (value == captionsKeyword()) 134 if (value == captionsKeyword())
135 return true; 135 return true;
136 if (value == descriptionsKeyword()) 136 if (value == descriptionsKeyword())
137 return true; 137 return true;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // then the activeCues attribute must return a live TextTrackCueList object ... 217 // then the activeCues attribute must return a live TextTrackCueList object ...
218 // ... whose active flag was set when the script started, in text track cue 218 // ... whose active flag was set when the script started, in text track cue
219 // order. Otherwise, it must return null. When an object is returned, the 219 // order. Otherwise, it must return null. When an object is returned, the
220 // same object must be returned each time. 220 // same object must be returned each time.
221 // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-activecu es 221 // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-activecu es
222 if (m_cues && m_mode != disabledKeyword()) 222 if (m_cues && m_mode != disabledKeyword())
223 return m_cues->activeCues(); 223 return m_cues->activeCues();
224 return 0; 224 return 0;
225 } 225 }
226 226
227 void TextTrack::addCue(PassRefPtr<TextTrackCue> prpCue) 227 void TextTrack::addCue(PassRefPtrWillBeRawPtr<TextTrackCue> prpCue)
228 { 228 {
229 if (!prpCue) 229 if (!prpCue)
230 return; 230 return;
231 231
232 RefPtr<TextTrackCue> cue = prpCue; 232 RefPtrWillBeRawPtr<TextTrackCue> cue = prpCue;
233 233
234 // TODO(93143): Add spec-compliant behavior for negative time values. 234 // TODO(93143): Add spec-compliant behavior for negative time values.
235 if (std::isnan(cue->startTime()) || std::isnan(cue->endTime()) || cue->start Time() < 0 || cue->endTime() < 0) 235 if (std::isnan(cue->startTime()) || std::isnan(cue->endTime()) || cue->start Time() < 0 || cue->endTime() < 0)
236 return; 236 return;
237 237
238 // 4.8.10.12.5 Text track API 238 // 4.8.10.12.5 Text track API
239 239
240 // The addCue(cue) method of TextTrack objects, when invoked, must run the f ollowing steps: 240 // The addCue(cue) method of TextTrack objects, when invoked, must run the f ollowing steps:
241 241
242 // 1. If the given cue is in a text track list of cues, then remove cue from that text track 242 // 1. If the given cue is in a text track list of cues, then remove cue from that text track
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // represents is not the text track disabled mode, then the regions 294 // represents is not the text track disabled mode, then the regions
295 // attribute must return a live VTTRegionList object that represents 295 // attribute must return a live VTTRegionList object that represents
296 // the text track list of regions of the text track. Otherwise, it must 296 // the text track list of regions of the text track. Otherwise, it must
297 // return null. When an object is returned, the same object must be returned 297 // return null. When an object is returned, the same object must be returned
298 // each time. 298 // each time.
299 if (RuntimeEnabledFeatures::webVTTRegionsEnabled() && m_mode != disabledKeyw ord()) 299 if (RuntimeEnabledFeatures::webVTTRegionsEnabled() && m_mode != disabledKeyw ord())
300 return ensureVTTRegionList(); 300 return ensureVTTRegionList();
301 return 0; 301 return 0;
302 } 302 }
303 303
304 void TextTrack::addRegion(PassRefPtr<VTTRegion> prpRegion) 304 void TextTrack::addRegion(PassRefPtrWillBeRawPtr<VTTRegion> prpRegion)
305 { 305 {
306 if (!prpRegion) 306 if (!prpRegion)
307 return; 307 return;
308 308
309 RefPtr<VTTRegion> region = prpRegion; 309 RefPtrWillBeRawPtr<VTTRegion> region = prpRegion;
310 VTTRegionList* regionList = ensureVTTRegionList(); 310 VTTRegionList* regionList = ensureVTTRegionList();
311 311
312 // 1. If the given region is in a text track list of regions, then remove 312 // 1. If the given region is in a text track list of regions, then remove
313 // region from that text track list of regions. 313 // region from that text track list of regions.
314 TextTrack* regionTrack = region->track(); 314 TextTrack* regionTrack = region->track();
315 if (regionTrack && regionTrack != this) 315 if (regionTrack && regionTrack != this)
316 regionTrack->removeRegion(region.get(), ASSERT_NO_EXCEPTION); 316 regionTrack->removeRegion(region.get(), ASSERT_NO_EXCEPTION);
317 317
318 // 2. If the method's TextTrack object's text track list of regions contains 318 // 2. If the method's TextTrack object's text track list of regions contains
319 // a region with the same identifier as region replace the values of that 319 // a region with the same identifier as region replace the values of that
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 return m_renderedTrackIndex; 418 return m_renderedTrackIndex;
419 } 419 }
420 420
421 const AtomicString& TextTrack::interfaceName() const 421 const AtomicString& TextTrack::interfaceName() const
422 { 422 {
423 return EventTargetNames::TextTrack; 423 return EventTargetNames::TextTrack;
424 } 424 }
425 425
426 ExecutionContext* TextTrack::executionContext() const 426 ExecutionContext* TextTrack::executionContext() const
427 { 427 {
428 return m_document; 428 HTMLMediaElement* owner = mediaElement();
429 return owner ? owner->executionContext() : 0;
429 } 430 }
430 431
431 HTMLMediaElement* TextTrack::mediaElement() const 432 HTMLMediaElement* TextTrack::mediaElement() const
432 { 433 {
433 return m_trackList ? m_trackList->owner() : 0; 434 return m_trackList ? m_trackList->owner() : 0;
434 } 435 }
435 436
436 Node* TextTrack::owner() const 437 Node* TextTrack::owner() const
437 { 438 {
438 return mediaElement(); 439 return mediaElement();
439 } 440 }
440 441
442 void TextTrack::trace(Visitor* visitor)
443 {
444 visitor->trace(m_cues);
445 visitor->trace(m_regions);
446 visitor->trace(m_trackList);
447 TrackBase::trace(visitor);
448 }
449
441 } // namespace WebCore 450 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/track/TextTrack.h ('k') | Source/core/html/track/TextTrack.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698