Changeset 256426 in webkit
- Timestamp:
- Feb 11, 2020 10:15:24 PM (4 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r256420 r256426 1 2020-02-11 Youenn Fablet <youenn@apple.com> 2 3 [ Mac Debug wk2 ] ASSERTION FAILED: m_wasConstructedOnMainThread == isMainThread() 4 https://bugs.webkit.org/show_bug.cgi?id=207509 5 <rdar://problem/59325466> 6 7 Reviewed by Chris Dumez. 8 9 Covered by existing tests. 10 11 * NetworkProcess/cache/CacheStorageEngine.cpp: 12 (WebKit::CacheStorage::Engine::writeSizeFile): 13 Make sure completion handler is always called on the main thread. 14 Minor refactoring to make things more efficient. 15 1 16 2020-02-11 Fujii Hironori <Hironori.Fujii@sony.com> 2 17 -
trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp
r255876 r256426 531 531 void Engine::writeSizeFile(const String& path, uint64_t size, CompletionHandler<void()>&& completionHandler) 532 532 { 533 CompletionHandlerCallingScope completionHandlerCaller(WTFMove(completionHandler)); 533 ASSERT(RunLoop::isMain()); 534 534 535 if (!shouldPersist()) 535 return ;536 537 m_ioQueue->dispatch([path = path.isolatedCopy(), size, completionHandler Caller = WTFMove(completionHandlerCaller)]() mutable {536 return completionHandler(); 537 538 m_ioQueue->dispatch([path = path.isolatedCopy(), size, completionHandler = WTFMove(completionHandler)]() mutable { 538 539 LockHolder locker(globalSizeFileLock); 539 540 auto fileHandle = FileSystem::openFile(path, FileSystem::FileOpenMode::Write); 540 auto closeFileHandler = makeScopeExit([&] { 541 542 if (FileSystem::isHandleValid(fileHandle)) { 543 FileSystem::truncateFile(fileHandle, 0); 544 545 auto value = String::number(size).utf8(); 546 FileSystem::writeToFile(fileHandle, value.data(), value.length()); 547 541 548 FileSystem::closeFile(fileHandle); 542 }); 543 if (!FileSystem::isHandleValid(fileHandle)) 544 return; 545 546 FileSystem::truncateFile(fileHandle, 0); 547 FileSystem::writeToFile(fileHandle, String::number(size).utf8().data(), String::number(size).utf8().length()); 548 549 RunLoop::main().dispatch([completionHandlerCaller = WTFMove(completionHandlerCaller)]() mutable { }); 549 } 550 551 RunLoop::main().dispatch(WTFMove(completionHandler)); 550 552 }); 551 553 }
Note: See TracChangeset
for help on using the changeset viewer.