Descriptionchrome_paths: refactor and sanitize cache directory handling
Previously we had a bunch of logic in profile_impl.cc that computed
where the cache directory lives. This change relocates it to
chrome_paths.cc.
Some background on cache directories.
There are two possible places to store cache files:
1) in the user data directory
2) in an OS-specific user cache directory
On Windows, we always pick (1). On Mac and Linux, we currently use
(2) in some circumstances. This patch changes both Mac and Linux to
have the same behavior with respect to (2).
The Mac/Linux shared behavior is that if the profile directory
is in the standard location for profiles, we put the cache files
into a matching directory name in the standard system cache directory
(e.g. on Linux if you're using ~/.config/google-chrome, your cache
ends up in ~/.cache/google-chrome; on Mac, the directories are
~/Library/Application Support versus ~/Library/Caches). If your user
data directory is not in the standard location, we use behavior (1).
The semantic changes of this patch should be:
- On Mac, previously we checked whether the (2) directory had some
particular subdirectories already when picking which one to use.
This was removed; which directory is used is solely a question of
whether the profile directory is in the standard location.
I think the previous behavior was unpredictable.
- On Linux, previously we only used behavior (2) if you hadn't changed
your user-data-directory at all. Now, to match Mac, as long as
your user-data-dir is in the standard place, you use the system
cache dir. So e.g. using ~/.config/foobar puts your cache in
~/.cache/foobar.
- On Linux, previously the default cache would end up as directories
under ~/.cache/google-chrome/; now it ends up as directories under
~/.cache/google-chrome/Default/.
(In all instances above, on Linux we continue to obey $XDG_CACHE_HOME.)
BUG=59824
TEST=New test ChromePaths.UserCacheDir
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=67160
Patch Set 1 #Patch Set 2 : better #Patch Set 3 : forgot file #Patch Set 4 : mac #Patch Set 5 : mac #Patch Set 6 : works #
Total comments: 11
Patch Set 7 : review comments #Patch Set 8 : 80 #
Total comments: 2
Patch Set 9 : more mac #Patch Set 10 : mac #
Total comments: 1
Patch Set 11 : akalin #
Total comments: 1
Patch Set 12 : bool removal #Patch Set 13 : more win #
Messages
Total messages: 22 (0 generated)
|