Changeset 199061 in webkit


Ignore:
Timestamp:
Apr 5, 2016 9:50:29 AM (8 years ago)
Author:
Chris Dumez
Message:

We sometimes fail to remove outdated entry from the disk cache after revalidation and when the resource is no longer cacheable
https://bugs.webkit.org/show_bug.cgi?id=156048
<rdar://problem/25514480>

Reviewed by Antti Koivisto.

Source/WebKit2:

We would sometimes fail to remove outdated entry from the disk cache
after revalidation and when the resource is no longer cacheable. This
was due to Storage::removeFromPendingWriteOperations() only removing
the first pending write operation with a given key instead of actually
removing all of the operations with this key.

  • NetworkProcess/cache/NetworkCacheStorage.cpp:

(WebKit::NetworkCache::Storage::removeFromPendingWriteOperations):

  • NetworkProcess/cache/NetworkCacheStorage.h:

LayoutTests:

Add test coverage for the bug.

  • http/tests/cache/disk-cache/disk-cache-remove-several-pending-writes-expected.txt: Added.
  • http/tests/cache/disk-cache/disk-cache-remove-several-pending-writes.html: Added.
  • http/tests/cache/disk-cache/resources/json.php: Added.
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r199060 r199061  
     12016-04-05  Chris Dumez  <cdumez@apple.com>
     2
     3        We sometimes fail to remove outdated entry from the disk cache after revalidation and when the resource is no longer cacheable
     4        https://bugs.webkit.org/show_bug.cgi?id=156048
     5        <rdar://problem/25514480>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Add test coverage for the bug.
     10
     11        * http/tests/cache/disk-cache/disk-cache-remove-several-pending-writes-expected.txt: Added.
     12        * http/tests/cache/disk-cache/disk-cache-remove-several-pending-writes.html: Added.
     13        * http/tests/cache/disk-cache/resources/json.php: Added.
     14
    1152016-04-05  Antti Koivisto  <antti@apple.com>
    216
  • trunk/Source/WebKit2/ChangeLog

    r199055 r199061  
     12016-04-05  Chris Dumez  <cdumez@apple.com>
     2
     3        We sometimes fail to remove outdated entry from the disk cache after revalidation and when the resource is no longer cacheable
     4        https://bugs.webkit.org/show_bug.cgi?id=156048
     5        <rdar://problem/25514480>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        We would sometimes fail to remove outdated entry from the disk cache
     10        after revalidation and when the resource is no longer cacheable. This
     11        was due to Storage::removeFromPendingWriteOperations() only removing
     12        the first pending write operation with a given key instead of actually
     13        removing all of the operations with this key.
     14
     15        * NetworkProcess/cache/NetworkCacheStorage.cpp:
     16        (WebKit::NetworkCache::Storage::removeFromPendingWriteOperations):
     17        * NetworkProcess/cache/NetworkCacheStorage.h:
     18
    1192016-04-05  Antoine Quint  <graouts@apple.com>
    220
  • trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp

    r194496 r199061  
    524524}
    525525
    526 bool Storage::removeFromPendingWriteOperations(const Key& key)
    527 {
    528     auto end = m_pendingWriteOperations.end();
    529     for (auto it = m_pendingWriteOperations.begin(); it != end; ++it) {
    530         if ((*it)->record.key == key) {
    531             m_pendingWriteOperations.remove(it);
    532             return true;
    533         }
    534     }
    535     return false;
     526void Storage::removeFromPendingWriteOperations(const Key& key)
     527{
     528    while (true) {
     529        auto found = m_pendingWriteOperations.findIf([&key](const std::unique_ptr<WriteOperation>& operation) {
     530            return operation->record.key == key;
     531        });
     532
     533        if (found == m_pendingWriteOperations.end())
     534            break;
     535
     536        m_pendingWriteOperations.remove(found);
     537    }
    536538}
    537539
  • trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h

    r198202 r199061  
    123123
    124124    void updateFileModificationTime(const String& path);
    125     bool removeFromPendingWriteOperations(const Key&);
     125    void removeFromPendingWriteOperations(const Key&);
    126126
    127127    WorkQueue& ioQueue() { return m_ioQueue.get(); }
Note: See TracChangeset for help on using the changeset viewer.