⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245931 in webkit


Ignore:
Timestamp:
May 30, 2019, 5:30:30 PM (7 years ago)
Author:
Alan Coon
Message:

Apply patch. rdar://problem/51264847

Location:
branches/safari-607-branch/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-607-branch/Source/WebKit/ChangeLog

    r245930 r245931  
     12019-05-30  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Apply patch. rdar://problem/51264847
     4
     5    2019-05-30  Chris Dumez  <cdumez@apple.com>
     6
     7            <rdar://problem/50435250> v2: CrashTracer: Crash in WebProcessCache::removeProcess
     8
     9            Reviewed by Geoff Garen.
     10
     11            * UIProcess/WebProcessCache.cpp:
     12            (WebKit::WebProcessCache::removeProcess):
     13            This code change is to avoid crashing if my speculative fix below does not work. If
     14            WebProcessCache::removeProcess() gets called with a process whole registrable domain
     15            is empty (or null), remove it the slow way from the HashMap instead of trying to look
     16            up the bad registrable domain in the HashMap. This ensures we do no crash but still
     17            remove the process we're supposed to evict.
     18
     19            * UIProcess/WebProcessProxy.cpp:
     20            (WebKit::WebProcessProxy::canTerminateChildProcess):
     21            This is a speculative fix for the crash which aligns the branch with trunk. There is
     22            a period of time where a SuspendedPageProxy can exist for a given process but the
     23            WebProcessPool is no longer aware of it. This is when we're about to use the
     24            SuspendedPageProxy for a load. If WebProcessProxy::maybeShutDown() gets called during
     25            this period of time, canTerminateChildProcess() would incorrectly return true and we
     26            would cache the WebProcess even though it is about to do a load. The new code relies
     27            on m_suspendedPageCount which is a lot more reliable than asking the process pool.
     28
    1292019-05-30  Kocsen Chung  <kocsen_chung@apple.com>
    230
  • branches/safari-607-branch/Source/WebKit/UIProcess/WebProcessCache.cpp

    r244190 r245931  
    192192
    193193    std::unique_ptr<CachedProcess> cachedProcess;
    194     auto it = m_processesPerRegistrableDomain.find(process.registrableDomain());
    195     if (it != m_processesPerRegistrableDomain.end() && &it->value->process() == &process) {
    196         cachedProcess = WTFMove(it->value);
    197         m_processesPerRegistrableDomain.remove(it);
     194    auto registrableDomain = process.registrableDomain();
     195    ASSERT(!registrableDomain.isEmpty());
     196    if (registrableDomain.isEmpty()) {
     197        for (auto it = m_processesPerRegistrableDomain.begin(); it != m_processesPerRegistrableDomain.end(); ++it) {
     198            if (&it->value->process() == &process) {
     199                cachedProcess = WTFMove(it->value);
     200                m_processesPerRegistrableDomain.remove(it);
     201                break;
     202            }
     203        }
    198204    } else {
     205        auto it = m_processesPerRegistrableDomain.find(registrableDomain);
     206        if (it != m_processesPerRegistrableDomain.end() && &it->value->process() == &process) {
     207            cachedProcess = WTFMove(it->value);
     208            m_processesPerRegistrableDomain.remove(it);
     209        }
     210    }
     211
     212    if (!cachedProcess) {
    199213        for (auto& pair : m_pendingAddRequests) {
    200214            if (&pair.value->process() == &process) {
     
    205219        }
    206220    }
     221
    207222    ASSERT(cachedProcess);
    208223    if (!cachedProcess)
  • branches/safari-607-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp

    r245930 r245931  
    10041004bool WebProcessProxy::canTerminateChildProcess()
    10051005{
    1006     if (!m_pageMap.isEmpty() || m_processPool->hasSuspendedPageFor(*this) || !m_provisionalPages.isEmpty() || m_isInProcessCache)
     1006    if (!m_pageMap.isEmpty() || m_suspendedPageCount || !m_provisionalPages.isEmpty() || m_isInProcessCache)
    10071007        return false;
    10081008
Note: See TracChangeset for help on using the changeset viewer.