Changeset 252264 in webkit


Ignore:
Timestamp:
Nov 8, 2019 3:01:40 PM (4 years ago)
Author:
Antti Koivisto
Message:

Use separate cache directory for development WebKit on Mac
https://bugs.webkit.org/show_bug.cgi?id=204015

Reviewed by Youenn Fablet.

Replace the NetworkCache::lastStableVersion scheme with a completely separate directory.
This way potential bugs in development WebKit can't end up affecting system WebKit cache.
This also removes the need to keep lastStableVersion updated.

  • NetworkProcess/cache/NetworkCacheStorage.cpp:

(WebKit::NetworkCache::makeCachePath):

Add '/Development' to cache path if this is not system WebKit.

(WebKit::NetworkCache::Storage::open):
(WebKit::NetworkCache::Storage::deleteOldVersions):

No need to avoid deleting lastStableVersion anymore.

  • NetworkProcess/cache/NetworkCacheStorage.h:
Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r252261 r252264  
     12019-11-08  Antti Koivisto  <antti@apple.com>
     2
     3        Use separate cache directory for development WebKit on Mac
     4        https://bugs.webkit.org/show_bug.cgi?id=204015
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Replace the NetworkCache::lastStableVersion scheme with a completely separate directory.
     9        This way potential bugs in development WebKit can't end up affecting system WebKit cache.
     10        This also removes the need to keep lastStableVersion updated.
     11
     12        * NetworkProcess/cache/NetworkCacheStorage.cpp:
     13        (WebKit::NetworkCache::makeCachePath):
     14
     15        Add '/Development' to cache path if this is not system WebKit.
     16
     17        (WebKit::NetworkCache::Storage::open):
     18        (WebKit::NetworkCache::Storage::deleteOldVersions):
     19
     20        No need to avoid deleting lastStableVersion anymore.
     21
     22        * NetworkProcess/cache/NetworkCacheStorage.h:
     23
    1242019-11-08  Per Arne Vollan  <pvollan@apple.com>
    225
  • trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp

    r249313 r252264  
    144144};
    145145
     146static String makeCachePath(const String& baseCachePath)
     147{
     148#if PLATFORM(MAC)
     149    // Put development cache to a different directory to avoid affecting the system cache.
     150    if (!AuxiliaryProcess::isSystemWebKit())
     151        return FileSystem::pathByAppendingComponent(baseCachePath, "Development"_s);
     152#endif
     153    return baseCachePath;
     154}
     155
    146156static String makeVersionedDirectoryPath(const String& baseDirectoryPath)
    147157{
     
    165175}
    166176
    167 RefPtr<Storage> Storage::open(const String& cachePath, Mode mode)
    168 {
    169     ASSERT(RunLoop::isMain());
     177RefPtr<Storage> Storage::open(const String& baseCachePath, Mode mode)
     178{
     179    ASSERT(RunLoop::isMain());
     180
     181    auto cachePath = makeCachePath(baseCachePath);
    170182
    171183    if (!FileSystem::makeAllDirectories(makeVersionedDirectoryPath(cachePath)))
    172184        return nullptr;
     185
    173186    auto salt = readOrMakeSalt(makeSaltFilePath(cachePath));
    174187    if (!salt)
    175188        return nullptr;
     189
    176190    return adoptRef(new Storage(cachePath, mode, *salt));
    177191}
     
    11231137            if (directoryVersion >= version)
    11241138                return;
    1125 #if PLATFORM(MAC)
    1126             if (!AuxiliaryProcess::isSystemWebKit() && directoryVersion == lastStableVersion)
    1127                 return;
    1128 #endif
    11291139
    11301140            auto oldVersionPath = FileSystem::pathByAppendingComponent(cachePath, subdirName);
  • trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h

    r252116 r252264  
    109109    // Incrementing this number will delete all existing cache content for everyone. Do you really need to do it?
    110110    static const unsigned version = 15;
    111 #if PLATFORM(MAC)
    112     /// Allow the last stable version of the cache to co-exist with the latest development one.
    113     static const unsigned lastStableVersion = 13;
    114 #endif
    115111
    116112    String basePathIsolatedCopy() const;
Note: See TracChangeset for help on using the changeset viewer.