Estimat entry value based on its age and access time.
Created attachment 248910 [details] patch
Created attachment 248913 [details] patch
Comment on attachment 248913 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=248913&action=review > Source/WebKit2/NetworkProcess/cache/NetworkCacheFileSystemPosix.h:87 > + auto times = fileTimes(path); It’s a little bit irritating that this function calls fileSystemRepresentation on the path twice, allocating two separate C strings. > Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp:312 > + auto entry = decodeEntry(fileData, channel->fileDescriptor(), read.key); Is there something that guarantees that the file descriptor is still open at this point? Just extending the lifetime of the IOChannel alone doesn’t seem to guarantee that. > Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp:592 > + if (age <= seconds::zero() || accessAge > age) > + return maximumProbability; No check for accessAge < 0?
Comment on attachment 248913 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=248913&action=review >> Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp:312 >> + auto entry = decodeEntry(fileData, channel->fileDescriptor(), read.key); > > Is there something that guarantees that the file descriptor is still open at this point? Just extending the lifetime of the IOChannel alone doesn’t seem to guarantee that. It should, slightly indirectly. File closes when the underlying dispatch_io closes and IOChannel refs it: m_dispatchIO = adoptDispatch(dispatch_io_create(DISPATCH_IO_RANDOM, fd, dispatch_get_main_queue(), [fd](int) { close(fd); }));
Comment on attachment 248913 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=248913&action=review > Source/WebKit2/ChangeLog:5 > + <rdar://problem/19632130> > Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp:292 > + // We update access time nit: Missing period at the end.
https://trac.webkit.org/r181700