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

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

Issue 9910031: Merge 111895 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 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/WebCore/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 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv ed.
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 , m_networkState(NETWORK_EMPTY) 183 , m_networkState(NETWORK_EMPTY)
184 , m_readyState(HAVE_NOTHING) 184 , m_readyState(HAVE_NOTHING)
185 , m_readyStateMaximum(HAVE_NOTHING) 185 , m_readyStateMaximum(HAVE_NOTHING)
186 , m_volume(1.0f) 186 , m_volume(1.0f)
187 , m_lastSeekTime(0) 187 , m_lastSeekTime(0)
188 , m_previousProgress(0) 188 , m_previousProgress(0)
189 , m_previousProgressTime(numeric_limits<double>::max()) 189 , m_previousProgressTime(numeric_limits<double>::max())
190 , m_lastTimeUpdateEventWallTime(0) 190 , m_lastTimeUpdateEventWallTime(0)
191 , m_lastTimeUpdateEventMovieTime(numeric_limits<float>::max()) 191 , m_lastTimeUpdateEventMovieTime(numeric_limits<float>::max())
192 , m_loadState(WaitingForSource) 192 , m_loadState(WaitingForSource)
193 , m_currentSourceNode(0)
194 , m_nextChildNodeToConsider(0)
195 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 193 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
196 , m_proxyWidget(0) 194 , m_proxyWidget(0)
197 #endif 195 #endif
198 , m_restrictions(RequireUserGestureForFullscreenRestriction | RequirePageCon sentToLoadMediaRestriction) 196 , m_restrictions(RequireUserGestureForFullscreenRestriction | RequirePageCon sentToLoadMediaRestriction)
199 , m_preload(MediaPlayer::Auto) 197 , m_preload(MediaPlayer::Auto)
200 , m_displayMode(Unknown) 198 , m_displayMode(Unknown)
201 , m_processingMediaPlayerCallback(0) 199 , m_processingMediaPlayerCallback(0)
202 #if ENABLE(MEDIA_SOURCE) 200 #if ENABLE(MEDIA_SOURCE)
203 , m_sourceState(SOURCE_CLOSED) 201 , m_sourceState(SOURCE_CLOSED)
204 #endif 202 #endif
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 LOG(Media, "HTMLMediaElement::scheduleEvent - scheduling '%s'", eventName.st ring().ascii().data()); 539 LOG(Media, "HTMLMediaElement::scheduleEvent - scheduling '%s'", eventName.st ring().ascii().data());
542 #endif 540 #endif
543 RefPtr<Event> event = Event::create(eventName, false, true); 541 RefPtr<Event> event = Event::create(eventName, false, true);
544 event->setTarget(this); 542 event->setTarget(this);
545 543
546 m_asyncEventQueue.enqueueEvent(event.release()); 544 m_asyncEventQueue.enqueueEvent(event.release());
547 } 545 }
548 546
549 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) 547 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*)
550 { 548 {
549 RefPtr<HTMLMediaElement> protect(this); // loadNextSourceChild may fire 'bef oreload', which can make arbitrary DOM mutations.
550
551 if (m_pendingLoadFlags & MediaResource) { 551 if (m_pendingLoadFlags & MediaResource) {
552 if (m_loadState == LoadingFromSourceElement) 552 if (m_loadState == LoadingFromSourceElement)
553 loadNextSourceChild(); 553 loadNextSourceChild();
554 else 554 else
555 loadInternal(); 555 loadInternal();
556 } 556 }
557 557
558 #if ENABLE(VIDEO_TRACK) 558 #if ENABLE(VIDEO_TRACK)
559 if (m_pendingLoadFlags & TextTrackResource) 559 if (m_pendingLoadFlags & TextTrackResource)
560 configureTextTracks(); 560 configureTextTracks();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 break; 597 break;
598 } 598 }
599 599
600 LOG(Media, "HTMLMediaElement::canPlayType(%s) -> %s", mimeType.utf8().data() , canPlay.utf8().data()); 600 LOG(Media, "HTMLMediaElement::canPlayType(%s) -> %s", mimeType.utf8().data() , canPlay.utf8().data());
601 601
602 return canPlay; 602 return canPlay;
603 } 603 }
604 604
605 void HTMLMediaElement::load(ExceptionCode& ec) 605 void HTMLMediaElement::load(ExceptionCode& ec)
606 { 606 {
607 RefPtr<HTMLMediaElement> protect(this); // loadInternal may result in a 'bef oreload' event, which can make arbitrary DOM mutations.
608
607 LOG(Media, "HTMLMediaElement::load()"); 609 LOG(Media, "HTMLMediaElement::load()");
608 610
609 if (userGestureRequiredForLoad() && !ScriptController::processingUserGesture ()) 611 if (userGestureRequiredForLoad() && !ScriptController::processingUserGesture ())
610 ec = INVALID_STATE_ERR; 612 ec = INVALID_STATE_ERR;
611 else { 613 else {
612 m_loadInitiatedByUserGesture = ScriptController::processingUserGesture() ; 614 m_loadInitiatedByUserGesture = ScriptController::processingUserGesture() ;
613 prepareForLoad(); 615 prepareForLoad();
614 loadInternal(); 616 loadInternal();
615 } 617 }
616 prepareToPlay(); 618 prepareToPlay();
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 for (node = firstChild(); node; node = node->nextSibling()) { 752 for (node = firstChild(); node; node = node->nextSibling()) {
751 if (node->hasTagName(sourceTag)) 753 if (node->hasTagName(sourceTag))
752 break; 754 break;
753 } 755 }
754 756
755 // Otherwise, if the media element does not have a src attribute but has a source 757 // Otherwise, if the media element does not have a src attribute but has a source
756 // element child, then let mode be children and let candidate be the fir st such 758 // element child, then let mode be children and let candidate be the fir st such
757 // source element child in tree order. 759 // source element child in tree order.
758 if (node) { 760 if (node) {
759 mode = children; 761 mode = children;
760 m_nextChildNodeToConsider = 0; 762 m_nextChildNodeToConsider = node;
761 m_currentSourceNode = 0; 763 m_currentSourceNode = 0;
762 } else { 764 } else {
763 // Otherwise the media element has neither a src attribute nor a sou rce element 765 // Otherwise the media element has neither a src attribute nor a sou rce element
764 // child: set the networkState to NETWORK_EMPTY, and abort these ste ps; the 766 // child: set the networkState to NETWORK_EMPTY, and abort these ste ps; the
765 // synchronous section ends. 767 // synchronous section ends.
766 m_loadState = WaitingForSource; 768 m_loadState = WaitingForSource;
767 setShouldDelayLoadEvent(false); 769 setShouldDelayLoadEvent(false);
768 m_networkState = NETWORK_EMPTY; 770 m_networkState = NETWORK_EMPTY;
769 771
770 LOG(Media, "HTMLMediaElement::selectMediaResource, nothing to load") ; 772 LOG(Media, "HTMLMediaElement::selectMediaResource, nothing to load") ;
(...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after
2444 configureTextTrack(trackElement); 2446 configureTextTrack(trackElement);
2445 } 2447 }
2446 } 2448 }
2447 2449
2448 #endif 2450 #endif
2449 2451
2450 bool HTMLMediaElement::havePotentialSourceChild() 2452 bool HTMLMediaElement::havePotentialSourceChild()
2451 { 2453 {
2452 // Stash the current <source> node and next nodes so we can restore them aft er checking 2454 // Stash the current <source> node and next nodes so we can restore them aft er checking
2453 // to see there is another potential. 2455 // to see there is another potential.
2454 HTMLSourceElement* currentSourceNode = m_currentSourceNode; 2456 RefPtr<HTMLSourceElement> currentSourceNode = m_currentSourceNode;
2455 Node* nextNode = m_nextChildNodeToConsider; 2457 RefPtr<Node> nextNode = m_nextChildNodeToConsider;
2456 2458
2457 KURL nextURL = selectNextSourceChild(0, DoNothing); 2459 KURL nextURL = selectNextSourceChild(0, DoNothing);
2458 2460
2459 m_currentSourceNode = currentSourceNode; 2461 m_currentSourceNode = currentSourceNode;
2460 m_nextChildNodeToConsider = nextNode; 2462 m_nextChildNodeToConsider = nextNode;
2461 2463
2462 return nextURL.isValid(); 2464 return nextURL.isValid();
2463 } 2465 }
2464 2466
2465 KURL HTMLMediaElement::selectNextSourceChild(ContentType *contentType, InvalidUR LAction actionIfInvalid) 2467 KURL HTMLMediaElement::selectNextSourceChild(ContentType *contentType, InvalidUR LAction actionIfInvalid)
2466 { 2468 {
2467 #if !LOG_DISABLED 2469 #if !LOG_DISABLED
2468 // Don't log if this was just called to find out if there are any valid <sou rce> elements. 2470 // Don't log if this was just called to find out if there are any valid <sou rce> elements.
2469 bool shouldLog = actionIfInvalid != DoNothing; 2471 bool shouldLog = actionIfInvalid != DoNothing;
2470 if (shouldLog) 2472 if (shouldLog)
2471 LOG(Media, "HTMLMediaElement::selectNextSourceChild"); 2473 LOG(Media, "HTMLMediaElement::selectNextSourceChild");
2472 #endif 2474 #endif
2473 2475
2474 if (m_nextChildNodeToConsider == sourceChildEndOfListValue()) { 2476 if (!m_nextChildNodeToConsider) {
2475 #if !LOG_DISABLED 2477 #if !LOG_DISABLED
2476 if (shouldLog) 2478 if (shouldLog)
2477 LOG(Media, "HTMLMediaElement::selectNextSourceChild -> 0x0000, \"\"" ); 2479 LOG(Media, "HTMLMediaElement::selectNextSourceChild -> 0x0000, \"\"" );
2478 #endif 2480 #endif
2479 return KURL(); 2481 return KURL();
2480 } 2482 }
2481 2483
2482 KURL mediaURL; 2484 KURL mediaURL;
2483 Node* node; 2485 Node* node;
2484 HTMLSourceElement* source = 0; 2486 HTMLSourceElement* source = 0;
2487 String type;
2485 bool lookingForStartNode = m_nextChildNodeToConsider; 2488 bool lookingForStartNode = m_nextChildNodeToConsider;
2486 bool canUse = false; 2489 bool canUseSourceElement = false;
2490 bool okToLoadSourceURL;
2487 2491
2488 for (node = firstChild(); !canUse && node; node = node->nextSibling()) { 2492 NodeVector potentialSourceNodes;
2493 getChildNodes(this, potentialSourceNodes);
2494
2495 for (unsigned i = 0; !canUseSourceElement && i < potentialSourceNodes.size() ; ++i) {
2496 node = potentialSourceNodes[i].get();
2489 if (lookingForStartNode && m_nextChildNodeToConsider != node) 2497 if (lookingForStartNode && m_nextChildNodeToConsider != node)
2490 continue; 2498 continue;
2491 lookingForStartNode = false; 2499 lookingForStartNode = false;
2492 2500
2493 if (!node->hasTagName(sourceTag)) 2501 if (!node->hasTagName(sourceTag))
2494 continue; 2502 continue;
2503 if (node->parentNode() != this)
2504 continue;
2495 2505
2496 source = static_cast<HTMLSourceElement*>(node); 2506 source = static_cast<HTMLSourceElement*>(node);
2497 2507
2498 // If candidate does not have a src attribute, or if its src attribute's value is the empty string ... jump down to the failed step below 2508 // If candidate does not have a src attribute, or if its src attribute's value is the empty string ... jump down to the failed step below
2499 mediaURL = source->getNonEmptyURLAttribute(srcAttr); 2509 mediaURL = source->getNonEmptyURLAttribute(srcAttr);
2500 #if !LOG_DISABLED 2510 #if !LOG_DISABLED
2501 if (shouldLog) 2511 if (shouldLog)
2502 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'src' is %s", urlForLogging(mediaURL).utf8().data()); 2512 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'src' is %s", urlForLogging(mediaURL).utf8().data());
2503 #endif 2513 #endif
2504 if (mediaURL.isEmpty()) 2514 if (mediaURL.isEmpty())
(...skipping 13 matching lines...) Expand all
2518 if (source->fastHasAttribute(typeAttr)) { 2528 if (source->fastHasAttribute(typeAttr)) {
2519 #if !LOG_DISABLED 2529 #if !LOG_DISABLED
2520 if (shouldLog) 2530 if (shouldLog)
2521 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'type' is %s", source->type().utf8().data()); 2531 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'type' is %s", source->type().utf8().data());
2522 #endif 2532 #endif
2523 if (!MediaPlayer::supportsType(ContentType(source->type()))) 2533 if (!MediaPlayer::supportsType(ContentType(source->type())))
2524 goto check_again; 2534 goto check_again;
2525 } 2535 }
2526 2536
2527 // Is it safe to load this url? 2537 // Is it safe to load this url?
2528 if (!isSafeToLoadURL(mediaURL, actionIfInvalid) || !dispatchBeforeLoadEv ent(mediaURL.string())) 2538 okToLoadSourceURL = isSafeToLoadURL(mediaURL, actionIfInvalid) && dispat chBeforeLoadEvent(mediaURL.string());
2539
2540 // A 'beforeload' event handler can mutate the DOM, so check to see if t he source element is still a child node.
2541 if (node->parentNode() != this) {
2542 LOG(Media, "HTMLMediaElement::selectNextSourceChild : 'beforeload' r emoved current element");
2543 source = 0;
2544 goto check_again;
2545 }
2546
2547 if (!okToLoadSourceURL)
2529 goto check_again; 2548 goto check_again;
2530 2549
2531 // Making it this far means the <source> looks reasonable. 2550 // Making it this far means the <source> looks reasonable.
2532 canUse = true; 2551 canUseSourceElement = true;
2533 2552
2534 check_again: 2553 check_again:
2535 if (!canUse && actionIfInvalid == Complain) 2554 if (!canUseSourceElement && actionIfInvalid == Complain && source)
2536 source->scheduleErrorEvent(); 2555 source->scheduleErrorEvent();
2537 } 2556 }
2538 2557
2539 if (canUse) { 2558 if (canUseSourceElement) {
2540 if (contentType) 2559 if (contentType)
2541 *contentType = ContentType(source->type()); 2560 *contentType = ContentType(source->type());
2542 m_currentSourceNode = source; 2561 m_currentSourceNode = source;
2543 m_nextChildNodeToConsider = source->nextSibling(); 2562 m_nextChildNodeToConsider = source->nextSibling();
2544 if (!m_nextChildNodeToConsider)
2545 m_nextChildNodeToConsider = sourceChildEndOfListValue();
2546 } else { 2563 } else {
2547 m_currentSourceNode = 0; 2564 m_currentSourceNode = 0;
2548 m_nextChildNodeToConsider = sourceChildEndOfListValue(); 2565 m_nextChildNodeToConsider = 0;
2549 } 2566 }
2550 2567
2551 #if !LOG_DISABLED 2568 #if !LOG_DISABLED
2552 if (shouldLog) 2569 if (shouldLog)
2553 LOG(Media, "HTMLMediaElement::selectNextSourceChild -> %p, %s", m_curren tSourceNode, canUse ? urlForLogging(mediaURL).utf8().data() : ""); 2570 LOG(Media, "HTMLMediaElement::selectNextSourceChild -> %p, %s", m_curren tSourceNode.get(), canUseSourceElement ? urlForLogging(mediaURL).utf8().data() : "");
2554 #endif 2571 #endif
2555 return canUse ? mediaURL : KURL(); 2572 return canUseSourceElement ? mediaURL : KURL();
2556 } 2573 }
2557 2574
2558 void HTMLMediaElement::sourceWasAdded(HTMLSourceElement* source) 2575 void HTMLMediaElement::sourceWasAdded(HTMLSourceElement* source)
2559 { 2576 {
2560 LOG(Media, "HTMLMediaElement::sourceWasAdded(%p)", source); 2577 LOG(Media, "HTMLMediaElement::sourceWasAdded(%p)", source);
2561 2578
2562 #if !LOG_DISABLED 2579 #if !LOG_DISABLED
2563 if (source->hasTagName(sourceTag)) { 2580 if (source->hasTagName(sourceTag)) {
2564 KURL url = source->getNonEmptyURLAttribute(srcAttr); 2581 KURL url = source->getNonEmptyURLAttribute(srcAttr);
2565 LOG(Media, "HTMLMediaElement::sourceWasAdded - 'src' is %s", urlForLoggi ng(url).utf8().data()); 2582 LOG(Media, "HTMLMediaElement::sourceWasAdded - 'src' is %s", urlForLoggi ng(url).utf8().data());
(...skipping 11 matching lines...) Expand all
2577 scheduleLoad(MediaResource); 2594 scheduleLoad(MediaResource);
2578 return; 2595 return;
2579 } 2596 }
2580 2597
2581 if (m_currentSourceNode && source == m_currentSourceNode->nextSibling()) { 2598 if (m_currentSourceNode && source == m_currentSourceNode->nextSibling()) {
2582 LOG(Media, "HTMLMediaElement::sourceWasAdded - <source> inserted immedia tely after current source"); 2599 LOG(Media, "HTMLMediaElement::sourceWasAdded - <source> inserted immedia tely after current source");
2583 m_nextChildNodeToConsider = source; 2600 m_nextChildNodeToConsider = source;
2584 return; 2601 return;
2585 } 2602 }
2586 2603
2587 if (m_nextChildNodeToConsider != sourceChildEndOfListValue()) 2604 if (m_nextChildNodeToConsider)
2588 return; 2605 return;
2589 2606
2590 // 4.8.9.5, resource selection algorithm, source elements section: 2607 // 4.8.9.5, resource selection algorithm, source elements section:
2591 // 20 - Wait until the node after pointer is a node other than the end of th e list. (This step might wait forever.) 2608 // 21. Wait until the node after pointer is a node other than the end of the list. (This step might wait forever.)
2592 // 21 - Asynchronously await a stable state... 2609 // 22. Asynchronously await a stable state...
2593 // 22 - Set the element's delaying-the-load-event flag back to true (this de lays the load event again, in case 2610 // 23. Set the element's delaying-the-load-event flag back to true (this del ays the load event again, in case
2594 // it hasn't been fired yet). 2611 // it hasn't been fired yet).
2595 setShouldDelayLoadEvent(true); 2612 setShouldDelayLoadEvent(true);
2596 2613
2597 // 23 - Set the networkState back to NETWORK_LOADING. 2614 // 24. Set the networkState back to NETWORK_LOADING.
2598 m_networkState = NETWORK_LOADING; 2615 m_networkState = NETWORK_LOADING;
2599 2616
2600 // 24 - Jump back to the find next candidate step above. 2617 // 25. Jump back to the find next candidate step above.
2601 m_nextChildNodeToConsider = source; 2618 m_nextChildNodeToConsider = source;
2602 scheduleNextSourceChild(); 2619 scheduleNextSourceChild();
2603 } 2620 }
2604 2621
2605 void HTMLMediaElement::sourceWillBeRemoved(HTMLSourceElement* source) 2622 void HTMLMediaElement::sourceWillBeRemoved(HTMLSourceElement* source)
2606 { 2623 {
2607 LOG(Media, "HTMLMediaElement::sourceWillBeRemoved(%p)", source); 2624 LOG(Media, "HTMLMediaElement::sourceWillBeRemoved(%p)", source);
2608 2625
2609 #if !LOG_DISABLED 2626 #if !LOG_DISABLED
2610 if (source->hasTagName(sourceTag)) { 2627 if (source->hasTagName(sourceTag)) {
2611 KURL url = source->getNonEmptyURLAttribute(srcAttr); 2628 KURL url = source->getNonEmptyURLAttribute(srcAttr);
2612 LOG(Media, "HTMLMediaElement::sourceWillBeRemoved - 'src' is %s", urlFor Logging(url).utf8().data()); 2629 LOG(Media, "HTMLMediaElement::sourceWillBeRemoved - 'src' is %s", urlFor Logging(url).utf8().data());
2613 } 2630 }
2614 #endif 2631 #endif
2615 2632
2616 if (source != m_currentSourceNode && source != m_nextChildNodeToConsider) 2633 if (source != m_currentSourceNode && source != m_nextChildNodeToConsider)
2617 return; 2634 return;
2618 2635
2619 if (source == m_nextChildNodeToConsider) { 2636 if (source == m_nextChildNodeToConsider) {
2620 m_nextChildNodeToConsider = m_nextChildNodeToConsider->nextSibling(); 2637 m_nextChildNodeToConsider = m_nextChildNodeToConsider->nextSibling();
2621 if (!m_nextChildNodeToConsider) 2638 if (!m_nextChildNodeToConsider)
2622 m_nextChildNodeToConsider = sourceChildEndOfListValue(); 2639 m_nextChildNodeToConsider = 0;
2623 LOG(Media, "HTMLMediaElement::sourceRemoved - m_nextChildNodeToConsider set to %p", m_nextChildNodeToConsider); 2640 LOG(Media, "HTMLMediaElement::sourceRemoved - m_nextChildNodeToConsider set to %p", m_nextChildNodeToConsider.get());
2624 } else if (source == m_currentSourceNode) { 2641 } else if (source == m_currentSourceNode) {
2625 // Clear the current source node pointer, but don't change the movie as the spec says: 2642 // Clear the current source node pointer, but don't change the movie as the spec says:
2626 // 4.8.8 - Dynamically modifying a source element and its attribute when the element is already 2643 // 4.8.8 - Dynamically modifying a source element and its attribute when the element is already
2627 // inserted in a video or audio element will have no effect. 2644 // inserted in a video or audio element will have no effect.
2628 m_currentSourceNode = 0; 2645 m_currentSourceNode = 0;
2629 LOG(Media, "HTMLMediaElement::sourceRemoved - m_currentSourceNode set to 0"); 2646 LOG(Media, "HTMLMediaElement::sourceRemoved - m_currentSourceNode set to 0");
2630 } 2647 }
2631 } 2648 }
2632 2649
2633 void HTMLMediaElement::mediaPlayerTimeChanged(MediaPlayer*) 2650 void HTMLMediaElement::mediaPlayerTimeChanged(MediaPlayer*)
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
3205 } 3222 }
3206 3223
3207 void HTMLMediaElement::setMediaPlayerProxy(WebMediaPlayerProxy* proxy) 3224 void HTMLMediaElement::setMediaPlayerProxy(WebMediaPlayerProxy* proxy)
3208 { 3225 {
3209 ensureMediaPlayer(); 3226 ensureMediaPlayer();
3210 m_player->setMediaPlayerProxy(proxy); 3227 m_player->setMediaPlayerProxy(proxy);
3211 } 3228 }
3212 3229
3213 void HTMLMediaElement::getPluginProxyParams(KURL& url, Vector<String>& names, Ve ctor<String>& values) 3230 void HTMLMediaElement::getPluginProxyParams(KURL& url, Vector<String>& names, Ve ctor<String>& values)
3214 { 3231 {
3232 RefPtr<HTMLMediaElement> protect(this); // selectNextSourceChild may fire 'b eforeload', which can make arbitrary DOM mutations.
3233
3215 Frame* frame = document()->frame(); 3234 Frame* frame = document()->frame();
3216 3235
3217 if (isVideo()) { 3236 if (isVideo()) {
3218 KURL posterURL = getNonEmptyURLAttribute(posterAttr); 3237 KURL posterURL = getNonEmptyURLAttribute(posterAttr);
3219 if (!posterURL.isEmpty() && frame && frame->loader()->willLoadMediaEleme ntURL(posterURL)) { 3238 if (!posterURL.isEmpty() && frame && frame->loader()->willLoadMediaEleme ntURL(posterURL)) {
3220 names.append("_media_element_poster_"); 3239 names.append("_media_element_poster_");
3221 values.append(posterURL.string()); 3240 values.append(posterURL.string());
3222 } 3241 }
3223 } 3242 }
3224 3243
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
3766 3785
3767 bool HTMLMediaElement::shouldDisableSleep() const 3786 bool HTMLMediaElement::shouldDisableSleep() const
3768 { 3787 {
3769 return m_player && !m_player->paused() && hasVideo() && hasAudio() && !loop( ); 3788 return m_player && !m_player->paused() && hasVideo() && hasAudio() && !loop( );
3770 } 3789 }
3771 #endif 3790 #endif
3772 3791
3773 } 3792 }
3774 3793
3775 #endif 3794 #endif
OLDNEW
« no previous file with comments | « Source/WebCore/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698