|
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; |