Changeset 242050 in webkit


Ignore:
Timestamp:
Feb 25, 2019 11:11:57 AM (5 years ago)
Author:
pvollan@apple.com
Message:

A prewarmed Web process should have a process assertion.
https://bugs.webkit.org/show_bug.cgi?id=195006

Reviewed by Geoffrey Garen.

To make sure the prewarm message is handled in the Web process before the process is suspended,
the process should have a process assertion. This can be fixed by sending the prewarm message
inside WebProcessPool::initializeNewWebProcess, since all message sent inside this method are
guaranteed to be handled before the WebContent process is suspended.

This patch is based on Chris Dumez' idea and obervation of the issue.

  • UIProcess/WebProcessPool.cpp:

(WebKit::WebProcessPool::createNewWebProcess):
(WebKit::WebProcessPool::initializeNewWebProcess):

  • UIProcess/WebProcessPool.h:
Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r242045 r242050  
     12019-02-25  Per Arne Vollan  <pvollan@apple.com>
     2
     3        A prewarmed Web process should have a process assertion.
     4        https://bugs.webkit.org/show_bug.cgi?id=195006
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        To make sure the prewarm message is handled in the Web process before the process is suspended,
     9        the process should have a process assertion. This can be fixed by sending the prewarm message
     10        inside WebProcessPool::initializeNewWebProcess, since all message sent inside this method are
     11        guaranteed to be handled before the WebContent process is suspended.
     12
     13        This patch is based on Chris Dumez' idea and obervation of the issue.
     14
     15        * UIProcess/WebProcessPool.cpp:
     16        (WebKit::WebProcessPool::createNewWebProcess):
     17        (WebKit::WebProcessPool::initializeNewWebProcess):
     18        * UIProcess/WebProcessPool.h:
     19
    1202019-02-25  Michael Catanzaro  <mcatanzaro@igalia.com>
    221
  • trunk/Source/WebKit/UIProcess/WebProcessPool.cpp

    r241928 r242050  
    765765    auto processProxy = WebProcessProxy::create(*this, websiteDataStore, isPrewarmed);
    766766    auto& process = processProxy.get();
    767     initializeNewWebProcess(process, websiteDataStore);
     767    initializeNewWebProcess(process, websiteDataStore, isPrewarmed);
    768768    m_processes.append(WTFMove(processProxy));
    769     if (isPrewarmed == WebProcessProxy::IsPrewarmed::Yes) {
    770         ASSERT(!m_prewarmedProcess);
    771         m_prewarmedProcess = &process;
    772        
    773         m_prewarmedProcess->send(Messages::WebProcess::PrewarmGlobally(), 0);
    774     }
    775769
    776770    if (m_serviceWorkerProcessesTerminationTimer.isActive())
     
    814808#endif
    815809
    816 void WebProcessPool::initializeNewWebProcess(WebProcessProxy& process, WebsiteDataStore& websiteDataStore)
     810void WebProcessPool::initializeNewWebProcess(WebProcessProxy& process, WebsiteDataStore& websiteDataStore, WebProcessProxy::IsPrewarmed isPrewarmed)
    817811{
    818812    auto initializationActivityToken = process.throttler().backgroundActivityToken();
     
    964958
    965959    ASSERT(m_messagesToInjectedBundlePostedToEmptyContext.isEmpty());
     960
     961    if (isPrewarmed == WebProcessProxy::IsPrewarmed::Yes) {
     962        ASSERT(!m_prewarmedProcess);
     963        m_prewarmedProcess = &process;
     964        process.send(Messages::WebProcess::PrewarmGlobally(), 0);
     965    }
    966966
    967967#if ENABLE(REMOTE_INSPECTOR)
  • trunk/Source/WebKit/UIProcess/WebProcessPool.h

    r241928 r242050  
    506506
    507507    WebProcessProxy& createNewWebProcess(WebsiteDataStore&, WebProcessProxy::IsPrewarmed = WebProcessProxy::IsPrewarmed::No);
    508     void initializeNewWebProcess(WebProcessProxy&, WebsiteDataStore&);
     508    void initializeNewWebProcess(WebProcessProxy&, WebsiteDataStore&, WebProcessProxy::IsPrewarmed = WebProcessProxy::IsPrewarmed::No);
    509509
    510510    void requestWebContentStatistics(StatisticsRequest&);
Note: See TracChangeset for help on using the changeset viewer.