Changeset 274482 in webkit
- Timestamp:
- Mar 16, 2021, 9:21:02 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
Modules/entriesapi/DOMFileSystem.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r274480 r274482 1 2021-03-16 Youenn Fablet <youenn@apple.com> 2 3 Protect DOMFileSystem when hopping to a background thread 4 https://bugs.webkit.org/show_bug.cgi?id=223246 5 6 Reviewed by Chris Dumez. 7 8 Make sure to ref when hopping to background thread and hop back to main thread to unref. 9 10 * Modules/entriesapi/DOMFileSystem.cpp: 11 (WebCore::DOMFileSystem::getParent): 12 (WebCore::DOMFileSystem::getEntry): 13 1 14 2021-03-16 Carlos Garcia Campos <cgarcia@igalia.com> 2 15 -
trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp
r266168 r274482 271 271 ASSERT(virtualPath[0] == '/'); 272 272 auto fullPath = evaluatePath(virtualPath); 273 m_workQueue->dispatch([ this, context = makeRef(context), fullPath = crossThreadCopy(fullPath), virtualPath = crossThreadCopy(virtualPath), completionCallback = WTFMove(completionCallback)]() mutable {273 m_workQueue->dispatch([protectedThis = makeRef(*this), context = makeRef(context), fullPath = crossThreadCopy(fullPath), virtualPath = crossThreadCopy(virtualPath), completionCallback = WTFMove(completionCallback)]() mutable { 274 274 auto validatedVirtualPath = validatePathIsExpectedType(fullPath, WTFMove(virtualPath), FileMetadata::Type::Directory); 275 callOnMainThread([ this, context = WTFMove(context), validatedVirtualPath = crossThreadCopy(validatedVirtualPath), completionCallback = WTFMove(completionCallback)]() mutable {275 callOnMainThread([protectedThis = WTFMove(protectedThis), context = WTFMove(context), validatedVirtualPath = crossThreadCopy(validatedVirtualPath), completionCallback = WTFMove(completionCallback)]() mutable { 276 276 if (validatedVirtualPath.hasException()) 277 277 completionCallback(validatedVirtualPath.releaseException()); 278 278 else 279 completionCallback(FileSystemDirectoryEntry::create(context, *this, validatedVirtualPath.releaseReturnValue()));279 completionCallback(FileSystemDirectoryEntry::create(context, protectedThis.get(), validatedVirtualPath.releaseReturnValue())); 280 280 }); 281 281 }); … … 312 312 } 313 313 314 m_workQueue->dispatch([ this, context = makeRef(context), fullPath = crossThreadCopy(fullPath), resolvedVirtualPath = crossThreadCopy(resolvedVirtualPath), completionCallback = WTFMove(completionCallback)]() mutable {314 m_workQueue->dispatch([protectedThis = makeRef(*this), context = makeRef(context), fullPath = crossThreadCopy(fullPath), resolvedVirtualPath = crossThreadCopy(resolvedVirtualPath), completionCallback = WTFMove(completionCallback)]() mutable { 315 315 auto entryType = fileType(fullPath); 316 callOnMainThread([ this, context = WTFMove(context), resolvedVirtualPath = crossThreadCopy(resolvedVirtualPath), entryType, completionCallback = WTFMove(completionCallback)]() mutable {316 callOnMainThread([protectedThis = WTFMove(protectedThis), context = WTFMove(context), resolvedVirtualPath = crossThreadCopy(resolvedVirtualPath), entryType, completionCallback = WTFMove(completionCallback)]() mutable { 317 317 if (!entryType) { 318 318 completionCallback(Exception { NotFoundError, "Cannot find entry at given path"_s }); … … 321 321 switch (entryType.value()) { 322 322 case FileMetadata::Type::Directory: 323 completionCallback(Ref<FileSystemEntry> { FileSystemDirectoryEntry::create(context, *this, resolvedVirtualPath) });323 completionCallback(Ref<FileSystemEntry> { FileSystemDirectoryEntry::create(context, protectedThis.get(), resolvedVirtualPath) }); 324 324 break; 325 325 case FileMetadata::Type::File: 326 completionCallback(Ref<FileSystemEntry> { FileSystemFileEntry::create(context, *this, resolvedVirtualPath) });326 completionCallback(Ref<FileSystemEntry> { FileSystemFileEntry::create(context, protectedThis.get(), resolvedVirtualPath) }); 327 327 break; 328 328 default:
Note:
See TracChangeset
for help on using the changeset viewer.