⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 185726 in webkit


Ignore:
Timestamp:
Jun 18, 2015, 4:38:55 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Fix crash when entering fullscreen during exit fullscreen animation.
https://bugs.webkit.org/show_bug.cgi?id=146117

Patch by Jeremy Jones <jeremyj@apple.com> on 2015-06-18
Reviewed by Simon Fraser.

Source/WebCore:

Because enterFullscreen can be called during exitFullscreen animation, the exit fullscreen teardown
should not imply a fullscreen state change on video element.

  • platform/ios/WebVideoFullscreenControllerAVKit.mm:

(WebVideoFullscreenControllerContext::exitFullscreen): May be called from mainThread
(-[WebVideoFullscreenController exitFullscreen]): May be called from mainThread

  • platform/ios/WebVideoFullscreenModelVideoElement.mm:

(WebVideoFullscreenModelVideoElement::setVideoElement):
Changing associated video element does not imply fullscreen mode change.

Source/WebKit2:

A partial teardown left the LayerHostingContext in a bad state when attempting to reuse the model and interface
objects. Instead, complete the teardown and don't reuse the objects.

  • WebProcess/ios/WebVideoFullscreenManager.mm:

(WebKit::WebVideoFullscreenManager::didEnterFullscreen): WebThreadRun is a no-op in WK2. Use dispatch_async.
(WebKit::WebVideoFullscreenManager::didCleanupFullscreen): Do complete teardown before entering fullscreen again.

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r185722 r185726  
     12015-06-18  Jeremy Jones  <jeremyj@apple.com>
     2
     3        Fix crash when entering fullscreen during exit fullscreen animation.
     4        https://bugs.webkit.org/show_bug.cgi?id=146117
     5
     6        Reviewed by Simon Fraser.
     7
     8        Because enterFullscreen can be called during exitFullscreen animation, the exit fullscreen teardown
     9        should not imply a fullscreen state change on video element.
     10
     11        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
     12        (WebVideoFullscreenControllerContext::exitFullscreen): May be called from mainThread
     13        (-[WebVideoFullscreenController exitFullscreen]): May be called from mainThread
     14        * platform/ios/WebVideoFullscreenModelVideoElement.mm:
     15        (WebVideoFullscreenModelVideoElement::setVideoElement):
     16        Changing associated video element does not imply fullscreen mode change.
     17
    1182015-06-18  Brian J. Burg  <burg@cs.washington.edu>
    219
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm

    r184922 r185726  
    530530void WebVideoFullscreenControllerContext::exitFullscreen()
    531531{
    532     ASSERT(WebThreadIsCurrent());
     532    ASSERT(WebThreadIsCurrent() || isMainThread());
    533533    IntRect screenRect = m_videoElement->screenRect();
    534534    RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
     
    578578- (void)exitFullscreen
    579579{
    580     ASSERT(WebThreadIsCurrent());
     580    ASSERT(WebThreadIsCurrent() || isMainThread());
    581581    _context->exitFullscreen();
    582582}
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm

    r184922 r185726  
    8383        m_videoFullscreenInterface->resetMediaState();
    8484
    85     if (m_videoElement && m_videoElement->fullscreenMode())
    86         m_videoElement->fullscreenModeChanged(HTMLMediaElementEnums::VideoFullscreenModeNone);
    87 
    8885    if (m_videoElement && m_videoElement->videoFullscreenLayer())
    8986        m_videoElement->setVideoFullscreenLayer(nullptr);
  • trunk/Source/WebKit2/ChangeLog

    r185721 r185726  
     12015-06-18  Jeremy Jones  <jeremyj@apple.com>
     2
     3        Fix crash when entering fullscreen during exit fullscreen animation.
     4        https://bugs.webkit.org/show_bug.cgi?id=146117
     5
     6        Reviewed by Simon Fraser.
     7
     8        A partial teardown left the LayerHostingContext in a bad state when attempting to reuse the model and interface
     9        objects. Instead, complete the teardown and don't reuse the objects.
     10
     11        * WebProcess/ios/WebVideoFullscreenManager.mm:
     12        (WebKit::WebVideoFullscreenManager::didEnterFullscreen): WebThreadRun is a no-op in WK2. Use dispatch_async.
     13        (WebKit::WebVideoFullscreenManager::didCleanupFullscreen): Do complete teardown before entering fullscreen again.
     14
    1152015-06-18  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm

    r184670 r185726  
    450450    // exit fullscreen now if it was previously requested during an animation.
    451451    RefPtr<WebVideoFullscreenManager> strongThis(this);
    452     WebThreadRun([strongThis, videoElement] {
     452    dispatch_async(dispatch_get_main_queue(), [strongThis, videoElement] {
    453453        strongThis->exitVideoFullscreenForVideoElement(*videoElement);
    454454    });
     
    483483    interface->setIsFullscreen(false);
    484484    HTMLMediaElementEnums::VideoFullscreenMode mode = interface->fullscreenMode();
     485    bool targetIsFullscreen = interface->targetIsFullscreen();
    485486
    486487    model->setVideoFullscreenLayer(nil);
    487488    RefPtr<HTMLVideoElement> videoElement = model->videoElement();
    488489
    489     if (!interface->targetIsFullscreen()) {
    490         model->setVideoElement(nullptr);
    491         model->setWebVideoFullscreenInterface(nullptr);
    492         interface->invalidate();
    493         m_videoElements.remove(videoElement.get());
    494         m_contextMap.remove(contextId);
     490    model->setVideoElement(nullptr);
     491    model->setWebVideoFullscreenInterface(nullptr);
     492    interface->invalidate();
     493    m_videoElements.remove(videoElement.get());
     494    m_contextMap.remove(contextId);
     495
     496    if (!videoElement || !targetIsFullscreen)
    495497        return;
    496     }
    497 
    498     if (!videoElement)
    499         return;
    500 
    501     // exit fullscreen now if it was previously requested during an animation.
     498
    502499    RefPtr<WebVideoFullscreenManager> strongThis(this);
    503     WebThreadRun([strongThis, videoElement, mode] {
     500    dispatch_async(dispatch_get_main_queue(), [strongThis, videoElement, mode] {
    504501        strongThis->enterVideoFullscreenForVideoElement(*videoElement, mode);
    505502    });
Note: See TracChangeset for help on using the changeset viewer.