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

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 15739014: Avoid referencing an HTMLMediaElement if is currently being deleted (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed build error again Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/GenericEventQueue.cpp ('k') | no next file » | 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) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 283 }
284 284
285 setHasCustomStyleCallbacks(); 285 setHasCustomStyleCallbacks();
286 addElementToDocumentMap(this, document); 286 addElementToDocumentMap(this, document);
287 287
288 } 288 }
289 289
290 HTMLMediaElement::~HTMLMediaElement() 290 HTMLMediaElement::~HTMLMediaElement()
291 { 291 {
292 LOG(Media, "HTMLMediaElement::~HTMLMediaElement"); 292 LOG(Media, "HTMLMediaElement::~HTMLMediaElement");
293
294 m_asyncEventQueue->close();
295
293 setShouldDelayLoadEvent(false); 296 setShouldDelayLoadEvent(false);
294 if (m_textTracks) 297 if (m_textTracks)
295 m_textTracks->clearOwner(); 298 m_textTracks->clearOwner();
296 if (m_textTracks) { 299 if (m_textTracks) {
297 for (unsigned i = 0; i < m_textTracks->length(); ++i) 300 for (unsigned i = 0; i < m_textTracks->length(); ++i)
298 m_textTracks->item(i)->clearClient(); 301 m_textTracks->item(i)->clearClient();
299 } 302 }
300 303
301 if (m_mediaController) 304 if (m_mediaController)
302 m_mediaController->removeMediaElement(this); 305 m_mediaController->removeMediaElement(this);
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 // Schedule the timer to try the next <source> element WITHOUT resetting sta te ala prepareForLoad. 538 // Schedule the timer to try the next <source> element WITHOUT resetting sta te ala prepareForLoad.
536 m_pendingActionFlags |= LoadMediaResource; 539 m_pendingActionFlags |= LoadMediaResource;
537 m_loadTimer.startOneShot(0); 540 m_loadTimer.startOneShot(0);
538 } 541 }
539 542
540 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) 543 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName)
541 { 544 {
542 #if LOG_MEDIA_EVENTS 545 #if LOG_MEDIA_EVENTS
543 LOG(Media, "HTMLMediaElement::scheduleEvent - scheduling '%s'", eventName.st ring().ascii().data()); 546 LOG(Media, "HTMLMediaElement::scheduleEvent - scheduling '%s'", eventName.st ring().ascii().data());
544 #endif 547 #endif
548
545 RefPtr<Event> event = Event::create(eventName, false, true); 549 RefPtr<Event> event = Event::create(eventName, false, true);
546 event->setTarget(this);
547
548 m_asyncEventQueue->enqueueEvent(event.release()); 550 m_asyncEventQueue->enqueueEvent(event.release());
549 } 551 }
550 552
551 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) 553 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*)
552 { 554 {
553 RefPtr<HTMLMediaElement> protect(this); // loadNextSourceChild may fire 'bef oreload', which can make arbitrary DOM mutations. 555 RefPtr<HTMLMediaElement> protect(this); // loadNextSourceChild may fire 'bef oreload', which can make arbitrary DOM mutations.
554 556
555 if (RuntimeEnabledFeatures::videoTrackEnabled() && (m_pendingActionFlags & L oadTextTrackResource)) 557 if (RuntimeEnabledFeatures::videoTrackEnabled() && (m_pendingActionFlags & L oadTextTrackResource))
556 configureTextTracks(); 558 configureTextTracks();
557 559
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 900
899 // 12 - Further sort tasks in events that have the same time by the 901 // 12 - Further sort tasks in events that have the same time by the
900 // relative text track cue order of the text track cues associated 902 // relative text track cue order of the text track cues associated
901 // with these tasks. 903 // with these tasks.
902 return a.second->cueIndex() - b.second->cueIndex() < 0; 904 return a.second->cueIndex() - b.second->cueIndex() < 0;
903 } 905 }
904 906
905 907
906 void HTMLMediaElement::updateActiveTextTrackCues(double movieTime) 908 void HTMLMediaElement::updateActiveTextTrackCues(double movieTime)
907 { 909 {
908 LOG(Media, "HTMLMediaElement::updateActiveTextTrackCues");
909
910 // 4.8.10.8 Playing the media resource 910 // 4.8.10.8 Playing the media resource
911 911
912 // If the current playback position changes while the steps are running, 912 // If the current playback position changes while the steps are running,
913 // then the user agent must wait for the steps to complete, and then must 913 // then the user agent must wait for the steps to complete, and then must
914 // immediately rerun the steps. 914 // immediately rerun the steps.
915 if (ignoreTrackDisplayUpdateRequests()) 915 if (ignoreTrackDisplayUpdateRequests())
916 return; 916 return;
917 917
918 LOG(Media, "HTMLMediaElement::updateActiveTextTrackCues");
919
918 // 1 - Let current cues be a list of cues, initialized to contain all the 920 // 1 - Let current cues be a list of cues, initialized to contain all the
919 // cues of all the hidden, showing, or showing by default text tracks of the 921 // cues of all the hidden, showing, or showing by default text tracks of the
920 // media element (not the disabled ones) whose start times are less than or 922 // media element (not the disabled ones) whose start times are less than or
921 // equal to the current playback position and whose end times are greater 923 // equal to the current playback position and whose end times are greater
922 // than the current playback position. 924 // than the current playback position.
923 CueList currentCues; 925 CueList currentCues;
924 926
925 // The user agent must synchronously unset [the text track cue active] flag 927 // The user agent must synchronously unset [the text track cue active] flag
926 // whenever ... the media element's readyState is changed back to HAVE_NOTHI NG. 928 // whenever ... the media element's readyState is changed back to HAVE_NOTHI NG.
927 if (m_readyState != HAVE_NOTHING && m_player) 929 if (m_readyState != HAVE_NOTHING && m_player)
(...skipping 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after
3501 3503
3502 // Stop the playback without generating events 3504 // Stop the playback without generating events
3503 m_playing = false; 3505 m_playing = false;
3504 setPausedInternal(true); 3506 setPausedInternal(true);
3505 3507
3506 if (renderer()) 3508 if (renderer())
3507 renderer()->updateFromElement(); 3509 renderer()->updateFromElement();
3508 3510
3509 stopPeriodicTimers(); 3511 stopPeriodicTimers();
3510 cancelPendingEventsAndCallbacks(); 3512 cancelPendingEventsAndCallbacks();
3513
3514 m_asyncEventQueue->close();
3511 } 3515 }
3512 3516
3513 void HTMLMediaElement::suspend(ReasonForSuspension why) 3517 void HTMLMediaElement::suspend(ReasonForSuspension why)
3514 { 3518 {
3515 LOG(Media, "HTMLMediaElement::suspend"); 3519 LOG(Media, "HTMLMediaElement::suspend");
3516 3520
3517 switch (why) 3521 switch (why)
3518 { 3522 {
3519 case DocumentWillBecomeInactive: 3523 case DocumentWillBecomeInactive:
3520 stop(); 3524 stop();
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
4031 info.addMember(m_mediaGroup, "mediaGroup"); 4035 info.addMember(m_mediaGroup, "mediaGroup");
4032 info.addMember(m_mediaController, "mediaController"); 4036 info.addMember(m_mediaController, "mediaController");
4033 4037
4034 #if ENABLE(WEB_AUDIO) 4038 #if ENABLE(WEB_AUDIO)
4035 info.addMember(m_audioSourceNode, "audioSourceNode"); 4039 info.addMember(m_audioSourceNode, "audioSourceNode");
4036 #endif 4040 #endif
4037 4041
4038 } 4042 }
4039 4043
4040 } 4044 }
OLDNEW
« no previous file with comments | « Source/core/dom/GenericEventQueue.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698