Changeset 147263 in webkit


Ignore:
Timestamp:
Mar 29, 2013 5:04:17 PM (11 years ago)
Author:
aestes@apple.com
Message:

Let cached resources from file: schemes expire immediately
https://bugs.webkit.org/show_bug.cgi?id=113626

Reviewed by Brady Eidson

When a CachedResource was loaded from a file: URL, we would give it an
indefinite freshness lifetime. This means that we would continue to
serve a stale resource from the memory cache even if the file was
changed on disk. With the introduction of main resource caching, this
behavior broke at least one third-party WebKit app (see <rdar://problem/13313769>).

We should instead let file resources expire immediately. Modern
filesystems implement their own caching, so we should get good
performance for multiple reads of unmodified files without doing our
own caching.

  • loader/cache/CachedResource.cpp:

(WebCore::CachedResource::freshnessLifetime): file: URLs should have a
0 freshness lifetime.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r147261 r147263  
     12013-03-29  Andy Estes  <aestes@apple.com>
     2
     3        Let cached resources from file: schemes expire immediately
     4        https://bugs.webkit.org/show_bug.cgi?id=113626
     5
     6        Reviewed by Brady Eidson
     7
     8        When a CachedResource was loaded from a file: URL, we would give it an
     9        indefinite freshness lifetime. This means that we would continue to
     10        serve a stale resource from the memory cache even if the file was
     11        changed on disk. With the introduction of main resource caching, this
     12        behavior broke at least one third-party WebKit app (see <rdar://problem/13313769>).
     13
     14        We should instead let file resources expire immediately. Modern
     15        filesystems implement their own caching, so we should get good
     16        performance for multiple reads of unmodified files without doing our
     17        own caching.
     18
     19        * loader/cache/CachedResource.cpp:
     20        (WebCore::CachedResource::freshnessLifetime): file: URLs should have a
     21        0 freshness lifetime.
     22
    1232013-03-29  Ojan Vafai  <ojan@chromium.org>
    224
  • trunk/Source/WebCore/loader/cache/CachedResource.cpp

    r146544 r147263  
    433433double CachedResource::freshnessLifetime() const
    434434{
    435     // Cache non-http resources liberally
     435    // Let file: resources expire immediately so that we don't serve a stale
     436    // resource when a file has changed underneath us. Modern filesystems
     437    // implement their own caches, so we should still get good performance if
     438    // the resource hasn't changed.
     439    if (m_response.url().protocolIs("file"))
     440        return 0;
     441
     442    // Cache other non-http resources liberally.
    436443    if (!m_response.url().protocolIsInHTTPFamily())
    437444        return std::numeric_limits<double>::max();
Note: See TracChangeset for help on using the changeset viewer.