Changeset 258663 in webkit


Ignore:
Timestamp:
Mar 18, 2020 1:30:02 PM (4 years ago)
Author:
youenn@apple.com
Message:

WebPage should own a Ref<WebFrame>
https://bugs.webkit.org/show_bug.cgi?id=209235

Reviewed by Geoffrey Garen.

Source/WebCore:

  • loader/FrameLoaderStateMachine.h:

Export committedFirstRealDocumentLoad/

Source/WebKit:

Update code since m_mainFrame is now a Ref and no longer a RefPtr.

Update WebPage constructor to set its m_mainFrame very early.
We update WebPage::didCompletePageTransition to compute whether this is initialization or not using the frame state machine state
instead of m_mainFrame being null.

  • WebProcess/Automation/WebAutomationSessionProxy.cpp:

(WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
(WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
(WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
(WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
(WebKit::WebAutomationSessionProxy::resolveParentFrame):
(WebKit::WebAutomationSessionProxy::focusFrame):
(WebKit::WebAutomationSessionProxy::computeElementLayout):
(WebKit::WebAutomationSessionProxy::selectOptionElement):
(WebKit::WebAutomationSessionProxy::setFilesForInputFileUpload):
(WebKit::WebAutomationSessionProxy::takeScreenshot):
(WebKit::WebAutomationSessionProxy::snapshotRectForScreenshot):
(WebKit::WebAutomationSessionProxy::getCookiesForFrame):
(WebKit::WebAutomationSessionProxy::deleteCookie):

  • WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:

(WKBundlePageGetMainFrame):

  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::findLargestFrameInFrameSet):
(WebKit::WebChromeClient::closeWindowSoon):

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
(WebKit::WebFrameLoaderClient::dispatchDidLayout):
(WebKit::WebFrameLoaderClient::restoreViewState):

  • WebProcess/WebPage/ViewGestureGeometryCollector.cpp:

(WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
(WebKit::ViewGestureGeometryCollector::collectGeometryForMagnificationGesture):

  • WebProcess/WebPage/WebBackForwardListProxy.cpp:

(WebKit::WebBackForwardListProxy::goToItem):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::WebPage):
(WebKit::m_processDisplayName):
(WebKit::WebPage::close):
(WebKit::WebPage::suspendForProcessSwap):
(WebKit::WebPage::loadDataInFrame):
(WebKit::WebPage::loadRequest):
(WebKit::WebPage::reload):
(WebKit::WebPage::didCompletePageTransition):
(WebKit::WebPage::runJavaScriptInFrameInScriptWorld):
(WebKit::WebPage::setIsSuspended):
(WebKit::WebPage::didLoadFromRegistrableDomain):

  • WebProcess/WebPage/WebPage.h:

(WebKit::WebPage::mainWebFrame const):

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::cancelPotentialTap):

  • WebProcess/cocoa/WebProcessCocoa.mm:

(WebKit::origin):

Location:
trunk/Source
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r258662 r258663  
     12020-03-18  youenn fablet  <youenn@apple.com>
     2
     3        WebPage should own a Ref<WebFrame>
     4        https://bugs.webkit.org/show_bug.cgi?id=209235
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * loader/FrameLoaderStateMachine.h:
     9        Export committedFirstRealDocumentLoad/
     10
    1112020-03-18  Eugene But  <eugenebut@chromium.org>
    212
  • trunk/Source/WebCore/loader/FrameLoaderStateMachine.h

    r246767 r258663  
    5252
    5353    WEBCORE_EXPORT bool committingFirstRealLoad() const;
    54     bool committedFirstRealDocumentLoad() const;
     54    WEBCORE_EXPORT bool committedFirstRealDocumentLoad() const;
    5555    bool creatingInitialEmptyDocument() const;
    5656    WEBCORE_EXPORT bool isDisplayingInitialEmptyDocument() const;
  • trunk/Source/WebKit/ChangeLog

    r258659 r258663  
     12020-03-18  youenn fablet  <youenn@apple.com>
     2
     3        WebPage should own a Ref<WebFrame>
     4        https://bugs.webkit.org/show_bug.cgi?id=209235
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Update code since m_mainFrame is now a Ref and no longer a RefPtr.
     9
     10        Update WebPage constructor to set its m_mainFrame very early.
     11        We update WebPage::didCompletePageTransition to compute whether this is initialization or not using the frame state machine state
     12        instead of m_mainFrame being null.
     13
     14        * WebProcess/Automation/WebAutomationSessionProxy.cpp:
     15        (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
     16        (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
     17        (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
     18        (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
     19        (WebKit::WebAutomationSessionProxy::resolveParentFrame):
     20        (WebKit::WebAutomationSessionProxy::focusFrame):
     21        (WebKit::WebAutomationSessionProxy::computeElementLayout):
     22        (WebKit::WebAutomationSessionProxy::selectOptionElement):
     23        (WebKit::WebAutomationSessionProxy::setFilesForInputFileUpload):
     24        (WebKit::WebAutomationSessionProxy::takeScreenshot):
     25        (WebKit::WebAutomationSessionProxy::snapshotRectForScreenshot):
     26        (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
     27        (WebKit::WebAutomationSessionProxy::deleteCookie):
     28        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
     29        (WKBundlePageGetMainFrame):
     30        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     31        (WebKit::findLargestFrameInFrameSet):
     32        (WebKit::WebChromeClient::closeWindowSoon):
     33        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     34        (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
     35        (WebKit::WebFrameLoaderClient::dispatchDidLayout):
     36        (WebKit::WebFrameLoaderClient::restoreViewState):
     37        * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
     38        (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
     39        (WebKit::ViewGestureGeometryCollector::collectGeometryForMagnificationGesture):
     40        * WebProcess/WebPage/WebBackForwardListProxy.cpp:
     41        (WebKit::WebBackForwardListProxy::goToItem):
     42        * WebProcess/WebPage/WebPage.cpp:
     43        (WebKit::WebPage::WebPage):
     44        (WebKit::m_processDisplayName):
     45        (WebKit::WebPage::close):
     46        (WebKit::WebPage::suspendForProcessSwap):
     47        (WebKit::WebPage::loadDataInFrame):
     48        (WebKit::WebPage::loadRequest):
     49        (WebKit::WebPage::reload):
     50        (WebKit::WebPage::didCompletePageTransition):
     51        (WebKit::WebPage::runJavaScriptInFrameInScriptWorld):
     52        (WebKit::WebPage::setIsSuspended):
     53        (WebKit::WebPage::didLoadFromRegistrableDomain):
     54        * WebProcess/WebPage/WebPage.h:
     55        (WebKit::WebPage::mainWebFrame const):
     56        * WebProcess/WebPage/ios/WebPageIOS.mm:
     57        (WebKit::WebPage::cancelPotentialTap):
     58        * WebProcess/cocoa/WebProcessCocoa.mm:
     59        (WebKit::origin):
     60
    1612020-03-18  Wenson Hsieh  <wenson_hsieh@apple.com>
    262
  • trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp

    r257667 r258663  
    317317        return;
    318318    }
    319     WebFrame* frame = optionalFrameID ? WebProcess::singleton().webFrame(*optionalFrameID) : page->mainWebFrame();
     319    auto* frame = optionalFrameID ? WebProcess::singleton().webFrame(*optionalFrameID) : &page->mainWebFrame();
    320320    if (!frame) {
    321321        WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidEvaluateJavaScriptFunction(callbackID, { },
     
    390390    String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
    391391
    392     WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
     392    auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
    393393    if (!frame) {
    394394        completionHandler(frameNotFoundErrorType, WTF::nullopt);
     
    428428    String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
    429429
    430     WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
     430    auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
    431431    if (!frame) {
    432432        completionHandler(frameNotFoundErrorType, WTF::nullopt);
     
    478478    String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
    479479
    480     WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
     480    auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
    481481    if (!frame) {
    482482        completionHandler(frameNotFoundErrorType, WTF::nullopt);
     
    516516    String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
    517517
    518     WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
     518    auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
    519519    if (!frame) {
    520520        completionHandler(frameNotFoundErrorType, WTF::nullopt);
     
    537537        return;
    538538
    539     WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
     539    auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
    540540    if (!frame)
    541541        return;
     
    614614    }
    615615
    616     WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
     616    auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
    617617    if (!frame || !frame->coreFrame() || !frame->coreFrame()->view()) {
    618618        String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
     
    728728    }
    729729
    730     WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
     730    auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
    731731    if (!frame || !frame->coreFrame() || !frame->coreFrame()->view()) {
    732732        String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
     
    778778    }
    779779
    780     WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
     780    auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
    781781    if (!frame || !frame->coreFrame() || !frame->coreFrame()->view()) {
    782782        String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
     
    842842        WebPage* page = WebProcess::singleton().webPage(pageID);
    843843        ASSERT(page);
    844         WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
     844        auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
    845845        ASSERT(frame && frame->coreFrame());
    846846        auto snapshotRect = WebCore::IntRect(frame->coreFrame()->mainFrame().view()->clientToDocumentRect(rect));
     
    866866    }
    867867
    868     WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
     868    auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
    869869    if (!frame || !frame->coreFrame()) {
    870870        String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
     
    911911    }
    912912
    913     WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
     913    auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
    914914    if (!frame || !frame->coreFrame() || !frame->coreFrame()->document()) {
    915915        String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
     
    936936    }
    937937
    938     WebFrame* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : page->mainWebFrame();
     938    auto* frame = frameID ? WebProcess::singleton().webFrame(*frameID) : &page->mainWebFrame();
    939939    if (!frame || !frame->coreFrame() || !frame->coreFrame()->document()) {
    940940        String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp

    r258044 r258663  
    172172WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef pageRef)
    173173{
    174     return toAPI(WebKit::toImpl(pageRef)->mainWebFrame());
     174    return toAPI(&WebKit::toImpl(pageRef)->mainWebFrame());
    175175}
    176176
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp

    r251181 r258663  
    840840    g_return_val_if_fail(WEBKIT_IS_WEB_PAGE(webPage), 0);
    841841
    842     return webkitFrameGetOrCreate(webPage->priv->webPage->mainWebFrame());
     842    return webkitFrameGetOrCreate(&webPage->priv->webPage->mainWebFrame());
    843843}
    844844
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r258487 r258663  
    116116    // Approximate what a user could consider a default target frame for application menu operations.
    117117
    118     WebFrame* mainFrame = page.mainWebFrame();
    119     if (!mainFrame || !mainFrame->isFrameSet())
     118    auto& mainFrame = page.mainWebFrame();
     119    if (!mainFrame.isFrameSet())
    120120        return nullptr;
    121121
    122122    WebFrame* largestSoFar = nullptr;
    123123
    124     Ref<API::Array> frameChildren = mainFrame->childFrames();
     124    Ref<API::Array> frameChildren = mainFrame.childFrames();
    125125    size_t count = frameChildren->size();
    126126    for (size_t i = 0; i < count; ++i) {
     
    444444    m_page.corePage()->setGroupName(String());
    445445
    446     if (WebFrame* frame = m_page.mainWebFrame()) {
    447         if (Frame* coreFrame = frame->coreFrame())
    448             coreFrame->loader().stopForUserCancel();
    449     }
     446    auto& frame = m_page.mainWebFrame();
     447    if (auto* coreFrame = frame.coreFrame())
     448        coreFrame->loader().stopForUserCancel();
    450449
    451450    m_page.sendClose();
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r258628 r258663  
    702702#if USE(COORDINATED_GRAPHICS)
    703703        // Make sure viewport properties are dispatched on the main frame by the time the first layout happens.
    704         ASSERT(!webPage->useFixedLayout() || m_frame.ptr() != m_frame->page()->mainWebFrame() || m_frame->coreFrame()->document()->didDispatchViewportPropertiesChanged());
     704        ASSERT(!webPage->useFixedLayout() || m_frame.ptr() != &m_frame->page()->mainWebFrame() || m_frame->coreFrame()->document()->didDispatchViewportPropertiesChanged());
    705705#endif
    706706    }
     
    767767    // the UIProcess for every call.
    768768
    769     if (m_frame.ptr() == m_frame->page()->mainWebFrame()) {
     769    if (m_frame.ptr() == &m_frame->page()->mainWebFrame()) {
    770770        // FIXME: Remove at the soonest possible time.
    771771        webPage->send(Messages::WebPageProxy::SetRenderTreeSize(webPage->renderTreeSize()));
     
    13941394    // FIXME: This should not be necessary. WebCore should be correctly invalidating
    13951395    // the view on restores from the back/forward cache.
    1396     if (m_frame->page() && m_frame.ptr() == m_frame->page()->mainWebFrame())
     1396    if (m_frame->page() && m_frame.ptr() == &m_frame->page()->mainWebFrame())
    13971397        m_frame->page()->drawingArea()->setNeedsDisplay();
    13981398#endif
  • trunk/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp

    r258525 r258663  
    8484    FloatRect visibleContentRect = m_webPage.mainFrameView()->unobscuredContentRectIncludingScrollbars();
    8585
    86     if (m_webPage.mainWebFrame()->handlesPageScaleGesture())
     86    if (m_webPage.mainWebFrame().handlesPageScaleGesture())
    8787        return;
    8888
     
    249249{
    250250    FloatRect visibleContentRect = m_webPage.mainFrameView()->unobscuredContentRectIncludingScrollbars();
    251     bool frameHandlesMagnificationGesture = m_webPage.mainWebFrame()->handlesPageScaleGesture();
     251    bool frameHandlesMagnificationGesture = m_webPage.mainWebFrame().handlesPageScaleGesture();
    252252    m_webPage.send(Messages::ViewGestureController::DidCollectGeometryForMagnificationGesture(visibleContentRect, frameHandlesMagnificationGesture));
    253253}
  • trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp

    r255135 r258663  
    112112    m_page->sendSync(Messages::WebPageProxy::BackForwardGoToItem(item.identifier()), Messages::WebPageProxy::BackForwardGoToItem::Reply(sandboxExtensionHandle, backForwardListCounts));
    113113    m_cachedBackForwardListCounts = backForwardListCounts;
    114     m_page->sandboxExtensionTracker().beginLoad(m_page->mainWebFrame(), WTFMove(sandboxExtensionHandle));
     114    m_page->sandboxExtensionTracker().beginLoad(&m_page->mainWebFrame(), WTFMove(sandboxExtensionHandle));
    115115}
    116116
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r258628 r258663  
    396396WebPage::WebPage(PageIdentifier pageID, WebPageCreationParameters&& parameters)
    397397    : m_identifier(pageID)
     398    , m_mainFrame(WebFrame::create())
    398399    , m_viewSize(parameters.viewSize)
    399400    , m_alwaysShowsHorizontalScroller { parameters.alwaysShowsHorizontalScroller }
     
    468469    m_pageGroup = WebProcess::singleton().webPageGroup(parameters.pageGroupData);
    469470
    470     auto mainFrame = WebFrame::create();
    471 
    472471    PageConfiguration pageConfiguration(
    473472        WebProcess::singleton().sessionID(),
     
    479478        WebProcess::singleton().cookieJar(),
    480479        makeUniqueRef<WebProgressTrackerClient>(*this),
    481         makeUniqueRef<WebFrameLoaderClient>(mainFrame.copyRef()),
     480        makeUniqueRef<WebFrameLoaderClient>(m_mainFrame.copyRef()),
    482481        makeUniqueRef<MediaRecorderProvider>()
    483482    );
     
    574573    m_page->settings().setBackForwardCacheExpirationInterval(Seconds::infinity());
    575574
    576     mainFrame->initWithCoreMainFrame(*this, m_page->mainFrame());
    577     m_mainFrame = WTFMove(mainFrame);
     575    m_mainFrame->initWithCoreMainFrame(*this, m_page->mainFrame());
    578576
    579577    m_drawingArea->updatePreferences(parameters.store);
     
    13841382
    13851383    // If there is still no URL, then we never loaded anything in this page, so nothing to report.
    1386     if (!mainWebFrame()->url().isEmpty())
     1384    if (!mainWebFrame().url().isEmpty())
    13871385        reportUsedFeatures();
    13881386
     
    15301528    // main frame is normally re-used for the navigation. However, in the case of process-swapping, the main frame
    15311529    // is now hosted in another process and the one in this process is in the cache.
    1532     if (m_mainFrame && m_mainFrame->coreFrame())
     1530    if (m_mainFrame->coreFrame())
    15331531        m_mainFrame->coreFrame()->loader().detachFromAllOpenedFrames();
    15341532
     
    15471545void WebPage::loadDataInFrame(IPC::DataReference&& data, String&& MIMEType, String&& encodingName, URL&& baseURL, FrameIdentifier frameID)
    15481546{
    1549     WebFrame* frame = WebProcess::singleton().webFrame(frameID);
     1547    auto* frame = WebProcess::singleton().webFrame(frameID);
    15501548    if (!frame)
    15511549        return;
    1552     ASSERT(mainWebFrame() != frame);
     1550    ASSERT(&mainWebFrame() != frame);
    15531551
    15541552    auto sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(data.data()), data.size());
     
    15741572    m_pendingWebsitePolicies = WTFMove(loadParameters.websitePolicies);
    15751573
    1576     m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), WTFMove(loadParameters.sandboxExtensionHandle));
     1574    m_sandboxExtensionTracker.beginLoad(m_mainFrame.ptr(), WTFMove(loadParameters.sandboxExtensionHandle));
    15771575
    15781576    // Let the InjectedBundle know we are about to start the load, passing the user data from the UIProcess
     
    16991697    m_pendingNavigationID = navigationID;
    17001698
    1701     m_sandboxExtensionTracker.beginReload(m_mainFrame.get(), WTFMove(sandboxExtensionHandle));
     1699    m_sandboxExtensionTracker.beginReload(m_mainFrame.ptr(), WTFMove(sandboxExtensionHandle));
    17021700    corePage()->userInputBridge().reloadFrame(m_mainFrame->coreFrame(), OptionSet<ReloadOption>::fromRaw(reloadOptions));
    17031701
     
    33363334    unfreezeLayerTree(LayerTreeFreezeReason::PageTransition);
    33373335
    3338     RELEASE_LOG_IF_ALLOWED(Layers, "didCompletePageTransition: Did complete page transition");
    3339 
    3340     bool isInitialEmptyDocument = !m_mainFrame;
    3341     if (!isInitialEmptyDocument)
     3336    auto& stateMachine = m_mainFrame->coreFrame()->loader().stateMachine();
     3337    RELEASE_LOG_IF_ALLOWED(Layers, "didCompletePageTransition: Did complete page transition, loader state is %d", stateMachine.stateForDebugging());
     3338
     3339    if (stateMachine.committedFirstRealDocumentLoad())
    33423340        unfreezeLayerTree(LayerTreeFreezeReason::ProcessSwap);
    33433341}
     
    34563454void WebPage::runJavaScriptInFrameInScriptWorld(RunJavaScriptParameters&& parameters, Optional<WebCore::FrameIdentifier> frameID, const std::pair<ContentWorldIdentifier, String>& worldData, CallbackID callbackID)
    34573455{
    3458     auto* webFrame = frameID ? WebProcess::singleton().webFrame(*frameID) : mainWebFrame();
     3456    auto* webFrame = frameID ? WebProcess::singleton().webFrame(*frameID) : &mainWebFrame();
    34593457
    34603458    if (auto* newWorld = m_userContentController->addContentWorld(worldData)) {
     
    66276625    unfreezeLayerTree(LayerTreeFreezeReason::BackgroundApplication);
    66286626
    6629     WebProcess::singleton().sendPrewarmInformation(mainWebFrame()->url());
     6627    WebProcess::singleton().sendPrewarmInformation(mainWebFrame().url());
    66306628
    66316629    suspendForProcessSwap();
     
    67006698void WebPage::didLoadFromRegistrableDomain(RegistrableDomain&& targetDomain)
    67016699{
    6702     if (targetDomain != RegistrableDomain(mainWebFrame()->url()))
     6700    if (targetDomain != RegistrableDomain(mainWebFrame().url()))
    67036701        m_loadedThirdPartyDomains.add(targetDomain);
    67046702}
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r258476 r258663  
    463463    void replaceStringMatchesFromInjectedBundle(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly);
    464464
    465     WebFrame* mainWebFrame() const { return m_mainFrame.get(); }
     465    WebFrame& mainWebFrame() const { return m_mainFrame; }
    466466
    467467    WebCore::Frame* mainFrame() const; // May return nullptr.
     
    17101710
    17111711    std::unique_ptr<WebCore::Page> m_page;
    1712     RefPtr<WebFrame> m_mainFrame;
     1712    Ref<WebFrame> m_mainFrame;
    17131713
    17141714    RefPtr<WebPageGroupProxy> m_pageGroup;
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r258525 r258663  
    339339void WebPage::didReceiveMobileDocType(bool isMobileDoctype)
    340340{
    341     resetViewportDefaultConfiguration(m_mainFrame.get(), isMobileDoctype);
     341    resetViewportDefaultConfiguration(m_mainFrame.ptr(), isMobileDoctype);
    342342}
    343343
     
    11691169{
    11701170    ContentChangeObserver::didCancelPotentialTap(m_page->mainFrame());
    1171     cancelPotentialTapInFrame(*m_mainFrame);
     1171    cancelPotentialTapInFrame(m_mainFrame);
    11721172}
    11731173
  • trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm

    r258495 r258663  
    586586static NSURL *origin(WebPage& page)
    587587{
    588     WebFrame* mainFrame = page.mainWebFrame();
    589     if (!mainFrame)
    590         return nil;
    591 
    592     URL mainFrameURL = { URL(), mainFrame->url() };
     588    auto& mainFrame = page.mainWebFrame();
     589
     590    URL mainFrameURL = { URL(), mainFrame.url() };
    593591    Ref<SecurityOrigin> mainFrameOrigin = SecurityOrigin::create(mainFrameURL);
    594592    String mainFrameOriginString;
Note: See TracChangeset for help on using the changeset viewer.