Changeset 167273 in webkit


Ignore:
Timestamp:
Apr 14, 2014 3:37:07 PM (10 years ago)
Author:
Simon Fraser
Message:

[iOS WK2] Hash table assertion closing a tab
https://bugs.webkit.org/show_bug.cgi?id=131640

Reviewed by Tim Horton.

Have RemoteLayerTreeContext keep track of all PlatformCALayerRemotes,
and clear their context pointer when it is being destroyed to avoid
calling into a deleted object later.

  • WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:

(WebKit::PlatformCALayerRemote::~PlatformCALayerRemote):
(WebKit::PlatformCALayerRemote::addAnimationForKey):

  • WebProcess/WebPage/mac/PlatformCALayerRemote.h:

(WebKit::PlatformCALayerRemote::clearContext):

  • WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
  • WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:

(WebKit::RemoteLayerTreeContext::~RemoteLayerTreeContext):
(WebKit::RemoteLayerTreeContext::layerWasCreated):
(WebKit::RemoteLayerTreeContext::layerWillBeDestroyed):

Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r167271 r167273  
     12014-04-14  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] Hash table assertion closing a tab
     4        https://bugs.webkit.org/show_bug.cgi?id=131640
     5
     6        Reviewed by Tim Horton.
     7       
     8        Have RemoteLayerTreeContext keep track of all PlatformCALayerRemotes,
     9        and clear their context pointer when it is being destroyed to avoid
     10        calling into a deleted object later.
     11
     12        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
     13        (WebKit::PlatformCALayerRemote::~PlatformCALayerRemote):
     14        (WebKit::PlatformCALayerRemote::addAnimationForKey):
     15        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
     16        (WebKit::PlatformCALayerRemote::clearContext):
     17        * WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
     18        * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
     19        (WebKit::RemoteLayerTreeContext::~RemoteLayerTreeContext):
     20        (WebKit::RemoteLayerTreeContext::layerWasCreated):
     21        (WebKit::RemoteLayerTreeContext::layerWillBeDestroyed):
     22
    1232014-04-14  Tim Horton  <timothy_horton@apple.com>
    224
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp

    r166886 r167273  
    110110    for (const auto& layer : m_children)
    111111        toPlatformCALayerRemote(layer.get())->m_superlayer = nullptr;
    112     m_context->layerWillBeDestroyed(this);
     112
     113    if (m_context)
     114        m_context->layerWillBeDestroyed(this);
    113115}
    114116
     
    287289    m_properties.addedAnimations.set(key, toPlatformCAAnimationRemote(animation)->properties());
    288290    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::AnimationsChanged);
    289    
    290     m_context->willStartAnimationOnLayer(this);
     291
     292    if (m_context)
     293        m_context->willStartAnimationOnLayer(this);
    291294}
    292295
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h

    r166545 r167273  
    154154    RemoteLayerTreeTransaction::LayerProperties& properties() { return m_properties; }
    155155
     156    void clearContext() { m_context = nullptr; }
     157
    156158protected:
    157159    PlatformCALayerRemote(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext* context);
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h

    r166975 r167273  
    7272    Vector<WebCore::GraphicsLayer::PlatformLayerID> m_destroyedLayers;
    7373
     74    HashMap<WebCore::GraphicsLayer::PlatformLayerID, PlatformCALayerRemote*> m_liveLayers;
    7475    HashMap<WebCore::GraphicsLayer::PlatformLayerID, PlatformCALayerRemote*> m_layersAwaitingAnimationStart;
    7576
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm

    r166975 r167273  
    5050RemoteLayerTreeContext::~RemoteLayerTreeContext()
    5151{
     52    for (auto& layer : m_liveLayers.values())
     53        layer->clearContext();
    5254}
    5355
     
    6264
    6365    m_createdLayers.append(creationProperties);
     66    m_liveLayers.add(layer->layerID(), layer);
    6467}
    6568
    6669void RemoteLayerTreeContext::layerWillBeDestroyed(PlatformCALayerRemote* layer)
    6770{
     71    m_liveLayers.remove(layer->layerID());
     72
    6873    ASSERT(!m_destroyedLayers.contains(layer->layerID()));
    6974    m_destroyedLayers.append(layer->layerID());
Note: See TracChangeset for help on using the changeset viewer.