Title: [252369] trunk/Source/WebKit
Revision
252369
Author
[email protected]
Date
2019-11-12 11:07:41 -0800 (Tue, 12 Nov 2019)

Log Message

Unreviewed, rolling out r252351.

casued 50+ crashes on Mac and iOS wk2 debug

Reverted changeset:

"Add size file for CacheStorage"
https://bugs.webkit.org/show_bug.cgi?id=204027
https://trac.webkit.org/changeset/252351

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (252368 => 252369)


--- trunk/Source/WebKit/ChangeLog	2019-11-12 17:30:07 UTC (rev 252368)
+++ trunk/Source/WebKit/ChangeLog	2019-11-12 19:07:41 UTC (rev 252369)
@@ -1,3 +1,15 @@
+2019-11-12  Truitt Savell  <[email protected]>
+
+        Unreviewed, rolling out r252351.
+
+        casued 50+ crashes on Mac and iOS wk2 debug
+
+        Reverted changeset:
+
+        "Add size file for CacheStorage"
+        https://bugs.webkit.org/show_bug.cgi?id=204027
+        https://trac.webkit.org/changeset/252351
+
 2019-11-12  Alex Christensen  <[email protected]>
 
         Revert remainder of r251676

Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp (252368 => 252369)


--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp	2019-11-12 17:30:07 UTC (rev 252368)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp	2019-11-12 19:07:41 UTC (rev 252369)
@@ -35,7 +35,6 @@
 #include <WebCore/SecurityOrigin.h>
 #include <wtf/CallbackAggregator.h>
 #include <wtf/NeverDestroyed.h>
-#include <wtf/Scope.h>
 #include <wtf/text/StringBuilder.h>
 #include <wtf/text/StringHash.h>
 
@@ -462,55 +461,6 @@
     });
 }
 
-void Engine::writeSizeFile(const String& path, uint64_t size)
-{
-    if (!shouldPersist())
-        return;
-
-    m_ioQueue->dispatch([path = path.isolatedCopy(), size]() {
-        auto fileHandle = FileSystem::openAndLockFile(path, FileSystem::FileOpenMode::Write, { FileSystem::FileLockMode::Exclusive });
-        auto closeFileHandle = makeScopeExit([&] {
-            FileSystem::unlockAndCloseFile(fileHandle);
-        });
-
-        if (!FileSystem::isHandleValid(fileHandle))
-            return;
-
-        FileSystem::truncateFile(fileHandle, 0);
-
-        FileSystem::writeToFile(fileHandle, String::number(size).utf8().data(), String::number(size).utf8().length());
-    });
-}
-
-Optional<uint64_t> Engine::readSizeFile(const String& path)
-{
-    ASSERT(!RunLoop::isMain());
-    ASSERT(FileSystem::fileExists(path));
-
-    auto fileHandle = FileSystem::openAndLockFile(path, FileSystem::FileOpenMode::Read, { FileSystem::FileLockMode::Exclusive });
-    auto closeFileHandle = makeScopeExit([&] {
-        FileSystem::unlockAndCloseFile(fileHandle);
-    });
-
-    if (!FileSystem::isHandleValid(fileHandle))
-        return WTF::nullopt;
-
-    long long fileSize = 0;
-    if (!FileSystem::getFileSize(path, fileSize) || !fileSize)
-        return WTF::nullopt;
-
-    size_t bytesToRead;
-    if (!WTF::convertSafely(fileSize, bytesToRead))
-        return WTF::nullopt;
-
-    Vector<char> buffer(bytesToRead);
-    size_t totalBytesRead = FileSystem::readFromFile(fileHandle, buffer.data(), buffer.size());
-    if (totalBytesRead != bytesToRead)
-        return WTF::nullopt;
-
-    return String::fromUTF8(buffer.data()).toUInt64Strict();
-}
-
 class ReadOriginsTaskCounter : public RefCounted<ReadOriginsTaskCounter> {
 public:
     static Ref<ReadOriginsTaskCounter> create(CompletionHandler<void(Vector<WebsiteData::Entry>)>&& callback)

Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h (252368 => 252369)


--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h	2019-11-12 17:30:07 UTC (rev 252368)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h	2019-11-12 19:07:41 UTC (rev 252369)
@@ -84,8 +84,6 @@
     void writeFile(const String& filename, NetworkCache::Data&&, WebCore::DOMCacheEngine::CompletionCallback&&);
     void readFile(const String& filename, CompletionHandler<void(const NetworkCache::Data&, int error)>&&);
     void removeFile(const String& filename);
-    void writeSizeFile(const String&, uint64_t size);
-    static Optional<uint64_t> readSizeFile(const String&);
 
     const String& rootPath() const { return m_rootPath; }
     const NetworkCache::Salt& salt() const { return m_salt.value(); }

Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp (252368 => 252369)


--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp	2019-11-12 17:30:07 UTC (rev 252368)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp	2019-11-12 19:07:41 UTC (rev 252369)
@@ -51,11 +51,6 @@
     return FileSystem::pathByAppendingComponent(cachesRootPath, "origin"_s);
 }
 
-static inline String cachesSizeFilename(const String& cachesRootsPath)
-{
-    return FileSystem::pathByAppendingComponent(cachesRootsPath, "estimatedsize"_s);
-}
-
 Ref<Caches> Caches::create(Engine& engine, WebCore::ClientOrigin&& origin, String&& rootPath, WebCore::StorageQuotaManager& quotaManager)
 {
     auto caches = adoptRef(*new Caches { engine, WTFMove(origin), WTFMove(rootPath), quotaManager });
@@ -208,12 +203,6 @@
     });
 }
 
-void Caches::updateSizeFile()
-{
-    if (m_engine)
-        m_engine->writeSizeFile(cachesSizeFilename(m_rootPath), m_size);
-}
-
 void Caches::initializeSize()
 {
     if (!m_storage) {
@@ -232,8 +221,6 @@
                 return;
             }
             m_size = size;
-            updateSizeFile();
-
             m_isInitialized = true;
             auto pendingCallbacks = WTFMove(m_pendingInitializationCallbacks);
             for (auto& callback : pendingCallbacks)
@@ -548,7 +535,6 @@
     ASSERT(m_size >= previousRecordSize);
     m_size += recordInformation.size;
     m_size -= previousRecordSize;
-    updateSizeFile();
 
     if (!shouldPersist()) {
         m_volatileStorage.set(recordInformation.key, WTFMove(record));
@@ -605,8 +591,6 @@
 
     ASSERT(m_size >= record.size);
     m_size -= record.size;
-    updateSizeFile();
-
     removeCacheEntry(record.key);
 }
 
@@ -624,8 +608,6 @@
 void Caches::resetSpaceUsed()
 {
     m_size = 0;
-    updateSizeFile();
-
     if (m_quotaManager) {
         m_quotaManager->removeUser(*this);
         m_quotaManager->addUser(*this);

Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.h (252368 => 252369)


--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.h	2019-11-12 17:30:07 UTC (rev 252368)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.h	2019-11-12 19:07:41 UTC (rev 252369)
@@ -105,8 +105,6 @@
 
     bool hasActiveCache() const;
 
-    void updateSizeFile();
-
     bool m_isInitialized { false };
     Engine* m_engine { nullptr };
     uint64_t m_updateCounter { 0 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to