Changeset 241899 in webkit


Ignore:
Timestamp:
Feb 21, 2019 1:34:26 PM (5 years ago)
Author:
timothy_horton@apple.com
Message:

Crash under RemoteLayerTreePropertyApplier::applyProperties when reattaching to old process
https://bugs.webkit.org/show_bug.cgi?id=194845
<rdar://problem/47944579>

Reviewed by Antti Koivisto.

Source/WebKit:

New test: ProcessSwap.PageOverlayLayerPersistence

  • Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:

(WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged):
Keep track of all properties that have ever changed on a layer, so we
can re-send them if a layer moves between contexts.

  • WebProcess/WebPage/DrawingArea.cpp:

(WebKit::DrawingArea::~DrawingArea):
(WebKit::DrawingArea::removeMessageReceiverIfNeeded):

  • WebProcess/WebPage/DrawingArea.h:

(WebKit::DrawingArea::layerHostDidFlushLayers):
Make it possible to tear down DrawingArea's MessageReceiver before it is destroyed,
so that we can keep two DrawingAreas alive in a single process for a short time.

(WebKit::DrawingArea::adoptLayersFromDrawingArea):
Add adoptLayersFromDrawingArea; see below for its only useful implementation.

  • WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:

(WebKit::GraphicsLayerCARemote::GraphicsLayerCARemote):
(WebKit::GraphicsLayerCARemote::~GraphicsLayerCARemote):
(WebKit::GraphicsLayerCARemote::createPlatformCALayer):
(WebKit::GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView):
(WebKit::GraphicsLayerCARemote::moveToContext):

  • WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h:

Make it possible to move a GraphicsLayerCARemote between RemoteLayerTreeContexts.

  • WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:

(WebKit::PlatformCALayerRemote::create):
(WebKit::PlatformCALayerRemote::createForEmbeddedView):
(WebKit::PlatformCALayerRemote::~PlatformCALayerRemote):
(WebKit::PlatformCALayerRemote::moveToContext):

  • WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
  • WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:

(WebKit::PlatformCALayerRemoteCustom::create):
(WebKit::PlatformCALayerRemoteCustom::clone const):
Make it possible to move a PlatformCALayerRemote between RemoteLayerTreeContexts.

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

(WebKit::RemoteLayerTreeContext::~RemoteLayerTreeContext):
(WebKit::RemoteLayerTreeContext::adoptLayersFromContext):
(WebKit::RemoteLayerTreeContext::layerDidEnterContext):
(WebKit::RemoteLayerTreeContext::layerWillLeaveContext):
(WebKit::RemoteLayerTreeContext::graphicsLayerDidEnterContext):
(WebKit::RemoteLayerTreeContext::graphicsLayerWillLeaveContext):
(WebKit::RemoteLayerTreeContext::layerWasCreated): Deleted.
(WebKit::RemoteLayerTreeContext::layerWillBeDestroyed): Deleted.
Keep track of all GraphicsLayerCARemote instances in the context, like we
do for PlatformCALayerRemote, so that we can update their context backpointers if needed.

Also make it possible to move all outstanding layers to a new context.

  • WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
  • WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:

(WebKit::RemoteLayerTreeDrawingArea::adoptLayersFromDrawingArea):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::reinitializeWebPage):
When doing a DrawingArea swap, transition all layers from the old context
to the new one. In order to do this, we temporarily keep both DrawingAreas
alive, but make use of the new mechanism to remove the old one's MessageReceiver
before installing the new one, so that destroying the old one later doesn't
remove it (avoiding re-introducing bug 189481).

Tools:

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
Location:
trunk
Files:
1 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r241868 r241899  
     12019-02-21  Tim Horton  <timothy_horton@apple.com>
     2
     3        Crash under RemoteLayerTreePropertyApplier::applyProperties when reattaching to old process
     4        https://bugs.webkit.org/show_bug.cgi?id=194845
     5        <rdar://problem/47944579>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        New test: ProcessSwap.PageOverlayLayerPersistence
     10
     11        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
     12        (WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged):
     13        Keep track of all properties that have ever changed on a layer, so we
     14        can re-send them if a layer moves between contexts.
     15
     16        * WebProcess/WebPage/DrawingArea.cpp:
     17        (WebKit::DrawingArea::~DrawingArea):
     18        (WebKit::DrawingArea::removeMessageReceiverIfNeeded):
     19        * WebProcess/WebPage/DrawingArea.h:
     20        (WebKit::DrawingArea::layerHostDidFlushLayers):
     21        Make it possible to tear down DrawingArea's MessageReceiver before it is destroyed,
     22        so that we can keep two DrawingAreas alive in a single process for a short time.
     23
     24        (WebKit::DrawingArea::adoptLayersFromDrawingArea):
     25        Add adoptLayersFromDrawingArea; see below for its only useful implementation.
     26
     27        * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
     28        (WebKit::GraphicsLayerCARemote::GraphicsLayerCARemote):
     29        (WebKit::GraphicsLayerCARemote::~GraphicsLayerCARemote):
     30        (WebKit::GraphicsLayerCARemote::createPlatformCALayer):
     31        (WebKit::GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView):
     32        (WebKit::GraphicsLayerCARemote::moveToContext):
     33        * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h:
     34        Make it possible to move a GraphicsLayerCARemote between RemoteLayerTreeContexts.
     35
     36        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
     37        (WebKit::PlatformCALayerRemote::create):
     38        (WebKit::PlatformCALayerRemote::createForEmbeddedView):
     39        (WebKit::PlatformCALayerRemote::~PlatformCALayerRemote):
     40        (WebKit::PlatformCALayerRemote::moveToContext):
     41        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
     42        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
     43        (WebKit::PlatformCALayerRemoteCustom::create):
     44        (WebKit::PlatformCALayerRemoteCustom::clone const):
     45        Make it possible to move a PlatformCALayerRemote between RemoteLayerTreeContexts.
     46
     47        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
     48        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
     49        (WebKit::RemoteLayerTreeContext::~RemoteLayerTreeContext):
     50        (WebKit::RemoteLayerTreeContext::adoptLayersFromContext):
     51        (WebKit::RemoteLayerTreeContext::layerDidEnterContext):
     52        (WebKit::RemoteLayerTreeContext::layerWillLeaveContext):
     53        (WebKit::RemoteLayerTreeContext::graphicsLayerDidEnterContext):
     54        (WebKit::RemoteLayerTreeContext::graphicsLayerWillLeaveContext):
     55        (WebKit::RemoteLayerTreeContext::layerWasCreated): Deleted.
     56        (WebKit::RemoteLayerTreeContext::layerWillBeDestroyed): Deleted.
     57        Keep track of all GraphicsLayerCARemote instances in the context, like we
     58        do for PlatformCALayerRemote, so that we can update their context backpointers if needed.
     59
     60        Also make it possible to move all outstanding layers to a new context.
     61
     62        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
     63        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
     64        (WebKit::RemoteLayerTreeDrawingArea::adoptLayersFromDrawingArea):
     65        * WebProcess/WebPage/WebPage.cpp:
     66        (WebKit::WebPage::reinitializeWebPage):
     67        When doing a DrawingArea swap, transition all layers from the old context
     68        to the new one. In order to do this, we temporarily keep both DrawingAreas
     69        alive, but make use of the new mechanism to remove the old one's MessageReceiver
     70        before installing the new one, so that destroying the old one later doesn't
     71        remove it (avoiding re-introducing bug 189481).
     72
    1732019-02-21  Chris Dumez  <cdumez@apple.com>
    274
  • trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h

    r239427 r241899  
    120120        {
    121121            changedProperties.add(changeFlags);
     122            everChangedProperties.add(changeFlags);
    122123        }
    123124
     
    128129
    129130        OptionSet<LayerChange> changedProperties;
     131        OptionSet<LayerChange> everChangedProperties;
    130132
    131133        String name;
  • trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.cpp

    r237266 r241899  
    7979DrawingArea::~DrawingArea()
    8080{
    81     WebProcess::singleton().removeMessageReceiver(Messages::DrawingArea::messageReceiverName(), m_webPage.pageID());
     81    removeMessageReceiverIfNeeded();
    8282}
    8383
     
    9595#endif
    9696
     97void DrawingArea::removeMessageReceiverIfNeeded()
     98{
     99    if (m_hasRemovedMessageReceiver)
     100        return;
     101    m_hasRemovedMessageReceiver = true;
     102    WebProcess::singleton().removeMessageReceiver(Messages::DrawingArea::messageReceiverName(), m_webPage.pageID());
     103}
     104
    97105} // namespace WebKit
  • trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.h

    r241183 r241899  
    141141#endif
    142142
    143     virtual void layerHostDidFlushLayers() { };
     143    virtual void layerHostDidFlushLayers() { }
    144144
    145145#if USE(COORDINATED_GRAPHICS)
     
    150150    virtual void deviceOrPageScaleFactorChanged() = 0;
    151151#endif
     152
     153    virtual void adoptLayersFromDrawingArea(DrawingArea&) { }
     154
     155    void removeMessageReceiverIfNeeded();
    152156
    153157protected:
     
    187191    virtual void destroyNativeSurfaceHandleForCompositing(bool&) = 0;
    188192#endif
     193
     194    bool m_hasRemovedMessageReceiver { false };
    189195};
    190196
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp

    r238108 r241899  
    2929#include "PlatformCAAnimationRemote.h"
    3030#include "PlatformCALayerRemote.h"
     31#include "RemoteLayerTreeContext.h"
    3132#include <WebCore/PlatformScreen.h>
    3233
     
    3435using namespace WebCore;
    3536
     37GraphicsLayerCARemote::GraphicsLayerCARemote(Type layerType, GraphicsLayerClient& client, RemoteLayerTreeContext& context)
     38    : GraphicsLayerCA(layerType, client)
     39    , m_context(&context)
     40{
     41    context.graphicsLayerDidEnterContext(*this);
     42}
     43
    3644GraphicsLayerCARemote::~GraphicsLayerCARemote()
    3745{
     46    if (m_context)
     47        m_context->graphicsLayerWillLeaveContext(*this);
    3848}
    3949
     
    4555Ref<PlatformCALayer> GraphicsLayerCARemote::createPlatformCALayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* owner)
    4656{
    47     auto result = PlatformCALayerRemote::create(layerType, owner, m_context);
     57    auto result = PlatformCALayerRemote::create(layerType, owner, *m_context);
    4858
    4959    if (result->canHaveBackingStore())
     
    5565Ref<PlatformCALayer> GraphicsLayerCARemote::createPlatformCALayer(PlatformLayer* platformLayer, PlatformCALayerClient* owner)
    5666{
    57     return PlatformCALayerRemote::create(platformLayer, owner, m_context);
     67    return PlatformCALayerRemote::create(platformLayer, owner, *m_context);
    5868}
    5969
    6070Ref<PlatformCALayer> GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView(PlatformCALayer::LayerType layerType, GraphicsLayer::EmbeddedViewID embeddedViewID, PlatformCALayerClient* owner)
    6171{
    62     return PlatformCALayerRemote::createForEmbeddedView(layerType, embeddedViewID, owner, m_context);
     72    return PlatformCALayerRemote::createForEmbeddedView(layerType, embeddedViewID, owner, *m_context);
    6373}
    6474
     
    6878}
    6979
     80void GraphicsLayerCARemote::moveToContext(RemoteLayerTreeContext& context)
     81{
     82    if (m_context)
     83        m_context->graphicsLayerWillLeaveContext(*this);
     84
     85    m_context = &context;
     86
     87    context.graphicsLayerDidEnterContext(*this);
     88}
     89
    7090} // namespace WebKit
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h

    r238108 r241899  
    3535class GraphicsLayerCARemote final : public WebCore::GraphicsLayerCA {
    3636public:
    37     GraphicsLayerCARemote(Type layerType, WebCore::GraphicsLayerClient& client, RemoteLayerTreeContext& context)
    38         : GraphicsLayerCA(layerType, client)
    39         , m_context(context)
    40     {
    41     }
    42 
     37    GraphicsLayerCARemote(Type layerType, WebCore::GraphicsLayerClient&, RemoteLayerTreeContext&);
    4338    virtual ~GraphicsLayerCARemote();
    4439
    4540    bool filtersCanBeComposited(const WebCore::FilterOperations& filters) override;
     41
     42    void moveToContext(RemoteLayerTreeContext&);
     43    void clearContext() { m_context = nullptr; }
    4644
    4745private:
     
    5654    bool shouldDirectlyCompositeImage(WebCore::Image*) const override { return false; }
    5755   
    58     RemoteLayerTreeContext& m_context;
     56    RemoteLayerTreeContext* m_context;
    5957};
    6058
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp

    r238468 r241899  
    5252        layer = adoptRef(new PlatformCALayerRemote(layerType, owner, context));
    5353
    54     context.layerWasCreated(*layer, layerType);
     54    context.layerDidEnterContext(*layer, layerType);
    5555
    5656    return layer.releaseNonNull();
     
    6565{
    6666    RefPtr<PlatformCALayerRemote> layer = adoptRef(new PlatformCALayerRemote(layerType, embeddedViewID, owner, context));
    67     context.layerWasCreated(*layer, layerType);
     67    context.layerDidEnterContext(*layer, layerType);
    6868    return layer.releaseNonNull();
    6969}
     
    7373    auto layer = adoptRef(*new PlatformCALayerRemote(other, owner, context));
    7474
    75     context.layerWasCreated(layer.get(), other.layerType());
     75    context.layerDidEnterContext(layer.get(), other.layerType());
    7676
    7777    return layer;
     
    117117
    118118    if (m_context)
    119         m_context->layerWillBeDestroyed(*this);
     119        m_context->layerWillLeaveContext(*this);
     120}
     121
     122void PlatformCALayerRemote::moveToContext(RemoteLayerTreeContext& context)
     123{
     124    if (m_context)
     125        m_context->layerWillLeaveContext(*this);
     126
     127    m_context = &context;
     128
     129    context.layerDidEnterContext(*this, layerType());
     130
     131    m_properties.notePropertiesChanged(m_properties.everChangedProperties);
    120132}
    121133
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h

    r238108 r241899  
    196196    void didCommit();
    197197
     198    void moveToContext(RemoteLayerTreeContext&);
    198199    void clearContext() { m_context = nullptr; }
    199200    RemoteLayerTreeContext* context() const { return m_context; }
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm

    r239709 r241899  
    4949{
    5050    auto layer = adoptRef(*new PlatformCALayerRemoteCustom(PlatformCALayerCocoa::layerTypeForPlatformLayer(platformLayer), platformLayer, owner, context));
    51     context.layerWasCreated(layer.get(), layer->layerType());
     51    context.layerDidEnterContext(layer.get(), layer->layerType());
    5252    return WTFMove(layer);
    5353}
     
    127127
    128128    auto clone = adoptRef(*new PlatformCALayerRemoteCustom(layerType(), clonedLayer.get(), owner, *context()));
    129     context()->layerWasCreated(clone.get(), clone->layerType());
     129    context()->layerDidEnterContext(clone.get(), clone->layerType());
    130130
    131131    updateClonedLayerProperties(clone.get(), copyContents);
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h

    r236016 r241899  
    3636namespace WebKit {
    3737
     38class GraphicsLayerCARemote;
    3839class PlatformCALayerRemote;
    3940class WebPage;
     
    4546    ~RemoteLayerTreeContext();
    4647
    47     void layerWasCreated(PlatformCALayerRemote&, WebCore::PlatformCALayer::LayerType);
    48     void layerWillBeDestroyed(PlatformCALayerRemote&);
     48    void layerDidEnterContext(PlatformCALayerRemote&, WebCore::PlatformCALayer::LayerType);
     49    void layerWillLeaveContext(PlatformCALayerRemote&);
     50
     51    void graphicsLayerDidEnterContext(GraphicsLayerCARemote&);
     52    void graphicsLayerWillLeaveContext(GraphicsLayerCARemote&);
    4953
    5054    void backingStoreWasCreated(RemoteLayerBackingStore&);
     
    7377    bool nextFlushIsForImmediatePaint() const { return m_nextFlushIsForImmediatePaint; }
    7478
     79    void adoptLayersFromContext(RemoteLayerTreeContext&);
     80
    7581private:
    7682    // WebCore::GraphicsLayerFactory
     
    8288    Vector<WebCore::GraphicsLayer::PlatformLayerID> m_destroyedLayers;
    8389
    84     HashMap<WebCore::GraphicsLayer::PlatformLayerID, PlatformCALayerRemote*> m_liveLayers;
     90    HashMap<WebCore::GraphicsLayer::PlatformLayerID, PlatformCALayerRemote*> m_livePlatformLayers;
    8591    HashMap<WebCore::GraphicsLayer::PlatformLayerID, PlatformCALayerRemote*> m_layersWithAnimations;
     92
     93    HashSet<GraphicsLayerCARemote*> m_liveGraphicsLayers;
    8694
    8795    RemoteLayerBackingStoreCollection m_backingStoreCollection;
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm

    r238108 r241899  
    5050RemoteLayerTreeContext::~RemoteLayerTreeContext()
    5151{
    52     for (auto& layer : m_liveLayers.values())
     52    for (auto& layer : m_livePlatformLayers.values())
    5353        layer->clearContext();
     54
     55    auto graphicsLayers = m_liveGraphicsLayers;
     56    for (auto& layer : graphicsLayers)
     57        layer->clearContext();
     58}
     59
     60void RemoteLayerTreeContext::adoptLayersFromContext(RemoteLayerTreeContext& oldContext)
     61{
     62    auto& platformLayers = oldContext.m_livePlatformLayers;
     63    while (!platformLayers.isEmpty())
     64        platformLayers.begin()->value->moveToContext(*this);
     65
     66    auto& graphicsLayers = oldContext.m_liveGraphicsLayers;
     67    while (!graphicsLayers.isEmpty())
     68        (*graphicsLayers.begin())->moveToContext(*this);
    5469}
    5570
     
    6479}
    6580
    66 void RemoteLayerTreeContext::layerWasCreated(PlatformCALayerRemote& layer, PlatformCALayer::LayerType type)
     81void RemoteLayerTreeContext::layerDidEnterContext(PlatformCALayerRemote& layer, PlatformCALayer::LayerType type)
    6782{
    6883    GraphicsLayer::PlatformLayerID layerID = layer.layerID();
     
    7994
    8095    m_createdLayers.add(layerID, WTFMove(creationProperties));
    81     m_liveLayers.add(layerID, &layer);
     96    m_livePlatformLayers.add(layerID, &layer);
    8297}
    8398
    84 void RemoteLayerTreeContext::layerWillBeDestroyed(PlatformCALayerRemote& layer)
     99void RemoteLayerTreeContext::layerWillLeaveContext(PlatformCALayerRemote& layer)
    85100{
    86101    ASSERT(layer.layerID());
     
    88103
    89104    m_createdLayers.remove(layerID);
    90     m_liveLayers.remove(layerID);
     105    m_livePlatformLayers.remove(layerID);
    91106
    92107    ASSERT(!m_destroyedLayers.contains(layerID));
     
    94109   
    95110    m_layersWithAnimations.remove(layerID);
     111}
     112
     113void RemoteLayerTreeContext::graphicsLayerDidEnterContext(GraphicsLayerCARemote& layer)
     114{
     115    m_liveGraphicsLayers.add(&layer);
     116}
     117
     118void RemoteLayerTreeContext::graphicsLayerWillLeaveContext(GraphicsLayerCARemote& layer)
     119{
     120    m_liveGraphicsLayers.remove(&layer);
    96121}
    97122
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h

    r240940 r241899  
    124124    bool markLayersVolatileImmediatelyIfPossible() override;
    125125
     126    void adoptLayersFromDrawingArea(DrawingArea&) override;
     127
    126128    class BackingStoreFlusher : public ThreadSafeRefCounted<BackingStoreFlusher> {
    127129    public:
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm

    r241846 r241899  
    533533}
    534534
     535void RemoteLayerTreeDrawingArea::adoptLayersFromDrawingArea(DrawingArea& oldDrawingArea)
     536{
     537    RELEASE_ASSERT(oldDrawingArea.type() == type());
     538
     539    RemoteLayerTreeDrawingArea& oldRemoteDrawingArea = static_cast<RemoteLayerTreeDrawingArea&>(oldDrawingArea);
     540
     541    m_remoteLayerTreeContext->adoptLayersFromContext(*oldRemoteDrawingArea.m_remoteLayerTreeContext);
     542}
     543
    535544} // namespace WebKit
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r241721 r241899  
    696696
    697697    if (m_shouldResetDrawingAreaAfterSuspend) {
    698         // Make sure we destroy the previous drawing area before constructing the new one as DrawingArea registers / unregisters
    699         // itself as an IPC::MesssageReceiver in its constructor / destructor.
    700         m_drawingArea = nullptr;
     698        auto oldDrawingArea = std::exchange(m_drawingArea, nullptr);
     699        oldDrawingArea->removeMessageReceiverIfNeeded();
    701700        m_shouldResetDrawingAreaAfterSuspend = false;
    702701
     
    706705        m_drawingArea->updatePreferences(parameters.store);
    707706        m_drawingArea->setPaintingEnabled(true);
     707
     708        m_drawingArea->adoptLayersFromDrawingArea(*oldDrawingArea);
     709
    708710        unfreezeLayerTree(LayerTreeFreezeReason::PageSuspended);
    709711    }
  • trunk/Tools/ChangeLog

    r241869 r241899  
     12019-02-21  Tim Horton  <timothy_horton@apple.com>
     2
     3        Crash under RemoteLayerTreePropertyApplier::applyProperties when reattaching to old process
     4        https://bugs.webkit.org/show_bug.cgi?id=194845
     5        <rdar://problem/47944579>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     10        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
     11
    1122019-02-21  Zalan Bujtas  <zalan@apple.com>
    213
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r241841 r241899  
    9393                2D1C04A71D76298B000A6816 /* TestNavigationDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D1C04A61D76298B000A6816 /* TestNavigationDelegate.mm */; };
    9494                2D21FE591F04642900B58E7D /* WKPDFViewStablePresentationUpdateCallback.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D21FE581F04642800B58E7D /* WKPDFViewStablePresentationUpdateCallback.mm */; };
     95                2D3CA3A8221DF4B40088E803 /* PageOverlayPlugin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D3CA3A4221DF2390088E803 /* PageOverlayPlugin.mm */; };
    9596                2D4CF8BD1D8360CC0001CE8D /* WKThumbnailView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D4CF8BC1D8360CC0001CE8D /* WKThumbnailView.mm */; };
    9697                2D51A0C71C8BF00C00765C45 /* DOMHTMLVideoElementWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D51A0C51C8BF00400765C45 /* DOMHTMLVideoElementWrapper.mm */; };
     
    14281429                2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FixedLayoutSize.mm; sourceTree = "<group>"; };
    14291430                2D21FE581F04642800B58E7D /* WKPDFViewStablePresentationUpdateCallback.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPDFViewStablePresentationUpdateCallback.mm; sourceTree = "<group>"; };
     1431                2D3CA3A4221DF2390088E803 /* PageOverlayPlugin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageOverlayPlugin.mm; sourceTree = "<group>"; };
    14301432                2D4CF8BC1D8360CC0001CE8D /* WKThumbnailView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKThumbnailView.mm; path = WebKit/WKThumbnailView.mm; sourceTree = "<group>"; };
    14311433                2D51A0C51C8BF00400765C45 /* DOMHTMLVideoElementWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMHTMLVideoElementWrapper.mm; sourceTree = "<group>"; };
     
    25592561                                CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */,
    25602562                                CEBCA12E1E3A660100C73293 /* OverrideContentSecurityPolicy.mm */,
     2563                                2D3CA3A4221DF2390088E803 /* PageOverlayPlugin.mm */,
    25612564                                F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */,
    25622565                                F44C79FD20F9E8710014478C /* ParserYieldTokenTests.h */,
     
    44224425                                0E404A8C2166DE0A008271BA /* InjectedBundleNodeHandleIsSelectElement.mm in Sources */,
    44234426                                79C5D431209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm in Sources */,
     4427                                2D3CA3A8221DF4B40088E803 /* PageOverlayPlugin.mm in Sources */,
    44244428                                F44C7A0020F9EEBF0014478C /* ParserYieldTokenPlugIn.mm in Sources */,
    44254429                                A13EBBAB1B87434600097110 /* PlatformUtilitiesCocoa.mm in Sources */,
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm

    r241854 r241899  
    51375137}
    51385138
     5139static void traverseLayerTree(CALayer *layer, void(^block)(CALayer *))
     5140{
     5141    for (CALayer *child in layer.sublayers)
     5142        traverseLayerTree(child, block);
     5143    block(layer);
     5144}
     5145
     5146static bool hasOverlay(CALayer *layer)
     5147{
     5148    __block bool hasViewOverlay = false;
     5149    traverseLayerTree(layer, ^(CALayer *layer) {
     5150        if ([layer.name isEqualToString:@"View overlay container"])
     5151            hasViewOverlay = true;
     5152    });
     5153    return hasViewOverlay;
     5154}
     5155
     5156TEST(ProcessSwap, PageOverlayLayerPersistence)
     5157{
     5158    auto processPoolConfiguration = psonProcessPoolConfiguration();
     5159    [processPoolConfiguration setInjectedBundleURL:[[NSBundle mainBundle] URLForResource:@"TestWebKitAPI" withExtension:@"wkbundle"]];
     5160    auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
     5161    [processPool _setObject:@"PageOverlayPlugIn" forBundleParameter:TestWebKitAPI::Util::TestPlugInClassNameParameter];
     5162
     5163    auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
     5164    [webViewConfiguration setProcessPool:processPool.get()];
     5165
     5166    auto handler = adoptNS([[PSONScheme alloc] init]);
     5167    [handler addMappingFromURLString:@"pson://www.webkit.org/page-overlay" toData:""];
     5168    [handler addMappingFromURLString:@"pson://www.apple.com/page-overlay" toData:""];
     5169    [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"];
     5170
     5171    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
     5172
     5173    auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]);
     5174    [webView setNavigationDelegate:navigationDelegate.get()];
     5175
     5176    auto request = adoptNS([NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/page-overlay"]]);
     5177    [webView loadRequest:request.get()];
     5178
     5179    TestWebKitAPI::Util::run(&done);
     5180    done = false;
     5181
     5182    [webView waitForNextPresentationUpdate];
     5183
     5184    EXPECT_TRUE(hasOverlay([webView layer]));
     5185
     5186    request = adoptNS([NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/page-overlay"]]);
     5187    [webView loadRequest:request.get()];
     5188
     5189    TestWebKitAPI::Util::run(&done);
     5190    done = false;
     5191
     5192    [webView waitForNextPresentationUpdate];
     5193
     5194    [webView goBack]; // Back to webkit.org.
     5195
     5196    [webView waitForNextPresentationUpdate];
     5197
     5198    EXPECT_TRUE(hasOverlay([webView layer]));
     5199}
     5200
    51395201#endif // WK_API_ENABLED
Note: See TracChangeset for help on using the changeset viewer.