Title: [226946] trunk/Source/WebKit
Revision
226946
Author
[email protected]
Date
2018-01-15 01:36:36 -0800 (Mon, 15 Jan 2018)

Log Message

ASSERTION FAILED: m_ptr under WebKit::CacheStorage::Caches::writeRecord
https://bugs.webkit.org/show_bug.cgi?id=181401
<rdar://problem/36379022>

Patch by Youenn Fablet <[email protected]> on 2018-01-15
Reviewed by Darin Adler.

m_isInitialized is true but m_storage is set to nullptr when calling writeRecord.
The only case seems to be if:
- We are doing persistent storage
- We are traversing the storage to do the initialization. At that point m_storage is set to a correct value.
- clearMemoryRepresentation is called, thus setting m_storage to nullptr and m_isInitialized to false.
We fix this by making clearMemoryRepresentation a no-op if we are initializing the caches.
clearMemoryRepresentation is about cleaning the in-memory information of the caches and the memory representation is empty at init time.
Nullifying m_storage is a memory consumption optimization.

* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::clearMemoryRepresentation):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (226945 => 226946)


--- trunk/Source/WebKit/ChangeLog	2018-01-15 08:45:13 UTC (rev 226945)
+++ trunk/Source/WebKit/ChangeLog	2018-01-15 09:36:36 UTC (rev 226946)
@@ -1,3 +1,23 @@
+2018-01-15  Youenn Fablet  <[email protected]>
+
+        ASSERTION FAILED: m_ptr under WebKit::CacheStorage::Caches::writeRecord
+        https://bugs.webkit.org/show_bug.cgi?id=181401
+        <rdar://problem/36379022>
+
+        Reviewed by Darin Adler.
+
+        m_isInitialized is true but m_storage is set to nullptr when calling writeRecord.
+        The only case seems to be if:
+        - We are doing persistent storage
+        - We are traversing the storage to do the initialization. At that point m_storage is set to a correct value.
+        - clearMemoryRepresentation is called, thus setting m_storage to nullptr and m_isInitialized to false.
+        We fix this by making clearMemoryRepresentation a no-op if we are initializing the caches.
+        clearMemoryRepresentation is about cleaning the in-memory information of the caches and the memory representation is empty at init time.
+        Nullifying m_storage is a memory consumption optimization.
+
+        * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
+        (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
+
 2018-01-12  Wenson Hsieh  <[email protected]>
 
         Unreviewed, speculative build fix after r226899.

Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp (226945 => 226946)


--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp	2018-01-15 08:45:13 UTC (rev 226945)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp	2018-01-15 09:36:36 UTC (rev 226946)
@@ -483,6 +483,12 @@
 
 void Caches::clearMemoryRepresentation()
 {
+    if (!m_isInitialized) {
+        ASSERT(m_caches.isEmpty());
+        // m_storage might not be null in case Caches is being initialized. This is fine as nullify it below is a memory optimization.
+        return;
+    }
+
     makeDirty();
     m_caches.clear();
     m_isInitialized = false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to