Title: [254596] branches/safari-609-branch/Source/WebKitLegacy
Revision
254596
Author
alanc...@apple.com
Date
2020-01-15 11:15:02 -0800 (Wed, 15 Jan 2020)

Log Message

Cherry-pick r254169. rdar://problem/58552876

    REGRESSION (r248734): different threads write m_storageMap of StorageAreaImpl at the same time
    https://bugs.webkit.org/show_bug.cgi?id=205764
    <rdar://problem/58179425>

    Reviewed by Maciej Stachowiak.

    In StorageAreaImpl, we avoid modifying m_storageMap from different threads at the same time by blocking main
    thread access to it until the writes(importing items) of storage thread is done.

    In r248734 we introduced a new case where the main thread could modify m_storageMap for session change, but we
    didn't add the wait there.

    * Storage/StorageAreaImpl.cpp:
    (WebKit::StorageAreaImpl::importItems):
    (WebKit::StorageAreaImpl::sessionChanged):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254169 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-609-branch/Source/WebKitLegacy/ChangeLog (254595 => 254596)


--- branches/safari-609-branch/Source/WebKitLegacy/ChangeLog	2020-01-15 19:15:00 UTC (rev 254595)
+++ branches/safari-609-branch/Source/WebKitLegacy/ChangeLog	2020-01-15 19:15:02 UTC (rev 254596)
@@ -1,3 +1,44 @@
+2020-01-14  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r254169. rdar://problem/58552876
+
+    REGRESSION (r248734): different threads write m_storageMap of StorageAreaImpl at the same time
+    https://bugs.webkit.org/show_bug.cgi?id=205764
+    <rdar://problem/58179425>
+    
+    Reviewed by Maciej Stachowiak.
+    
+    In StorageAreaImpl, we avoid modifying m_storageMap from different threads at the same time by blocking main
+    thread access to it until the writes(importing items) of storage thread is done.
+    
+    In r248734 we introduced a new case where the main thread could modify m_storageMap for session change, but we
+    didn't add the wait there.
+    
+    * Storage/StorageAreaImpl.cpp:
+    (WebKit::StorageAreaImpl::importItems):
+    (WebKit::StorageAreaImpl::sessionChanged):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254169 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-01-07  Sihui Liu  <sihui_...@apple.com>
+
+            REGRESSION (r248734): different threads write m_storageMap of StorageAreaImpl at the same time
+            https://bugs.webkit.org/show_bug.cgi?id=205764
+            <rdar://problem/58179425>
+
+            Reviewed by Maciej Stachowiak.
+
+            In StorageAreaImpl, we avoid modifying m_storageMap from different threads at the same time by blocking main
+            thread access to it until the writes(importing items) of storage thread is done.
+
+            In r248734 we introduced a new case where the main thread could modify m_storageMap for session change, but we
+            didn't add the wait there.
+
+            * Storage/StorageAreaImpl.cpp:
+            (WebKit::StorageAreaImpl::importItems):
+            (WebKit::StorageAreaImpl::sessionChanged):
+
 2020-01-03  Simon Fraser  <simon.fra...@apple.com>
 
         Add some shared schemes to the WebKit.xcworkspace

Modified: branches/safari-609-branch/Source/WebKitLegacy/Storage/StorageAreaImpl.cpp (254595 => 254596)


--- branches/safari-609-branch/Source/WebKitLegacy/Storage/StorageAreaImpl.cpp	2020-01-15 19:15:00 UTC (rev 254595)
+++ branches/safari-609-branch/Source/WebKitLegacy/Storage/StorageAreaImpl.cpp	2020-01-15 19:15:02 UTC (rev 254596)
@@ -197,6 +197,7 @@
 void StorageAreaImpl::importItems(HashMap<String, String>&& items)
 {
     ASSERT(!m_isShutdown);
+    ASSERT(!isMainThread());
 
     m_storageMap->importItems(WTFMove(items));
 }
@@ -296,6 +297,9 @@
 {
     ASSERT(isMainThread());
 
+    // If import is not completed, background storage thread may be modifying m_storageMap.
+    blockUntilImportComplete();
+
     unsigned quota = m_storageMap->quota();
     m_storageMap = StorageMap::create(quota);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to