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

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

Issue 363953002: Oilpan: have the media element safely close its MediaSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tidy clearing of m_attachedElement Created 6 years, 5 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/HTMLMediaElement.h ('k') | Source/core/html/HTMLMediaSource.h » ('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) 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 , m_sentEndEvent(false) 325 , m_sentEndEvent(false)
326 , m_pausedInternal(false) 326 , m_pausedInternal(false)
327 , m_closedCaptionsVisible(false) 327 , m_closedCaptionsVisible(false)
328 , m_completelyLoaded(false) 328 , m_completelyLoaded(false)
329 , m_havePreparedToPlay(false) 329 , m_havePreparedToPlay(false)
330 , m_tracksAreReady(true) 330 , m_tracksAreReady(true)
331 , m_haveVisibleTextTrack(false) 331 , m_haveVisibleTextTrack(false)
332 , m_processingPreferenceChange(false) 332 , m_processingPreferenceChange(false)
333 #if ENABLE(OILPAN) 333 #if ENABLE(OILPAN)
334 , m_isFinalizing(false) 334 , m_isFinalizing(false)
335 , m_closeMediaSourceWhenFinalizing(false)
335 #endif 336 #endif
336 , m_lastTextTrackUpdateTime(-1) 337 , m_lastTextTrackUpdateTime(-1)
337 , m_audioTracks(AudioTrackList::create(*this)) 338 , m_audioTracks(AudioTrackList::create(*this))
338 , m_videoTracks(VideoTrackList::create(*this)) 339 , m_videoTracks(VideoTrackList::create(*this))
339 , m_textTracks(nullptr) 340 , m_textTracks(nullptr)
340 , m_ignoreTrackDisplayUpdate(0) 341 , m_ignoreTrackDisplayUpdate(0)
341 #if ENABLE(WEB_AUDIO) 342 #if ENABLE(WEB_AUDIO)
342 , m_audioSourceNode(nullptr) 343 , m_audioSourceNode(nullptr)
343 #endif 344 #endif
344 { 345 {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 m_textTracks->clearOwner(); 384 m_textTracks->clearOwner();
384 m_audioTracks->shutdown(); 385 m_audioTracks->shutdown();
385 m_videoTracks->shutdown(); 386 m_videoTracks->shutdown();
386 387
387 if (m_mediaController) { 388 if (m_mediaController) {
388 m_mediaController->removeMediaElement(this); 389 m_mediaController->removeMediaElement(this);
389 m_mediaController = nullptr; 390 m_mediaController = nullptr;
390 } 391 }
391 #endif 392 #endif
392 393
394 #if ENABLE(OILPAN)
395 if (m_closeMediaSourceWhenFinalizing)
396 closeMediaSource();
397 #else
393 closeMediaSource(); 398 closeMediaSource();
394 399
395 #if !ENABLE(OILPAN)
396 removeElementFromDocumentMap(this, &document()); 400 removeElementFromDocumentMap(this, &document());
397 #endif 401 #endif
398 402
399 // Destroying the player may cause a resource load to be canceled, 403 // Destroying the player may cause a resource load to be canceled,
400 // which could result in userCancelledLoad() being called back. 404 // which could result in userCancelledLoad() being called back.
401 // Setting m_completelyLoaded ensures that such a call will not cause 405 // Setting m_completelyLoaded ensures that such a call will not cause
402 // us to dispatch an abort event, which would result in a crash. 406 // us to dispatch an abort event, which would result in a crash.
403 // See http://crbug.com/233654 for more details. 407 // See http://crbug.com/233654 for more details.
404 m_completelyLoaded = true; 408 m_completelyLoaded = true;
405 409
(...skipping 30 matching lines...) Expand all
436 #if ENABLE(WEB_AUDIO) && !ENABLE(OILPAN) 440 #if ENABLE(WEB_AUDIO) && !ENABLE(OILPAN)
437 ASSERT(!m_audioSourceNode); 441 ASSERT(!m_audioSourceNode);
438 #endif 442 #endif
439 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); 443 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking();
440 444
441 #if !ENABLE(OILPAN) 445 #if !ENABLE(OILPAN)
442 document().decrementLoadEventDelayCount(); 446 document().decrementLoadEventDelayCount();
443 #endif 447 #endif
444 } 448 }
445 449
450 #if ENABLE(OILPAN)
451 void HTMLMediaElement::setCloseMediaSourceWhenFinalizing()
452 {
453 ASSERT(!m_closeMediaSourceWhenFinalizing);
454 m_closeMediaSourceWhenFinalizing = true;
455 }
456 #endif
457
446 void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument) 458 void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument)
447 { 459 {
448 WTF_LOG(Media, "HTMLMediaElement::didMoveToNewDocument"); 460 WTF_LOG(Media, "HTMLMediaElement::didMoveToNewDocument");
449 461
450 if (m_shouldDelayLoadEvent) { 462 if (m_shouldDelayLoadEvent) {
451 document().incrementLoadEventDelayCount(); 463 document().incrementLoadEventDelayCount();
452 // Note: Keeping the load event delay count increment on oldDocument tha t was added 464 // Note: Keeping the load event delay count increment on oldDocument tha t was added
453 // when m_shouldDelayLoadEvent was set so that destruction of m_player c an not 465 // when m_shouldDelayLoadEvent was set so that destruction of m_player c an not
454 // cause load event dispatching in oldDocument. 466 // cause load event dispatching in oldDocument.
455 } else { 467 } else {
(...skipping 3451 matching lines...) Expand 10 before | Expand all | Expand 10 after
3907 } 3919 }
3908 HTMLElement::defaultEventHandler(event); 3920 HTMLElement::defaultEventHandler(event);
3909 } 3921 }
3910 3922
3911 void HTMLMediaElement::trace(Visitor* visitor) 3923 void HTMLMediaElement::trace(Visitor* visitor)
3912 { 3924 {
3913 visitor->trace(m_asyncEventQueue); 3925 visitor->trace(m_asyncEventQueue);
3914 visitor->trace(m_error); 3926 visitor->trace(m_error);
3915 visitor->trace(m_currentSourceNode); 3927 visitor->trace(m_currentSourceNode);
3916 visitor->trace(m_nextChildNodeToConsider); 3928 visitor->trace(m_nextChildNodeToConsider);
3929 visitor->trace(m_mediaSource);
3917 visitor->trace(m_audioTracks); 3930 visitor->trace(m_audioTracks);
3918 visitor->trace(m_videoTracks); 3931 visitor->trace(m_videoTracks);
3919 visitor->trace(m_textTracks); 3932 visitor->trace(m_textTracks);
3920 visitor->trace(m_textTracksWhenResourceSelectionBegan); 3933 visitor->trace(m_textTracksWhenResourceSelectionBegan);
3921 visitor->trace(m_mediaController); 3934 visitor->trace(m_mediaController);
3922 #if ENABLE(WEB_AUDIO) 3935 #if ENABLE(WEB_AUDIO)
3923 visitor->registerWeakMembers<HTMLMediaElement, &HTMLMediaElement::clearWeakM embers>(this); 3936 visitor->registerWeakMembers<HTMLMediaElement, &HTMLMediaElement::clearWeakM embers>(this);
3924 #endif 3937 #endif
3925 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); 3938 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor);
3926 HTMLElement::trace(visitor); 3939 HTMLElement::trace(visitor);
(...skipping 29 matching lines...) Expand all
3956 3969
3957 #if ENABLE(WEB_AUDIO) 3970 #if ENABLE(WEB_AUDIO)
3958 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 3971 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3959 { 3972 {
3960 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) 3973 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider())
3961 audioSourceProvider()->setClient(0); 3974 audioSourceProvider()->setClient(0);
3962 } 3975 }
3963 #endif 3976 #endif
3964 3977
3965 } 3978 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/core/html/HTMLMediaSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698