Changeset 261407 in webkit


Ignore:
Timestamp:
May 8, 2020 1:10:24 PM (4 years ago)
Author:
Chris Dumez
Message:

Make WKWebViewConfiguration._alwaysRunsAtForegroundPriority an alias for _clientNavigationsRunAtForegroundPriority
https://bugs.webkit.org/show_bug.cgi?id=211632

Reviewed by Darin Adler.

Make WKWebViewConfiguration._alwaysRunsAtForegroundPriority an alias for _clientNavigationsRunAtForegroundPriority.
_alwaysRunsAtForegroundPriority is a frequent source of process assertion leaks that get blamed on WebKit. Clients
are using this in order to be able to do loads in background views so _clientNavigationsRunAtForegroundPriority
should suffice and is not leak prone since the process assertion is released after the navigation has completed.

  • UIProcess/API/APIPageConfiguration.cpp:

(API::PageConfiguration::copy const):

  • UIProcess/API/APIPageConfiguration.h:

(API::PageConfiguration::alwaysRunsAtForegroundPriority const): Deleted.
(API::PageConfiguration::setAlwaysRunsAtForegroundPriority): Deleted.

  • UIProcess/API/Cocoa/WKWebViewConfiguration.mm:

(-[WKWebViewConfiguration _alwaysRunsAtForegroundPriority]):
(-[WKWebViewConfiguration _setAlwaysRunsAtForegroundPriority:]):

  • UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::updateThrottleState):
(WebKit::WebPageProxy::resetStateAfterProcessExited):

  • UIProcess/WebPageProxy.h:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r261405 r261407  
     12020-05-08  Chris Dumez  <cdumez@apple.com>
     2
     3        Make WKWebViewConfiguration._alwaysRunsAtForegroundPriority an alias for _clientNavigationsRunAtForegroundPriority
     4        https://bugs.webkit.org/show_bug.cgi?id=211632
     5
     6        Reviewed by Darin Adler.
     7
     8        Make WKWebViewConfiguration._alwaysRunsAtForegroundPriority an alias for _clientNavigationsRunAtForegroundPriority.
     9        _alwaysRunsAtForegroundPriority is a frequent source of process assertion leaks that get blamed on WebKit. Clients
     10        are using this in order to be able to do loads in background views so _clientNavigationsRunAtForegroundPriority
     11        should suffice and is not leak prone since the process assertion is released after the navigation has completed.
     12
     13        * UIProcess/API/APIPageConfiguration.cpp:
     14        (API::PageConfiguration::copy const):
     15        * UIProcess/API/APIPageConfiguration.h:
     16        (API::PageConfiguration::alwaysRunsAtForegroundPriority const): Deleted.
     17        (API::PageConfiguration::setAlwaysRunsAtForegroundPriority): Deleted.
     18        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
     19        (-[WKWebViewConfiguration _alwaysRunsAtForegroundPriority]):
     20        (-[WKWebViewConfiguration _setAlwaysRunsAtForegroundPriority:]):
     21        * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
     22        * UIProcess/WebPageProxy.cpp:
     23        (WebKit::WebPageProxy::close):
     24        (WebKit::WebPageProxy::updateThrottleState):
     25        (WebKit::WebPageProxy::resetStateAfterProcessExited):
     26        * UIProcess/WebPageProxy.h:
     27
    1282020-05-08  Alex Christensen  <achristensen@webkit.org>
    229
  • trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp

    r260303 r261407  
    7474#if PLATFORM(IOS_FAMILY)
    7575    copy->m_clientNavigationsRunAtForegroundPriority = this->m_clientNavigationsRunAtForegroundPriority;
    76     copy->m_alwaysRunsAtForegroundPriority = this->m_alwaysRunsAtForegroundPriority;
    7776    copy->m_canShowWhileLocked = this->m_canShowWhileLocked;
    7877    copy->m_clickInteractionDriverForTesting = this->m_clickInteractionDriverForTesting;
  • trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.h

    r260303 r261407  
    9494    bool clientNavigationsRunAtForegroundPriority() const { return m_clientNavigationsRunAtForegroundPriority; }
    9595    void setClientNavigationsRunAtForegroundPriority(bool value) { m_clientNavigationsRunAtForegroundPriority = value; }
    96     bool alwaysRunsAtForegroundPriority() const { return m_alwaysRunsAtForegroundPriority; }
    97     void setAlwaysRunsAtForegroundPriority(bool alwaysRunsAtForegroundPriority) { m_alwaysRunsAtForegroundPriority = alwaysRunsAtForegroundPriority; }
    98    
     96
    9997    bool canShowWhileLocked() const { return m_canShowWhileLocked; }
    10098    void setCanShowWhileLocked(bool canShowWhileLocked) { m_canShowWhileLocked = canShowWhileLocked; }
     
    176174#if PLATFORM(IOS_FAMILY)
    177175    bool m_clientNavigationsRunAtForegroundPriority { true };
    178     bool m_alwaysRunsAtForegroundPriority { false };
    179176    bool m_canShowWhileLocked { false };
    180177    RetainPtr<_UIClickInteractionDriving> m_clickInteractionDriverForTesting;
  • trunk/Source/WebKit/UIProcess/API/Cocoa/NSAttributedString.mm

    r249902 r261407  
    145145#if PLATFORM(IOS_FAMILY)
    146146        configuration.allowsInlineMediaPlayback = NO;
    147         configuration._alwaysRunsAtForegroundPriority = YES;
     147        configuration._clientNavigationsRunAtForegroundPriority = YES;
    148148#endif
    149149    }
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm

    r261396 r261407  
    730730- (BOOL)_alwaysRunsAtForegroundPriority
    731731{
    732     return _pageConfiguration->alwaysRunsAtForegroundPriority();
     732    return _pageConfiguration->clientNavigationsRunAtForegroundPriority();
    733733}
    734734
    735735- (void)_setAlwaysRunsAtForegroundPriority:(BOOL)alwaysRunsAtForegroundPriority
    736736{
    737     _pageConfiguration->setAlwaysRunsAtForegroundPriority(alwaysRunsAtForegroundPriority);
     737    _pageConfiguration->setClientNavigationsRunAtForegroundPriority(alwaysRunsAtForegroundPriority);
    738738}
    739739
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h

    r260334 r261407  
    9292#if TARGET_OS_IPHONE
    9393@property (nonatomic, setter=_setClientNavigationsRunAtForegroundPriority:) BOOL _clientNavigationsRunAtForegroundPriority WK_API_AVAILABLE(ios(WK_IOS_TBA));
    94 @property (nonatomic, setter=_setAlwaysRunsAtForegroundPriority:) BOOL _alwaysRunsAtForegroundPriority WK_API_AVAILABLE(ios(9_0));
     94@property (nonatomic, setter=_setAlwaysRunsAtForegroundPriority:) BOOL _alwaysRunsAtForegroundPriority WK_API_DEPRECATED_WITH_REPLACEMENT("_clientNavigationsRunAtForegroundPriority", ios(9.0, WK_IOS_TBA));
    9595@property (nonatomic, setter=_setInlineMediaPlaybackRequiresPlaysInlineAttribute:) BOOL _inlineMediaPlaybackRequiresPlaysInlineAttribute WK_API_AVAILABLE(ios(10.0));
    9696@property (nonatomic, setter=_setAllowsInlineMediaPlaybackAfterFullscreen:) BOOL _allowsInlineMediaPlaybackAfterFullscreen  WK_API_AVAILABLE(ios(10.0));
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r261394 r261407  
    465465    , m_notificationPermissionRequestManager(*this)
    466466#if PLATFORM(IOS_FAMILY)
    467     , m_alwaysRunsAtForegroundPriority(m_configuration->alwaysRunsAtForegroundPriority())
    468467    , m_audibleActivityTimer(RunLoop::main(), this, &WebPageProxy::clearAudibleActivity)
    469468#endif
     
    11271126    m_isCapturingActivity = nullptr;
    11281127    m_openingAppLinkActivity = nullptr;
    1129     m_alwaysRunsAtForegroundPriorityActivity = nullptr;
    11301128    m_audibleActivityTimer.stop();
    11311129#endif
     
    20822080        RELEASE_LOG_IF_ALLOWED(ProcessSuspension, "updateThrottleState: UIProcess is releasing a foreground assertion because media capture is no longer active");
    20832081        m_isCapturingActivity = nullptr;
    2084     }
    2085 
    2086     if (m_alwaysRunsAtForegroundPriority) {
    2087         if (!m_alwaysRunsAtForegroundPriorityActivity || !m_alwaysRunsAtForegroundPriorityActivity->isValid()) {
    2088             RELEASE_LOG_IF_ALLOWED(ProcessSuspension, "updateThrottleState: UIProcess is taking a foreground assertion because m_alwaysRunsAtForegroundPriority is true");
    2089             m_alwaysRunsAtForegroundPriorityActivity = m_process->throttler().foregroundActivity("View always runs at foreground priority"_s).moveToUniquePtr();
    2090         }
    2091     } else if (m_alwaysRunsAtForegroundPriorityActivity) {
    2092         RELEASE_LOG_IF_ALLOWED(ProcessSuspension, "updateThrottleState: UIProcess is releasing a foreground assertion because m_alwaysRunsAtForegroundPriority is no longer true");
    2093         m_alwaysRunsAtForegroundPriorityActivity = nullptr;
    20942082    }
    20952083#endif
     
    76617649    m_isCapturingActivity = nullptr;
    76627650    m_openingAppLinkActivity = nullptr;
    7663     m_alwaysRunsAtForegroundPriorityActivity = nullptr;
    76647651#endif
    76657652
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r261394 r261407  
    24482448#if PLATFORM(IOS_FAMILY)
    24492449    bool m_allowsMediaDocumentInlinePlayback { false };
    2450     bool m_alwaysRunsAtForegroundPriority { false };
    24512450    std::unique_ptr<ProcessThrottler::ForegroundActivity> m_isVisibleActivity;
    24522451    std::unique_ptr<ProcessThrottler::ForegroundActivity> m_isAudibleActivity;
    24532452    std::unique_ptr<ProcessThrottler::ForegroundActivity> m_isCapturingActivity;
    2454     std::unique_ptr<ProcessThrottler::ForegroundActivity> m_alwaysRunsAtForegroundPriorityActivity;
    24552453    RunLoop::Timer<WebPageProxy> m_audibleActivityTimer;
    24562454    std::unique_ptr<ProcessThrottler::BackgroundActivity> m_openingAppLinkActivity;
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKPDFView.mm

    r260366 r261407  
    9797
    9898    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
    99     [configuration _setAlwaysRunsAtForegroundPriority:YES];
     99    [configuration _setClientNavigationsRunAtForegroundPriority:YES];
    100100
    101101    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
  • trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm

    r260900 r261407  
    8787    globalWebViewConfiguration._mediaDataLoadsAutomatically = YES;
    8888    globalWebViewConfiguration.requiresUserActionForMediaPlayback = NO;
    89 
    90     // Make sure the view does not get suspended and runs at foreground priority, even if not visible on screen.
    91     globalWebViewConfiguration._alwaysRunsAtForegroundPriority = YES;
    9289#endif
    9390    globalWebViewConfiguration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
Note: See TracChangeset for help on using the changeset viewer.