| Differences between
and this patch
- a/Source/WebCore/ChangeLog +52 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2019-08-29  Chris Dumez  <cdumez@apple.com>
2
3
        Add "IsolatedCopy" in the name of String getters that call isolatedCopy() on the string
4
        https://bugs.webkit.org/show_bug.cgi?id=201318
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Add "IsolatedCopy" in the name of String getters that call isolatedCopy() on the string, for clarity.
9
10
        * Modules/indexeddb/server/IDBServer.cpp:
11
        (WebCore::IDBServer::IDBServer::createBackingStore):
12
        (WebCore::IDBServer::IDBServer::performGetAllDatabaseNames):
13
        (WebCore::IDBServer::IDBServer::removeDatabasesModifiedSinceForVersion):
14
        (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesModifiedSince):
15
        (WebCore::IDBServer::IDBServer::removeDatabasesWithOriginsForVersion):
16
        (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
17
        (WebCore::IDBServer::IDBServer::computeSpaceUsedForOrigin):
18
        (WebCore::IDBServer::IDBServer::upgradeFilesIfNecessary):
19
        * Modules/indexeddb/server/IDBServer.h:
20
        (WebCore::IDBServer::IDBServer::databaseDirectoryPathIsolatedCopy const):
21
        * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
22
        (WebCore::IDBServer::SQLiteIDBBackingStore::fullDatabaseDirectoryWithUpgrade):
23
        (WebCore::IDBServer::SQLiteIDBBackingStore::databasesSizeForOrigin const):
24
        (WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore):
25
        * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
26
        (WebCore::IDBServer::SQLiteIDBBackingStore::databaseRootDirectoryIsolatedCopy const):
27
        * Modules/webdatabase/Database.cpp:
28
        (WebCore::Database::markAsDeletedAndClose):
29
        (WebCore::Database::stringIdentifierIsolatedCopy const):
30
        (WebCore::Database::displayNameIsolatedCopy const):
31
        (WebCore::Database::expectedVersionIsolatedCopy const):
32
        (WebCore::Database::fileNameIsolatedCopy const):
33
        (WebCore::Database::details const):
34
        (WebCore::Database::didCommitWriteTransaction):
35
        (WebCore::Database::didExceedQuota):
36
        * Modules/webdatabase/Database.h:
37
        * Modules/webdatabase/DatabaseTracker.cpp:
38
        (WebCore::DatabaseTracker::maximumSize):
39
        (WebCore::DatabaseTracker::doneCreatingDatabase):
40
        (WebCore::DatabaseTracker::addOpenDatabase):
41
        (WebCore::DatabaseTracker::removeOpenDatabase):
42
        * Modules/webdatabase/SQLError.h:
43
        (WebCore::SQLError::messageIsolatedCopy const):
44
        * Modules/webdatabase/SQLError.idl:
45
        * Modules/webdatabase/SQLTransaction.cpp:
46
        (WebCore::SQLTransaction::openTransactionAndPreflight):
47
        * workers/service/server/RegistrationDatabase.cpp:
48
        (WebCore::RegistrationDatabase::openSQLiteDatabase):
49
        (WebCore::RegistrationDatabase::clearAll):
50
        * workers/service/server/RegistrationDatabase.h:
51
        (WebCore::RegistrationDatabase::databaseDirectoryIsolatedCopy const):
52
1
2019-08-29  Zalan Bujtas  <zalan@apple.com>
53
2019-08-29  Zalan Bujtas  <zalan@apple.com>
2
54
3
        [LFC][TFC] Use the "complicated-cases" category for computing the TFC root's height
55
        [LFC][TFC] Use the "complicated-cases" category for computing the TFC root's height
- a/Source/WebKit/ChangeLog +31 lines
Lines 1-3 a/Source/WebKit/ChangeLog_sec1
1
2019-08-29  Chris Dumez  <cdumez@apple.com>
2
3
        Add "IsolatedCopy" in the name of String getters that call isolatedCopy() on the string
4
        https://bugs.webkit.org/show_bug.cgi?id=201318
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Add "IsolatedCopy" in the name of String getters that call isolatedCopy() on the string, for clarity.
9
10
        * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:
11
        (WebKit::ResourceLoadStatisticsPersistentStorage::storageDirectoryPathIsolatedCopy const):
12
        (WebKit::ResourceLoadStatisticsPersistentStorage::resourceLogFilePath const):
13
        (WebKit::ResourceLoadStatisticsPersistentStorage::monitorDirectoryForNewStatistics):
14
        * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h:
15
        * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
16
        (WebKit::NetworkCache::BlobStorage::blobDirectoryPathIsolatedCopy const):
17
        (WebKit::NetworkCache::BlobStorage::synchronize):
18
        (WebKit::NetworkCache::BlobStorage::blobPathForHash const):
19
        * NetworkProcess/cache/NetworkCacheBlobStorage.h:
20
        * NetworkProcess/cache/NetworkCacheStorage.cpp:
21
        (WebKit::NetworkCache::Storage::basePathIsolatedCopy const):
22
        (WebKit::NetworkCache::Storage::versionPath const):
23
        (WebKit::NetworkCache::Storage::recordsPathIsolatedCopy const):
24
        (WebKit::NetworkCache::Storage::synchronize):
25
        (WebKit::NetworkCache::Storage::recordDirectoryPathForKey const):
26
        (WebKit::NetworkCache::Storage::traverse):
27
        (WebKit::NetworkCache::Storage::clear):
28
        (WebKit::NetworkCache::Storage::shrink):
29
        (WebKit::NetworkCache::Storage::deleteOldVersions):
30
        * NetworkProcess/cache/NetworkCacheStorage.h:
31
1
2019-08-29  Chris Dumez  <cdumez@apple.com>
32
2019-08-29  Chris Dumez  <cdumez@apple.com>
2
33
3
        [PSON] Bump the WebPage's identifier every time we process-swap
34
        [PSON] Bump the WebPage's identifier every time we process-swap
- a/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp -8 / +8 lines
Lines 132-138 std::unique_ptr<IDBBackingStore> IDBServer::createBackingStore(const IDBDatabase a/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp_sec1
132
{
132
{
133
    ASSERT(!isMainThread());
133
    ASSERT(!isMainThread());
134
134
135
    auto databaseDirectoryPath = this->databaseDirectoryPath();
135
    auto databaseDirectoryPath = this->databaseDirectoryPathIsolatedCopy();
136
    if (databaseDirectoryPath.isEmpty())
136
    if (databaseDirectoryPath.isEmpty())
137
        return MemoryIDBBackingStore::create(m_sessionID, identifier);
137
        return MemoryIDBBackingStore::create(m_sessionID, identifier);
138
138
Lines 467-473 void IDBServer::getAllDatabaseNames(uint64_t serverConnectionIdentifier, const S a/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp_sec2
467
467
468
void IDBServer::performGetAllDatabaseNames(uint64_t serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID)
468
void IDBServer::performGetAllDatabaseNames(uint64_t serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID)
469
{
469
{
470
    auto databaseDirectoryPath = this->databaseDirectoryPath();
470
    auto databaseDirectoryPath = this->databaseDirectoryPathIsolatedCopy();
471
    String oldDirectory = IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot(mainFrameOrigin, openingOrigin, databaseDirectoryPath, "v0");
471
    String oldDirectory = IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot(mainFrameOrigin, openingOrigin, databaseDirectoryPath, "v0");
472
    Vector<String> files = FileSystem::listDirectory(oldDirectory, "*"_s);
472
    Vector<String> files = FileSystem::listDirectory(oldDirectory, "*"_s);
473
    Vector<String> databases;
473
    Vector<String> databases;
Lines 641-647 static void removeAllDatabasesForOriginPath(const String& originPath, WallTime m a/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp_sec3
641
641
642
void IDBServer::removeDatabasesModifiedSinceForVersion(WallTime modifiedSince, const String& version)
642
void IDBServer::removeDatabasesModifiedSinceForVersion(WallTime modifiedSince, const String& version)
643
{
643
{
644
    String versionPath = FileSystem::pathByAppendingComponent(databaseDirectoryPath(), version);
644
    String versionPath = FileSystem::pathByAppendingComponent(databaseDirectoryPathIsolatedCopy(), version);
645
    for (auto& originPath : FileSystem::listDirectory(versionPath, "*")) {
645
    for (auto& originPath : FileSystem::listDirectory(versionPath, "*")) {
646
        String databaseIdentifier = FileSystem::lastComponentOfPathIgnoringTrailingSlash(originPath);
646
        String databaseIdentifier = FileSystem::lastComponentOfPathIgnoringTrailingSlash(originPath);
647
        if (auto securityOrigin = SecurityOriginData::fromDatabaseIdentifier(databaseIdentifier))
647
        if (auto securityOrigin = SecurityOriginData::fromDatabaseIdentifier(databaseIdentifier))
Lines 651-657 void IDBServer::removeDatabasesModifiedSinceForVersion(WallTime modifiedSince, c a/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp_sec4
651
651
652
void IDBServer::performCloseAndDeleteDatabasesModifiedSince(WallTime modifiedSince, uint64_t callbackID)
652
void IDBServer::performCloseAndDeleteDatabasesModifiedSince(WallTime modifiedSince, uint64_t callbackID)
653
{
653
{
654
    if (!databaseDirectoryPath().isEmpty()) {
654
    if (!databaseDirectoryPathIsolatedCopy().isEmpty()) {
655
        removeDatabasesModifiedSinceForVersion(modifiedSince, "v0");
655
        removeDatabasesModifiedSinceForVersion(modifiedSince, "v0");
656
        removeDatabasesModifiedSinceForVersion(modifiedSince, "v1");
656
        removeDatabasesModifiedSinceForVersion(modifiedSince, "v1");
657
    }
657
    }
Lines 661-667 void IDBServer::performCloseAndDeleteDatabasesModifiedSince(WallTime modifiedSin a/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp_sec5
661
661
662
void IDBServer::removeDatabasesWithOriginsForVersion(const Vector<SecurityOriginData> &origins, const String& version)
662
void IDBServer::removeDatabasesWithOriginsForVersion(const Vector<SecurityOriginData> &origins, const String& version)
663
{
663
{
664
    String versionPath = FileSystem::pathByAppendingComponent(databaseDirectoryPath(), version);
664
    String versionPath = FileSystem::pathByAppendingComponent(databaseDirectoryPathIsolatedCopy(), version);
665
    for (const auto& origin : origins) {
665
    for (const auto& origin : origins) {
666
        String originPath = FileSystem::pathByAppendingComponent(versionPath, origin.databaseIdentifier());
666
        String originPath = FileSystem::pathByAppendingComponent(versionPath, origin.databaseIdentifier());
667
        removeAllDatabasesForOriginPath(originPath, -WallTime::infinity());
667
        removeAllDatabasesForOriginPath(originPath, -WallTime::infinity());
Lines 675-681 void IDBServer::removeDatabasesWithOriginsForVersion(const Vector<SecurityOrigin a/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp_sec6
675
    
675
    
676
void IDBServer::performCloseAndDeleteDatabasesForOrigins(const Vector<SecurityOriginData>& origins, uint64_t callbackID)
676
void IDBServer::performCloseAndDeleteDatabasesForOrigins(const Vector<SecurityOriginData>& origins, uint64_t callbackID)
677
{
677
{
678
    if (!databaseDirectoryPath().isEmpty()) {
678
    if (!databaseDirectoryPathIsolatedCopy().isEmpty()) {
679
        removeDatabasesWithOriginsForVersion(origins, "v0");
679
        removeDatabasesWithOriginsForVersion(origins, "v0");
680
        removeDatabasesWithOriginsForVersion(origins, "v1");
680
        removeDatabasesWithOriginsForVersion(origins, "v1");
681
    }
681
    }
Lines 769-775 void IDBServer::computeSpaceUsedForOrigin(const ClientOrigin& origin) a/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp_sec7
769
{
769
{
770
    ASSERT(!isMainThread());
770
    ASSERT(!isMainThread());
771
771
772
    auto databaseDirectoryPath = this->databaseDirectoryPath();
772
    auto databaseDirectoryPath = this->databaseDirectoryPathIsolatedCopy();
773
    auto oldVersionOriginDirectory = IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot(origin.topOrigin, origin.clientOrigin, databaseDirectoryPath, "v0");
773
    auto oldVersionOriginDirectory = IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot(origin.topOrigin, origin.clientOrigin, databaseDirectoryPath, "v0");
774
    auto newVersionOriginDirectory = IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot(origin.topOrigin, origin.clientOrigin, databaseDirectoryPath, "v1");
774
    auto newVersionOriginDirectory = IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot(origin.topOrigin, origin.clientOrigin, databaseDirectoryPath, "v1");
775
    auto size = SQLiteIDBBackingStore::databasesSizeForFolder(oldVersionOriginDirectory) + SQLiteIDBBackingStore::databasesSizeForFolder(newVersionOriginDirectory);
775
    auto size = SQLiteIDBBackingStore::databasesSizeForFolder(oldVersionOriginDirectory) + SQLiteIDBBackingStore::databasesSizeForFolder(newVersionOriginDirectory);
Lines 816-822 void IDBServer::decreasePotentialSpaceUsed(const ClientOrigin& origin, uint64_t a/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp_sec8
816
816
817
void IDBServer::upgradeFilesIfNecessary()
817
void IDBServer::upgradeFilesIfNecessary()
818
{
818
{
819
    auto databaseDirectoryPath = this->databaseDirectoryPath();
819
    auto databaseDirectoryPath = this->databaseDirectoryPathIsolatedCopy();
820
    if (databaseDirectoryPath.isEmpty() || !FileSystem::fileExists(databaseDirectoryPath))
820
    if (databaseDirectoryPath.isEmpty() || !FileSystem::fileExists(databaseDirectoryPath))
821
        return;
821
        return;
822
822
- a/Source/WebCore/Modules/indexeddb/server/IDBServer.h -1 / +1 lines
Lines 130-136 private: a/Source/WebCore/Modules/indexeddb/server/IDBServer.h_sec1
130
130
131
    UniqueIDBDatabase& getOrCreateUniqueIDBDatabase(const IDBDatabaseIdentifier&);
131
    UniqueIDBDatabase& getOrCreateUniqueIDBDatabase(const IDBDatabaseIdentifier&);
132
    
132
    
133
    String databaseDirectoryPath() const { return m_databaseDirectoryPath.isolatedCopy(); }
133
    String databaseDirectoryPathIsolatedCopy() const { return m_databaseDirectoryPath.isolatedCopy(); }
134
134
135
    void performGetAllDatabaseNames(uint64_t serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID);
135
    void performGetAllDatabaseNames(uint64_t serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID);
136
    void didGetAllDatabaseNames(uint64_t serverConnectionIdentifier, uint64_t callbackID, const Vector<String>& databaseNames);
136
    void didGetAllDatabaseNames(uint64_t serverConnectionIdentifier, uint64_t callbackID, const Vector<String>& databaseNames);
- a/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp -3 / +3 lines
Lines 765-771 String SQLiteIDBBackingStore::databaseNameFromFile(const String& databasePath) a/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp_sec1
765
765
766
String SQLiteIDBBackingStore::fullDatabaseDirectoryWithUpgrade()
766
String SQLiteIDBBackingStore::fullDatabaseDirectoryWithUpgrade()
767
{
767
{
768
    auto databaseRootDirectory = this->databaseRootDirectory();
768
    auto databaseRootDirectory = this->databaseRootDirectoryIsolatedCopy();
769
    String oldOriginDirectory = m_identifier.databaseDirectoryRelativeToRoot(databaseRootDirectory, "v0");
769
    String oldOriginDirectory = m_identifier.databaseDirectoryRelativeToRoot(databaseRootDirectory, "v0");
770
    String oldDatabaseDirectory = FileSystem::pathByAppendingComponent(oldOriginDirectory, filenameForDatabaseName());
770
    String oldDatabaseDirectory = FileSystem::pathByAppendingComponent(oldOriginDirectory, filenameForDatabaseName());
771
    String newOriginDirectory = m_identifier.databaseDirectoryRelativeToRoot(databaseRootDirectory, "v1");
771
    String newOriginDirectory = m_identifier.databaseDirectoryRelativeToRoot(databaseRootDirectory, "v1");
Lines 857-863 uint64_t SQLiteIDBBackingStore::databasesSizeForFolder(const String& folder) a/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp_sec2
857
857
858
uint64_t SQLiteIDBBackingStore::databasesSizeForOrigin() const
858
uint64_t SQLiteIDBBackingStore::databasesSizeForOrigin() const
859
{
859
{
860
    auto databaseRootDirectory = this->databaseRootDirectory();
860
    auto databaseRootDirectory = this->databaseRootDirectoryIsolatedCopy();
861
    String oldVersionOriginDirectory = m_identifier.databaseDirectoryRelativeToRoot(databaseRootDirectory, "v0");
861
    String oldVersionOriginDirectory = m_identifier.databaseDirectoryRelativeToRoot(databaseRootDirectory, "v0");
862
    String newVersionOriginDirectory = m_identifier.databaseDirectoryRelativeToRoot(databaseRootDirectory, "v1");
862
    String newVersionOriginDirectory = m_identifier.databaseDirectoryRelativeToRoot(databaseRootDirectory, "v1");
863
    return databasesSizeForFolder(oldVersionOriginDirectory) + databasesSizeForFolder(newVersionOriginDirectory);
863
    return databasesSizeForFolder(oldVersionOriginDirectory) + databasesSizeForFolder(newVersionOriginDirectory);
Lines 2562-2568 void SQLiteIDBBackingStore::deleteBackingStore() a/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp_sec3
2562
2562
2563
    SQLiteFileSystem::deleteDatabaseFile(dbFilename);
2563
    SQLiteFileSystem::deleteDatabaseFile(dbFilename);
2564
    SQLiteFileSystem::deleteEmptyDatabaseDirectory(m_databaseDirectory);
2564
    SQLiteFileSystem::deleteEmptyDatabaseDirectory(m_databaseDirectory);
2565
    SQLiteFileSystem::deleteEmptyDatabaseDirectory(m_identifier.databaseDirectoryRelativeToRoot(databaseRootDirectory()));
2565
    SQLiteFileSystem::deleteEmptyDatabaseDirectory(m_identifier.databaseDirectoryRelativeToRoot(databaseRootDirectoryIsolatedCopy()));
2566
}
2566
}
2567
2567
2568
void SQLiteIDBBackingStore::unregisterCursor(SQLiteIDBCursor& cursor)
2568
void SQLiteIDBBackingStore::unregisterCursor(SQLiteIDBCursor& cursor)
- a/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h -1 / +1 lines
Lines 109-115 private: a/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h_sec1
109
    String fullDatabasePath() const;
109
    String fullDatabasePath() const;
110
    String fullDatabaseDirectoryWithUpgrade();
110
    String fullDatabaseDirectoryWithUpgrade();
111
    
111
    
112
    String databaseRootDirectory() const { return m_databaseRootDirectory.isolatedCopy(); }
112
    String databaseRootDirectoryIsolatedCopy() const { return m_databaseRootDirectory.isolatedCopy(); }
113
113
114
    bool ensureValidRecordsTable();
114
    bool ensureValidRecordsTable();
115
    bool ensureValidIndexRecordsTable();
115
    bool ensureValidIndexRecordsTable();
- a/Source/WebCore/Modules/webdatabase/Database.cpp -8 / +8 lines
Lines 580-586 void Database::markAsDeletedAndClose() a/Source/WebCore/Modules/webdatabase/Database.cpp_sec1
580
    if (m_deleted)
580
    if (m_deleted)
581
        return;
581
        return;
582
582
583
    LOG(StorageAPI, "Marking %s (%p) as deleted", stringIdentifier().ascii().data(), this);
583
    LOG(StorageAPI, "Marking %s (%p) as deleted", stringIdentifierIsolatedCopy().ascii().data(), this);
584
    m_deleted = true;
584
    m_deleted = true;
585
585
586
    close();
586
    close();
Lines 601-619 void Database::readTransaction(RefPtr<SQLTransactionCallback>&& callback, RefPtr a/Source/WebCore/Modules/webdatabase/Database.cpp_sec2
601
    runTransaction(WTFMove(callback), WTFMove(errorCallback), WTFMove(successCallback), nullptr, true);
601
    runTransaction(WTFMove(callback), WTFMove(errorCallback), WTFMove(successCallback), nullptr, true);
602
}
602
}
603
603
604
String Database::stringIdentifier() const
604
String Database::stringIdentifierIsolatedCopy() const
605
{
605
{
606
    // Return a deep copy for ref counting thread safety
606
    // Return a deep copy for ref counting thread safety
607
    return m_name.isolatedCopy();
607
    return m_name.isolatedCopy();
608
}
608
}
609
609
610
String Database::displayName() const
610
String Database::displayNameIsolatedCopy() const
611
{
611
{
612
    // Return a deep copy for ref counting thread safety
612
    // Return a deep copy for ref counting thread safety
613
    return m_displayName.isolatedCopy();
613
    return m_displayName.isolatedCopy();
614
}
614
}
615
615
616
String Database::expectedVersion() const
616
String Database::expectedVersionIsolatedCopy() const
617
{
617
{
618
    // Return a deep copy for ref counting thread safety
618
    // Return a deep copy for ref counting thread safety
619
    return m_expectedVersion.isolatedCopy();
619
    return m_expectedVersion.isolatedCopy();
Lines 630-636 void Database::setEstimatedSize(unsigned long long estimatedSize) a/Source/WebCore/Modules/webdatabase/Database.cpp_sec3
630
    DatabaseTracker::singleton().setDatabaseDetails(securityOrigin(), m_name, m_displayName, m_estimatedSize);
630
    DatabaseTracker::singleton().setDatabaseDetails(securityOrigin(), m_name, m_displayName, m_estimatedSize);
631
}
631
}
632
632
633
String Database::fileName() const
633
String Database::fileNameIsolatedCopy() const
634
{
634
{
635
    // Return a deep copy for ref counting thread safety
635
    // Return a deep copy for ref counting thread safety
636
    return m_filename.isolatedCopy();
636
    return m_filename.isolatedCopy();
Lines 639-645 String Database::fileName() const a/Source/WebCore/Modules/webdatabase/Database.cpp_sec4
639
DatabaseDetails Database::details() const
639
DatabaseDetails Database::details() const
640
{
640
{
641
    // This code path is only used for database quota delegate calls, so file dates are irrelevant and left uninitialized.
641
    // This code path is only used for database quota delegate calls, so file dates are irrelevant and left uninitialized.
642
    return DatabaseDetails(stringIdentifier(), displayName(), estimatedSize(), 0, WTF::nullopt, WTF::nullopt);
642
    return DatabaseDetails(stringIdentifierIsolatedCopy(), displayNameIsolatedCopy(), estimatedSize(), 0, WTF::nullopt, WTF::nullopt);
643
}
643
}
644
644
645
void Database::disableAuthorizer()
645
void Database::disableAuthorizer()
Lines 786-792 unsigned long long Database::maximumSize() a/Source/WebCore/Modules/webdatabase/Database.cpp_sec5
786
786
787
void Database::didCommitWriteTransaction()
787
void Database::didCommitWriteTransaction()
788
{
788
{
789
    DatabaseTracker::singleton().scheduleNotifyDatabaseChanged(securityOrigin(), stringIdentifier());
789
    DatabaseTracker::singleton().scheduleNotifyDatabaseChanged(securityOrigin(), stringIdentifierIsolatedCopy());
790
}
790
}
791
791
792
bool Database::didExceedQuota()
792
bool Database::didExceedQuota()
Lines 799-805 bool Database::didExceedQuota() a/Source/WebCore/Modules/webdatabase/Database.cpp_sec6
799
        // oldQuota + 5MB so that the client actually increases the quota.
799
        // oldQuota + 5MB so that the client actually increases the quota.
800
        setEstimatedSize(oldQuota + quotaIncreaseSize);
800
        setEstimatedSize(oldQuota + quotaIncreaseSize);
801
    }
801
    }
802
    databaseContext().databaseExceededQuota(stringIdentifier(), details());
802
    databaseContext().databaseExceededQuota(stringIdentifierIsolatedCopy(), details());
803
    return tracker.quota(securityOrigin()) > oldQuota;
803
    return tracker.quota(securityOrigin()) > oldQuota;
804
}
804
}
805
805
- a/Source/WebCore/Modules/webdatabase/Database.h -4 / +4 lines
Lines 86-96 public: a/Source/WebCore/Modules/webdatabase/Database.h_sec1
86
    void readTransaction(RefPtr<SQLTransactionCallback>&&, RefPtr<SQLTransactionErrorCallback>&&, RefPtr<VoidCallback>&& successCallback);
86
    void readTransaction(RefPtr<SQLTransactionCallback>&&, RefPtr<SQLTransactionErrorCallback>&&, RefPtr<VoidCallback>&& successCallback);
87
87
88
    // Internal engine support
88
    // Internal engine support
89
    String stringIdentifier() const;
89
    String stringIdentifierIsolatedCopy() const;
90
    String displayName() const;
90
    String displayNameIsolatedCopy() const;
91
    String expectedVersion() const;
91
    String expectedVersionIsolatedCopy() const;
92
    unsigned long long estimatedSize() const;
92
    unsigned long long estimatedSize() const;
93
    String fileName() const;
93
    String fileNameIsolatedCopy() const;
94
    DatabaseDetails details() const;
94
    DatabaseDetails details() const;
95
    SQLiteDatabase& sqliteDatabase() { return m_sqliteDatabase; }
95
    SQLiteDatabase& sqliteDatabase() { return m_sqliteDatabase; }
96
96
- a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp -7 / +7 lines
Lines 276-282 unsigned long long DatabaseTracker::maximumSize(Database& database) a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp_sec1
276
276
277
    unsigned long long quota = quotaNoLock(origin);
277
    unsigned long long quota = quotaNoLock(origin);
278
    unsigned long long diskUsage = usage(origin);
278
    unsigned long long diskUsage = usage(origin);
279
    unsigned long long databaseFileSize = SQLiteFileSystem::getDatabaseFileSize(database.fileName());
279
    unsigned long long databaseFileSize = SQLiteFileSystem::getDatabaseFileSize(database.fileNameIsolatedCopy());
280
    ASSERT(databaseFileSize <= diskUsage);
280
    ASSERT(databaseFileSize <= diskUsage);
281
281
282
    if (diskUsage > quota)
282
    if (diskUsage > quota)
Lines 518-524 void DatabaseTracker::setDatabaseDetails(const SecurityOriginData& origin, const a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp_sec2
518
void DatabaseTracker::doneCreatingDatabase(Database& database)
518
void DatabaseTracker::doneCreatingDatabase(Database& database)
519
{
519
{
520
    LockHolder lockDatabase(m_databaseGuard);
520
    LockHolder lockDatabase(m_databaseGuard);
521
    doneCreatingDatabase(database.securityOrigin(), database.stringIdentifier());
521
    doneCreatingDatabase(database.securityOrigin(), database.stringIdentifierIsolatedCopy());
522
}
522
}
523
523
524
Vector<Ref<Database>> DatabaseTracker::openDatabases()
524
Vector<Ref<Database>> DatabaseTracker::openDatabases()
Lines 554-560 void DatabaseTracker::addOpenDatabase(Database& database) a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp_sec3
554
        m_openDatabaseMap->add(origin.isolatedCopy(), nameMap);
554
        m_openDatabaseMap->add(origin.isolatedCopy(), nameMap);
555
    }
555
    }
556
556
557
    String name = database.stringIdentifier();
557
    String name = database.stringIdentifierIsolatedCopy();
558
    auto* databaseSet = nameMap->get(name);
558
    auto* databaseSet = nameMap->get(name);
559
    if (!databaseSet) {
559
    if (!databaseSet) {
560
        databaseSet = new DatabaseSet;
560
        databaseSet = new DatabaseSet;
Lines 563-569 void DatabaseTracker::addOpenDatabase(Database& database) a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp_sec4
563
563
564
    databaseSet->add(&database);
564
    databaseSet->add(&database);
565
565
566
    LOG(StorageAPI, "Added open Database %s (%p)\n", database.stringIdentifier().utf8().data(), &database);
566
    LOG(StorageAPI, "Added open Database %s (%p)\n", database.stringIdentifierIsolatedCopy().utf8().data(), &database);
567
}
567
}
568
568
569
void DatabaseTracker::removeOpenDatabase(Database& database)
569
void DatabaseTracker::removeOpenDatabase(Database& database)
Lines 581-587 void DatabaseTracker::removeOpenDatabase(Database& database) a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp_sec5
581
        return;
581
        return;
582
    }
582
    }
583
583
584
    String name = database.stringIdentifier();
584
    String name = database.stringIdentifierIsolatedCopy();
585
    auto* databaseSet = nameMap->get(name);
585
    auto* databaseSet = nameMap->get(name);
586
    if (!databaseSet) {
586
    if (!databaseSet) {
587
        ASSERT_NOT_REACHED();
587
        ASSERT_NOT_REACHED();
Lines 590-596 void DatabaseTracker::removeOpenDatabase(Database& database) a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp_sec6
590
590
591
    databaseSet->remove(&database);
591
    databaseSet->remove(&database);
592
592
593
    LOG(StorageAPI, "Removed open Database %s (%p)\n", database.stringIdentifier().utf8().data(), &database);
593
    LOG(StorageAPI, "Removed open Database %s (%p)\n", database.stringIdentifierIsolatedCopy().utf8().data(), &database);
594
594
595
    if (!databaseSet->isEmpty())
595
    if (!databaseSet->isEmpty())
596
        return;
596
        return;
Lines 1210-1216 void DatabaseTracker::removeDeletedOpenedDatabases() a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp_sec7
1210
                            continue;
1210
                            continue;
1211
                        
1211
                        
1212
                        // If this database has been deleted or if its database file no longer matches the current version, this database is no longer valid and it should be marked as deleted.
1212
                        // If this database has been deleted or if its database file no longer matches the current version, this database is no longer valid and it should be marked as deleted.
1213
                        if (databaseFileName.isNull() || databaseFileName != FileSystem::pathGetFileName(db->fileName())) {
1213
                        if (databaseFileName.isNull() || databaseFileName != FileSystem::pathGetFileName(db->fileNameIsolatedCopy())) {
1214
                            deletedDatabases.append(db);
1214
                            deletedDatabases.append(db);
1215
                            foundDeletedDatabase = true;
1215
                            foundDeletedDatabase = true;
1216
                        }
1216
                        }
- a/Source/WebCore/Modules/webdatabase/SQLError.h -1 / +1 lines
Lines 46-52 public: a/Source/WebCore/Modules/webdatabase/SQLError.h_sec1
46
    }
46
    }
47
47
48
    unsigned code() const { return m_code; }
48
    unsigned code() const { return m_code; }
49
    String message() const { return m_message.isolatedCopy(); }
49
    String messageIsolatedCopy() const { return m_message.isolatedCopy(); }
50
50
51
    enum SQLErrorCode {
51
    enum SQLErrorCode {
52
        UNKNOWN_ERR = 0,
52
        UNKNOWN_ERR = 0,
- a/Source/WebCore/Modules/webdatabase/SQLError.idl -1 / +1 lines
Lines 31-37 a/Source/WebCore/Modules/webdatabase/SQLError.idl_sec1
31
    EnabledAtRuntime=WebSQL,
31
    EnabledAtRuntime=WebSQL,
32
] interface SQLError {
32
] interface SQLError {
33
    readonly attribute unsigned long code;
33
    readonly attribute unsigned long code;
34
    readonly attribute DOMString message;
34
    [ImplementedAs=messageIsolatedCopy] readonly attribute DOMString message;
35
35
36
    // SQLErrorCode: used only in the async DB API
36
    // SQLErrorCode: used only in the async DB API
37
    const unsigned short UNKNOWN_ERR = 0;
37
    const unsigned short UNKNOWN_ERR = 0;
- a/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp -1 / +2 lines
Lines 265-271 void SQLTransaction::openTransactionAndPreflight() a/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp_sec1
265
        return;
265
        return;
266
    }
266
    }
267
267
268
    m_hasVersionMismatch = !m_database->expectedVersion().isEmpty() && (m_database->expectedVersion() != actualVersion);
268
    auto expectedVersion = m_database->expectedVersionIsolatedCopy();
269
    m_hasVersionMismatch = !expectedVersion.isEmpty() && expectedVersion != actualVersion;
269
270
270
    // Spec 4.3.2.3: Perform preflight steps, jumping to the error callback if they fail
271
    // Spec 4.3.2.3: Perform preflight steps, jumping to the error callback if they fail
271
    if (m_wrapper && !m_wrapper->performPreflight(*this)) {
272
    if (m_wrapper && !m_wrapper->performPreflight(*this)) {
- a/Source/WebCore/inspector/agents/InspectorDatabaseAgent.cpp -4 / +4 lines
Lines 60-66 namespace { a/Source/WebCore/inspector/agents/InspectorDatabaseAgent.cpp_sec1
60
void reportTransactionFailed(ExecuteSQLCallback& requestCallback, SQLError& error)
60
void reportTransactionFailed(ExecuteSQLCallback& requestCallback, SQLError& error)
61
{
61
{
62
    auto errorObject = Inspector::Protocol::Database::Error::create()
62
    auto errorObject = Inspector::Protocol::Database::Error::create()
63
        .setMessage(error.message())
63
        .setMessage(error.messageIsolatedCopy())
64
        .setCode(error.code())
64
        .setCode(error.code())
65
        .release();
65
        .release();
66
    requestCallback.sendSuccess(nullptr, nullptr, WTFMove(errorObject));
66
    requestCallback.sendSuccess(nullptr, nullptr, WTFMove(errorObject));
Lines 205-216 void InspectorDatabaseAgent::didCommitLoad() a/Source/WebCore/inspector/agents/InspectorDatabaseAgent.cpp_sec2
205
205
206
void InspectorDatabaseAgent::didOpenDatabase(Database& database)
206
void InspectorDatabaseAgent::didOpenDatabase(Database& database)
207
{
207
{
208
    if (auto resource = findByFileName(database.fileName())) {
208
    if (auto resource = findByFileName(database.fileNameIsolatedCopy())) {
209
        resource->setDatabase(database);
209
        resource->setDatabase(database);
210
        return;
210
        return;
211
    }
211
    }
212
212
213
    auto resource = InspectorDatabaseResource::create(database, database.securityOrigin().host, database.stringIdentifier(), database.expectedVersion());
213
    auto resource = InspectorDatabaseResource::create(database, database.securityOrigin().host, database.stringIdentifierIsolatedCopy(), database.expectedVersionIsolatedCopy());
214
    m_resources.add(resource->id(), resource.ptr());
214
    m_resources.add(resource->id(), resource.ptr());
215
    resource->bind(*m_frontendDispatcher);
215
    resource->bind(*m_frontendDispatcher);
216
}
216
}
Lines 304-310 String InspectorDatabaseAgent::databaseId(Database& database) a/Source/WebCore/inspector/agents/InspectorDatabaseAgent.cpp_sec3
304
InspectorDatabaseResource* InspectorDatabaseAgent::findByFileName(const String& fileName)
304
InspectorDatabaseResource* InspectorDatabaseAgent::findByFileName(const String& fileName)
305
{
305
{
306
    for (auto& resource : m_resources.values()) {
306
    for (auto& resource : m_resources.values()) {
307
        if (resource->database().fileName() == fileName)
307
        if (resource->database().fileNameIsolatedCopy() == fileName)
308
            return resource.get();
308
            return resource.get();
309
    }
309
    }
310
    return nullptr;
310
    return nullptr;
- a/Source/WebCore/workers/service/server/RegistrationDatabase.cpp -2 / +2 lines
Lines 130-136 void RegistrationDatabase::openSQLiteDatabase(const String& fullFilename) a/Source/WebCore/workers/service/server/RegistrationDatabase.cpp_sec1
130
    ASSERT(!isMainThread());
130
    ASSERT(!isMainThread());
131
    ASSERT(!m_database);
131
    ASSERT(!m_database);
132
132
133
    auto databaseDirectory = this->databaseDirectory();
133
    auto databaseDirectory = this->databaseDirectoryIsolatedCopy();
134
    cleanOldDatabases(databaseDirectory);
134
    cleanOldDatabases(databaseDirectory);
135
135
136
    LOG(ServiceWorker, "ServiceWorker RegistrationDatabase opening file %s", fullFilename.utf8().data());
136
    LOG(ServiceWorker, "ServiceWorker RegistrationDatabase opening file %s", fullFilename.utf8().data());
Lines 305-311 void RegistrationDatabase::clearAll(CompletionHandler<void()>&& completionHandle a/Source/WebCore/workers/service/server/RegistrationDatabase.cpp_sec2
305
        m_database = nullptr;
305
        m_database = nullptr;
306
306
307
        SQLiteFileSystem::deleteDatabaseFile(m_databaseFilePath);
307
        SQLiteFileSystem::deleteDatabaseFile(m_databaseFilePath);
308
        SQLiteFileSystem::deleteEmptyDatabaseDirectory(databaseDirectory());
308
        SQLiteFileSystem::deleteEmptyDatabaseDirectory(databaseDirectoryIsolatedCopy());
309
309
310
        callOnMainThread(WTFMove(completionHandler));
310
        callOnMainThread(WTFMove(completionHandler));
311
    });
311
    });
- a/Source/WebCore/workers/service/server/RegistrationDatabase.h -1 / +1 lines
Lines 60-66 public: a/Source/WebCore/workers/service/server/RegistrationDatabase.h_sec1
60
private:
60
private:
61
    RegistrationDatabase(RegistrationStore&, String&& databaseDirectory);
61
    RegistrationDatabase(RegistrationStore&, String&& databaseDirectory);
62
    
62
    
63
    String databaseDirectory() const { return m_databaseDirectory.isolatedCopy(); }
63
    String databaseDirectoryIsolatedCopy() const { return m_databaseDirectory.isolatedCopy(); }
64
64
65
    void postTaskToWorkQueue(Function<void()>&&);
65
    void postTaskToWorkQueue(Function<void()>&&);
66
66
- a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp -3 / +3 lines
Lines 76-89 ResourceLoadStatisticsPersistentStorage::~ResourceLoadStatisticsPersistentStorag a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp_sec1
76
        writeMemoryStoreToDisk();
76
        writeMemoryStoreToDisk();
77
}
77
}
78
78
79
String ResourceLoadStatisticsPersistentStorage::storageDirectoryPath() const
79
String ResourceLoadStatisticsPersistentStorage::storageDirectoryPathIsolatedCopy() const
80
{
80
{
81
    return m_storageDirectoryPath.isolatedCopy();
81
    return m_storageDirectoryPath.isolatedCopy();
82
}
82
}
83
83
84
String ResourceLoadStatisticsPersistentStorage::resourceLogFilePath() const
84
String ResourceLoadStatisticsPersistentStorage::resourceLogFilePath() const
85
{
85
{
86
    String storagePath = storageDirectoryPath();
86
    String storagePath = storageDirectoryPathIsolatedCopy();
87
    if (storagePath.isEmpty())
87
    if (storagePath.isEmpty())
88
        return emptyString();
88
        return emptyString();
89
89
Lines 122-128 void ResourceLoadStatisticsPersistentStorage::monitorDirectoryForNewStatistics() a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp_sec2
122
{
122
{
123
    ASSERT(!RunLoop::isMain());
123
    ASSERT(!RunLoop::isMain());
124
124
125
    String storagePath = storageDirectoryPath();
125
    String storagePath = storageDirectoryPathIsolatedCopy();
126
    ASSERT(!storagePath.isEmpty());
126
    ASSERT(!storagePath.isEmpty());
127
127
128
    if (!FileSystem::fileExists(storagePath)) {
128
    if (!FileSystem::fileExists(storagePath)) {
- a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h -1 / +1 lines
Lines 56-62 public: a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h_sec1
56
    void scheduleOrWriteMemoryStore(ForceImmediateWrite);
56
    void scheduleOrWriteMemoryStore(ForceImmediateWrite);
57
57
58
private:
58
private:
59
    String storageDirectoryPath() const;
59
    String storageDirectoryPathIsolatedCopy() const;
60
    String resourceLogFilePath() const;
60
    String resourceLogFilePath() const;
61
61
62
    void startMonitoringDisk();
62
    void startMonitoringDisk();
- a/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp -3 / +3 lines
Lines 108-114 Cache::Cache(NetworkProcess& networkProcess, Ref<Storage>&& storage, OptionSet<C a/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp_sec1
108
#endif
108
#endif
109
#if PLATFORM(GTK) || PLATFORM(WPE)
109
#if PLATFORM(GTK) || PLATFORM(WPE)
110
        // Triggers with "touch $cachePath/dump".
110
        // Triggers with "touch $cachePath/dump".
111
        CString dumpFilePath = fileSystemRepresentation(pathByAppendingComponent(m_storage->basePath(), "dump"));
111
        CString dumpFilePath = fileSystemRepresentation(pathByAppendingComponent(m_storage->basePathIsolatedCopy(), "dump"));
112
        GRefPtr<GFile> dumpFile = adoptGRef(g_file_new_for_path(dumpFilePath.data()));
112
        GRefPtr<GFile> dumpFile = adoptGRef(g_file_new_for_path(dumpFilePath.data()));
113
        GFileMonitor* monitor = g_file_monitor_file(dumpFile.get(), G_FILE_MONITOR_NONE, nullptr, nullptr);
113
        GFileMonitor* monitor = g_file_monitor_file(dumpFile.get(), G_FILE_MONITOR_NONE, nullptr, nullptr);
114
        g_signal_connect_swapped(monitor, "changed", G_CALLBACK(dumpFileChanged), this);
114
        g_signal_connect_swapped(monitor, "changed", G_CALLBACK(dumpFileChanged), this);
Lines 593-601 void Cache::clear() a/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp_sec2
593
    clear(-WallTime::infinity(), nullptr);
593
    clear(-WallTime::infinity(), nullptr);
594
}
594
}
595
595
596
String Cache::recordsPath() const
596
String Cache::recordsPathIsolatedCopy() const
597
{
597
{
598
    return m_storage->recordsPath();
598
    return m_storage->recordsPathIsolatedCopy();
599
}
599
}
600
600
601
void Cache::retrieveData(const DataKey& dataKey, Function<void(const uint8_t*, size_t)> completionHandler)
601
void Cache::retrieveData(const DataKey& dataKey, Function<void(const uint8_t*, size_t)> completionHandler)
- a/Source/WebKit/NetworkProcess/cache/NetworkCache.h -1 / +1 lines
Lines 139-145 public: a/Source/WebKit/NetworkProcess/cache/NetworkCache.h_sec1
139
139
140
    void dumpContentsToFile();
140
    void dumpContentsToFile();
141
141
142
    String recordsPath() const;
142
    String recordsPathIsolatedCopy() const;
143
143
144
#if ENABLE(NETWORK_CACHE_SPECULATIVE_REVALIDATION)
144
#if ENABLE(NETWORK_CACHE_SPECULATIVE_REVALIDATION)
145
    SpeculativeLoadManager* speculativeLoadManager() { return m_speculativeLoadManager.get(); }
145
    SpeculativeLoadManager* speculativeLoadManager() { return m_speculativeLoadManager.get(); }
- a/Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.cpp -4 / +5 lines
Lines 46-52 BlobStorage::BlobStorage(const String& blobDirectoryPath, Salt salt) a/Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.cpp_sec1
46
{
46
{
47
}
47
}
48
48
49
String BlobStorage::blobDirectoryPath() const
49
String BlobStorage::blobDirectoryPathIsolatedCopy() const
50
{
50
{
51
    return m_blobDirectoryPath.isolatedCopy();
51
    return m_blobDirectoryPath.isolatedCopy();
52
}
52
}
Lines 55-64 void BlobStorage::synchronize() a/Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.cpp_sec2
55
{
55
{
56
    ASSERT(!RunLoop::isMain());
56
    ASSERT(!RunLoop::isMain());
57
57
58
    FileSystem::makeAllDirectories(blobDirectoryPath());
58
    auto blobDirectoryPath = blobDirectoryPathIsolatedCopy();
59
    FileSystem::makeAllDirectories(blobDirectoryPath);
59
60
60
    m_approximateSize = 0;
61
    m_approximateSize = 0;
61
    auto blobDirectory = blobDirectoryPath();
62
    auto blobDirectory = blobDirectoryPath;
62
    traverseDirectory(blobDirectory, [this, &blobDirectory](const String& name, DirectoryEntryType type) {
63
    traverseDirectory(blobDirectory, [this, &blobDirectory](const String& name, DirectoryEntryType type) {
63
        if (type != DirectoryEntryType::File)
64
        if (type != DirectoryEntryType::File)
64
            return;
65
            return;
Lines 79-85 void BlobStorage::synchronize() a/Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.cpp_sec3
79
String BlobStorage::blobPathForHash(const SHA1::Digest& hash) const
80
String BlobStorage::blobPathForHash(const SHA1::Digest& hash) const
80
{
81
{
81
    auto hashAsString = SHA1::hexDigest(hash);
82
    auto hashAsString = SHA1::hexDigest(hash);
82
    return FileSystem::pathByAppendingComponent(blobDirectoryPath(), String::fromUTF8(hashAsString));
83
    return FileSystem::pathByAppendingComponent(blobDirectoryPathIsolatedCopy(), String::fromUTF8(hashAsString));
83
}
84
}
84
85
85
BlobStorage::Blob BlobStorage::add(const String& path, const Data& data)
86
BlobStorage::Blob BlobStorage::add(const String& path, const Data& data)
- a/Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.h -1 / +1 lines
Lines 57-63 public: a/Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.h_sec1
57
    void synchronize();
57
    void synchronize();
58
58
59
private:
59
private:
60
    String blobDirectoryPath() const;
60
    String blobDirectoryPathIsolatedCopy() const;
61
    String blobPathForHash(const SHA1::Digest&) const;
61
    String blobPathForHash(const SHA1::Digest&) const;
62
62
63
    const String m_blobDirectoryPath;
63
    const String m_blobDirectoryPath;
- a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp -10 / +10 lines
Lines 251-267 Storage::~Storage() a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp_sec1
251
    ASSERT(!m_shrinkInProgress);
251
    ASSERT(!m_shrinkInProgress);
252
}
252
}
253
253
254
String Storage::basePath() const
254
String Storage::basePathIsolatedCopy() const
255
{
255
{
256
    return m_basePath.isolatedCopy();
256
    return m_basePath.isolatedCopy();
257
}
257
}
258
258
259
String Storage::versionPath() const
259
String Storage::versionPath() const
260
{
260
{
261
    return makeVersionedDirectoryPath(basePath());
261
    return makeVersionedDirectoryPath(basePathIsolatedCopy());
262
}
262
}
263
263
264
String Storage::recordsPath() const
264
String Storage::recordsPathIsolatedCopy() const
265
{
265
{
266
    return m_recordsPath.isolatedCopy();
266
    return m_recordsPath.isolatedCopy();
267
}
267
}
Lines 299-305 void Storage::synchronize() a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp_sec2
299
        unsigned blobCount = 0;
299
        unsigned blobCount = 0;
300
300
301
        String anyType;
301
        String anyType;
302
        traverseRecordsFiles(recordsPath(), anyType, [&](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) {
302
        traverseRecordsFiles(recordsPathIsolatedCopy(), anyType, [&](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) {
303
            auto filePath = FileSystem::pathByAppendingComponent(recordDirectoryPath, fileName);
303
            auto filePath = FileSystem::pathByAppendingComponent(recordDirectoryPath, fileName);
304
304
305
            Key::HashType hash;
305
            Key::HashType hash;
Lines 323-329 void Storage::synchronize() a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp_sec3
323
323
324
        m_blobStorage.synchronize();
324
        m_blobStorage.synchronize();
325
325
326
        deleteEmptyRecordsDirectories(recordsPath());
326
        deleteEmptyRecordsDirectories(recordsPathIsolatedCopy());
327
327
328
        LOG(NetworkCacheStorage, "(NetworkProcess) cache synchronization completed size=%zu recordCount=%u", recordsSize, recordCount);
328
        LOG(NetworkCacheStorage, "(NetworkProcess) cache synchronization completed size=%zu recordCount=%u", recordsSize, recordCount);
329
329
Lines 374-380 bool Storage::mayContainBlob(const Key& key) const a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp_sec4
374
String Storage::recordDirectoryPathForKey(const Key& key) const
374
String Storage::recordDirectoryPathForKey(const Key& key) const
375
{
375
{
376
    ASSERT(!key.type().isEmpty());
376
    ASSERT(!key.type().isEmpty());
377
    return FileSystem::pathByAppendingComponent(FileSystem::pathByAppendingComponent(recordsPath(), key.partitionHashAsString()), key.type());
377
    return FileSystem::pathByAppendingComponent(FileSystem::pathByAppendingComponent(recordsPathIsolatedCopy(), key.partitionHashAsString()), key.type());
378
}
378
}
379
379
380
String Storage::recordPathForKey(const Key& key) const
380
String Storage::recordPathForKey(const Key& key) const
Lines 903-909 void Storage::traverse(const String& type, OptionSet<TraverseFlag> flags, Traver a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp_sec5
903
    m_activeTraverseOperations.add(WTFMove(traverseOperationPtr));
903
    m_activeTraverseOperations.add(WTFMove(traverseOperationPtr));
904
904
905
    ioQueue().dispatch([this, &traverseOperation] {
905
    ioQueue().dispatch([this, &traverseOperation] {
906
        traverseRecordsFiles(recordsPath(), traverseOperation.type, [this, &traverseOperation](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) {
906
        traverseRecordsFiles(recordsPathIsolatedCopy(), traverseOperation.type, [this, &traverseOperation](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) {
907
            ASSERT(type == traverseOperation.type || traverseOperation.type.isEmpty());
907
            ASSERT(type == traverseOperation.type || traverseOperation.type.isEmpty());
908
            if (isBlob)
908
            if (isBlob)
909
                return;
909
                return;
Lines 998-1004 void Storage::clear(const String& type, WallTime modifiedSinceTime, CompletionHa a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp_sec6
998
    m_approximateRecordsSize = 0;
998
    m_approximateRecordsSize = 0;
999
999
1000
    ioQueue().dispatch([this, protectedThis = makeRef(*this), modifiedSinceTime, completionHandler = WTFMove(completionHandler), type = type.isolatedCopy()] () mutable {
1000
    ioQueue().dispatch([this, protectedThis = makeRef(*this), modifiedSinceTime, completionHandler = WTFMove(completionHandler), type = type.isolatedCopy()] () mutable {
1001
        auto recordsPath = this->recordsPath();
1001
        auto recordsPath = this->recordsPathIsolatedCopy();
1002
        traverseRecordsFiles(recordsPath, type, [modifiedSinceTime](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) {
1002
        traverseRecordsFiles(recordsPath, type, [modifiedSinceTime](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) {
1003
            auto filePath = FileSystem::pathByAppendingComponent(recordDirectoryPath, fileName);
1003
            auto filePath = FileSystem::pathByAppendingComponent(recordDirectoryPath, fileName);
1004
            if (modifiedSinceTime > -WallTime::infinity()) {
1004
            if (modifiedSinceTime > -WallTime::infinity()) {
Lines 1074-1080 void Storage::shrink() a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp_sec7
1074
    LOG(NetworkCacheStorage, "(NetworkProcess) shrinking cache approximateSize=%zu capacity=%zu", approximateSize(), m_capacity);
1074
    LOG(NetworkCacheStorage, "(NetworkProcess) shrinking cache approximateSize=%zu capacity=%zu", approximateSize(), m_capacity);
1075
1075
1076
    backgroundIOQueue().dispatch([this, protectedThis = makeRef(*this)] () mutable {
1076
    backgroundIOQueue().dispatch([this, protectedThis = makeRef(*this)] () mutable {
1077
        auto recordsPath = this->recordsPath();
1077
        auto recordsPath = this->recordsPathIsolatedCopy();
1078
        String anyType;
1078
        String anyType;
1079
        traverseRecordsFiles(recordsPath, anyType, [this](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) {
1079
        traverseRecordsFiles(recordsPath, anyType, [this](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) {
1080
            if (isBlob)
1080
            if (isBlob)
Lines 1109-1115 void Storage::shrink() a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp_sec8
1109
1109
1110
void Storage::deleteOldVersions()
1110
void Storage::deleteOldVersions()
1111
{
1111
{
1112
    backgroundIOQueue().dispatch([cachePath = basePath()] () mutable {
1112
    backgroundIOQueue().dispatch([cachePath = basePathIsolatedCopy()] () mutable {
1113
        traverseDirectory(cachePath, [&cachePath](const String& subdirName, DirectoryEntryType type) {
1113
        traverseDirectory(cachePath, [&cachePath](const String& subdirName, DirectoryEntryType type) {
1114
            if (type != DirectoryEntryType::Directory)
1114
            if (type != DirectoryEntryType::Directory)
1115
                return;
1115
                return;
- a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h -2 / +2 lines
Lines 113-121 public: a/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h_sec1
113
    static const unsigned lastStableVersion = 13;
113
    static const unsigned lastStableVersion = 13;
114
#endif
114
#endif
115
115
116
    String basePath() const;
116
    String basePathIsolatedCopy() const;
117
    String versionPath() const;
117
    String versionPath() const;
118
    String recordsPath() const;
118
    String recordsPathIsolatedCopy() const;
119
119
120
    const Salt& salt() const { return m_salt; }
120
    const Salt& salt() const { return m_salt; }
121
121

Return to Bug 201318