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

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

Issue 15959010: Fix scheduleEvent() crash. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/html/HTMLMediaElement.h ('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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 , m_loadInitiatedByUserGesture(false) 236 , m_loadInitiatedByUserGesture(false)
237 , m_completelyLoaded(false) 237 , m_completelyLoaded(false)
238 , m_havePreparedToPlay(false) 238 , m_havePreparedToPlay(false)
239 , m_parsingInProgress(createdByParser) 239 , m_parsingInProgress(createdByParser)
240 , m_tracksAreReady(true) 240 , m_tracksAreReady(true)
241 , m_haveVisibleTextTrack(false) 241 , m_haveVisibleTextTrack(false)
242 , m_processingPreferenceChange(false) 242 , m_processingPreferenceChange(false)
243 , m_lastTextTrackUpdateTime(-1) 243 , m_lastTextTrackUpdateTime(-1)
244 , m_textTracks(0) 244 , m_textTracks(0)
245 , m_ignoreTrackDisplayUpdate(0) 245 , m_ignoreTrackDisplayUpdate(0)
246 , m_inDestructor(false)
246 #if ENABLE(WEB_AUDIO) 247 #if ENABLE(WEB_AUDIO)
247 , m_audioSourceNode(0) 248 , m_audioSourceNode(0)
248 #endif 249 #endif
249 { 250 {
250 ASSERT(RuntimeEnabledFeatures::mediaEnabled()); 251 ASSERT(RuntimeEnabledFeatures::mediaEnabled());
251 252
252 LOG(Media, "HTMLMediaElement::HTMLMediaElement"); 253 LOG(Media, "HTMLMediaElement::HTMLMediaElement");
253 ScriptWrappable::init(this); 254 ScriptWrappable::init(this);
254 255
255 if (document->settings() && document->settings()->mediaPlaybackRequiresUserG esture()) { 256 if (document->settings() && document->settings()->mediaPlaybackRequiresUserG esture()) {
256 addBehaviorRestriction(RequireUserGestureForRateChangeRestriction); 257 addBehaviorRestriction(RequireUserGestureForRateChangeRestriction);
257 addBehaviorRestriction(RequireUserGestureForLoadRestriction); 258 addBehaviorRestriction(RequireUserGestureForLoadRestriction);
258 } 259 }
259 260
260 setHasCustomStyleCallbacks(); 261 setHasCustomStyleCallbacks();
261 addElementToDocumentMap(this, document); 262 addElementToDocumentMap(this, document);
262 263
263 document->registerForCaptionPreferencesChangedCallbacks(this); 264 document->registerForCaptionPreferencesChangedCallbacks(this);
264 } 265 }
265 266
266 HTMLMediaElement::~HTMLMediaElement() 267 HTMLMediaElement::~HTMLMediaElement()
267 { 268 {
268 LOG(Media, "HTMLMediaElement::~HTMLMediaElement"); 269 LOG(Media, "HTMLMediaElement::~HTMLMediaElement");
270 m_inDestructor = true;
271
269 setShouldDelayLoadEvent(false); 272 setShouldDelayLoadEvent(false);
270 document()->unregisterForCaptionPreferencesChangedCallbacks(this); 273 document()->unregisterForCaptionPreferencesChangedCallbacks(this);
271 if (m_textTracks) 274 if (m_textTracks)
272 m_textTracks->clearOwner(); 275 m_textTracks->clearOwner();
273 if (m_textTracks) { 276 if (m_textTracks) {
274 for (unsigned i = 0; i < m_textTracks->length(); ++i) 277 for (unsigned i = 0; i < m_textTracks->length(); ++i)
275 m_textTracks->item(i)->clearClient(); 278 m_textTracks->item(i)->clearClient();
276 } 279 }
277 280
278 if (m_mediaController) 281 if (m_mediaController)
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 // Schedule the timer to try the next <source> element WITHOUT resetting sta te ala prepareForLoad. 515 // Schedule the timer to try the next <source> element WITHOUT resetting sta te ala prepareForLoad.
513 m_pendingActionFlags |= LoadMediaResource; 516 m_pendingActionFlags |= LoadMediaResource;
514 m_loadTimer.startOneShot(0); 517 m_loadTimer.startOneShot(0);
515 } 518 }
516 519
517 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) 520 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName)
518 { 521 {
519 #if LOG_MEDIA_EVENTS 522 #if LOG_MEDIA_EVENTS
520 LOG(Media, "HTMLMediaElement::scheduleEvent - scheduling '%s'", eventName.st ring().ascii().data()); 523 LOG(Media, "HTMLMediaElement::scheduleEvent - scheduling '%s'", eventName.st ring().ascii().data());
521 #endif 524 #endif
525 if (m_inDestructor)
526 return;
522 RefPtr<Event> event = Event::create(eventName, false, true); 527 RefPtr<Event> event = Event::create(eventName, false, true);
523 event->setTarget(this); 528 event->setTarget(this);
524 529
525 m_asyncEventQueue->enqueueEvent(event.release()); 530 m_asyncEventQueue->enqueueEvent(event.release());
526 } 531 }
527 532
528 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) 533 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*)
529 { 534 {
530 RefPtr<HTMLMediaElement> protect(this); // loadNextSourceChild may fire 'bef oreload', which can make arbitrary DOM mutations. 535 RefPtr<HTMLMediaElement> protect(this); // loadNextSourceChild may fire 'bef oreload', which can make arbitrary DOM mutations.
531 536
(...skipping 3488 matching lines...) Expand 10 before | Expand all | Expand 10 after
4020 info.addMember(m_mediaGroup, "mediaGroup"); 4025 info.addMember(m_mediaGroup, "mediaGroup");
4021 info.addMember(m_mediaController, "mediaController"); 4026 info.addMember(m_mediaController, "mediaController");
4022 4027
4023 #if ENABLE(WEB_AUDIO) 4028 #if ENABLE(WEB_AUDIO)
4024 info.addMember(m_audioSourceNode, "audioSourceNode"); 4029 info.addMember(m_audioSourceNode, "audioSourceNode");
4025 #endif 4030 #endif
4026 4031
4027 } 4032 }
4028 4033
4029 } 4034 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698