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

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

Issue 285743004: Redundant call to closeMediaSource and unnecessary condition in createMediaPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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 | « no previous file | 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 632
633 // 2 - If there are any tasks from the media element's media element event t ask source in 633 // 2 - If there are any tasks from the media element's media element event t ask source in
634 // one of the task queues, then remove those tasks. 634 // one of the task queues, then remove those tasks.
635 cancelPendingEventsAndCallbacks(); 635 cancelPendingEventsAndCallbacks();
636 636
637 // 3 - If the media element's networkState is set to NETWORK_LOADING or NETW ORK_IDLE, queue 637 // 3 - If the media element's networkState is set to NETWORK_LOADING or NETW ORK_IDLE, queue
638 // a task to fire a simple event named abort at the media element. 638 // a task to fire a simple event named abort at the media element.
639 if (m_networkState == NETWORK_LOADING || m_networkState == NETWORK_IDLE) 639 if (m_networkState == NETWORK_LOADING || m_networkState == NETWORK_IDLE)
640 scheduleEvent(EventTypeNames::abort); 640 scheduleEvent(EventTypeNames::abort);
641 641
642 closeMediaSource();
643
644 createMediaPlayer(); 642 createMediaPlayer();
645 643
646 // 4 - If the media element's networkState is not set to NETWORK_EMPTY, then run these substeps 644 // 4 - If the media element's networkState is not set to NETWORK_EMPTY, then run these substeps
647 if (m_networkState != NETWORK_EMPTY) { 645 if (m_networkState != NETWORK_EMPTY) {
648 // 4.1 - Queue a task to fire a simple event named emptied at the media element. 646 // 4.1 - Queue a task to fire a simple event named emptied at the media element.
649 scheduleEvent(EventTypeNames::emptied); 647 scheduleEvent(EventTypeNames::emptied);
650 648
651 // 4.2 - If a fetching process is in progress for the media element, the user agent should stop it. 649 // 4.2 - If a fetching process is in progress for the media element, the user agent should stop it.
652 m_networkState = NETWORK_EMPTY; 650 m_networkState = NETWORK_EMPTY;
653 651
(...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after
3397 return 0; 3395 return 0;
3398 } 3396 }
3399 3397
3400 void HTMLMediaElement::createMediaPlayer() 3398 void HTMLMediaElement::createMediaPlayer()
3401 { 3399 {
3402 #if ENABLE(WEB_AUDIO) 3400 #if ENABLE(WEB_AUDIO)
3403 if (m_audioSourceNode) 3401 if (m_audioSourceNode)
3404 m_audioSourceNode->lock(); 3402 m_audioSourceNode->lock();
3405 #endif 3403 #endif
3406 3404
3407 if (m_mediaSource) 3405 closeMediaSource();
3408 closeMediaSource();
3409 3406
3410 m_player = MediaPlayer::create(this); 3407 m_player = MediaPlayer::create(this);
3411 3408
3412 #if ENABLE(WEB_AUDIO) 3409 #if ENABLE(WEB_AUDIO)
3413 if (m_audioSourceNode) { 3410 if (m_audioSourceNode) {
3414 // When creating the player, make sure its AudioSourceProvider knows abo ut the client. 3411 // When creating the player, make sure its AudioSourceProvider knows abo ut the client.
3415 if (audioSourceProvider()) 3412 if (audioSourceProvider())
3416 audioSourceProvider()->setClient(m_audioSourceNode); 3413 audioSourceProvider()->setClient(m_audioSourceNode);
3417 3414
3418 m_audioSourceNode->unlock(); 3415 m_audioSourceNode->unlock();
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
3618 3615
3619 void HTMLMediaElement::trace(Visitor* visitor) 3616 void HTMLMediaElement::trace(Visitor* visitor)
3620 { 3617 {
3621 visitor->trace(m_textTracks); 3618 visitor->trace(m_textTracks);
3622 visitor->trace(m_textTracksWhenResourceSelectionBegan); 3619 visitor->trace(m_textTracksWhenResourceSelectionBegan);
3623 Supplementable<HTMLMediaElement>::trace(visitor); 3620 Supplementable<HTMLMediaElement>::trace(visitor);
3624 HTMLElement::trace(visitor); 3621 HTMLElement::trace(visitor);
3625 } 3622 }
3626 3623
3627 } 3624 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698