Changeset 248393 in webkit


Ignore:
Timestamp:
Aug 7, 2019 3:29:18 PM (5 years ago)
Author:
Chris Dumez
Message:

Regression(r247784) ResourceLoadStatisticsMemoryStore / ResourceLoadStatisticsPersistentStorage may get destroyed on the wrong thread
https://bugs.webkit.org/show_bug.cgi?id=200517

Reviewed by Geoffrey Garen.

The issue is that WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore() is null checking
m_persistentStorage and m_statisticsStore on the main thread, even though those members are initialized
and destroyed on the background thread. As a result, if flushAndDestroyPersistentStore() is called *before*
the background task to initialize those members has had a chance to run, then we'd return early without
destroying those members. Later on, the background task would then initialize those data members and we
would then destroy them on the main thread when the WebResourceLoadStatisticsStore is destroyed on the
main thread.

  • NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:

(WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r248380 r248393  
     12019-08-07  Chris Dumez  <cdumez@apple.com>
     2
     3        Regression(r247784) ResourceLoadStatisticsMemoryStore / ResourceLoadStatisticsPersistentStorage may get destroyed on the wrong thread
     4        https://bugs.webkit.org/show_bug.cgi?id=200517
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        The issue is that WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore() is null checking
     9        m_persistentStorage and m_statisticsStore on the main thread, even though those members are initialized
     10        and destroyed on the background thread. As a result, if flushAndDestroyPersistentStore() is called *before*
     11        the background task to initialize those members has had a chance to run, then we'd return early without
     12        destroying those members. Later on, the background task would then initialize those data members and we
     13        would then destroy them on the main thread when the WebResourceLoadStatisticsStore is destroyed on the
     14        main thread.
     15
     16        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
     17        (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
     18
    1192019-08-06  Dean Jackson  <dino@apple.com>
    220
  • trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp

    r248372 r248393  
    211211    ASSERT(RunLoop::isMain());
    212212
    213     if (!m_persistentStorage && !m_statisticsStore)
    214         return;
    215 
    216213    // Make sure we destroy the persistent store on the background queue and wait for it to die
    217214    // synchronously since it has a C++ reference to us. Blocking nature of this task allows us
Note: See TracChangeset for help on using the changeset viewer.