Changeset 179327 in webkit
- Timestamp:
- Jan 28, 2015, 6:52:30 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
NetworkProcess/cache/NetworkCacheStorageCocoa.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r179326 r179327 1 2015-01-28 Antti Koivisto <antti@apple.com> 2 3 http/tests/xmlhttprequest/workers/methods.html sometimes times out with disk cache enabled 4 https://bugs.webkit.org/show_bug.cgi?id=140976 5 6 Reviewed by Chris Dumez. 7 8 The previous fix sometimes invoked the completion handler twice. Explicitly track if we 9 have called it or not. 10 11 * NetworkProcess/cache/NetworkCacheStorageCocoa.mm: 12 (WebKit::NetworkCacheStorage::dispatchRetrieveOperation): 13 14 Also move the error case to the done branch. According to the documentation 'done' is always set on error. 15 1 16 2015-01-28 Timothy Horton <timothy_horton@apple.com> 2 17 -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorageCocoa.mm
r179254 r179327 363 363 auto channel = createIOChannelForKey(retrieve.key, IOChannelType::Read, cachePathCapture.string(), fd); 364 364 365 dispatch_io_read(channel.get(), 0, std::numeric_limits<size_t>::max(), dispatch_get_main_queue(), [this, fd, retrieve](bool done, dispatch_data_t fileData, int error) { 365 bool didCallCompletionHandler = false; 366 dispatch_io_read(channel.get(), 0, std::numeric_limits<size_t>::max(), dispatch_get_main_queue(), [this, fd, retrieve, didCallCompletionHandler](bool done, dispatch_data_t fileData, int error) mutable { 366 367 if (done) { 367 368 ASSERT(m_activeRetrieveOperationCount); … … 369 370 dispatchPendingRetrieveOperations(); 370 371 } 371 if (error) { 372 retrieve.completionHandler(nullptr); 373 removeEntry(retrieve.key); 372 if (done) { 373 if (!didCallCompletionHandler) 374 retrieve.completionHandler(nullptr); 375 if (error) 376 removeEntry(retrieve.key); 374 377 return; 375 378 } 376 if (done) { 377 // File exists but is empty. Invoke the completion handler as it hasn't been done yet. 378 if (fileData == dispatch_data_empty) 379 retrieve.completionHandler(nullptr); 380 return; 381 } 379 ASSERT(!didCallCompletionHandler); // We are requesting maximum sized chunk so we should never get called more than once with data. 380 382 381 auto entry = decodeEntry(fileData, fd, retrieve.key); 383 382 bool success = retrieve.completionHandler(WTF::move(entry)); 383 didCallCompletionHandler = true; 384 384 if (!success) 385 385 removeEntry(retrieve.key);
Note:
See TracChangeset
for help on using the changeset viewer.