Closed Bug 922081 Opened 11 years ago Closed 11 years ago

HTTP cache v2: respect "browser.cache.disk.parent_directory" preference

Categories

(Core :: Networking: Cache, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: mayhemer, Assigned: mayhemer)

References

Details

Attachments

(1 file, 1 obsolete file)

No description provided.
thanks a lot for takin care about it
Hi there, any news on this? Thanks
This will be fixed when the new cache will be enabled. So far, feel free to provide a patch your self. I don't plan working on this as a top priority right now.
Attached patch v1 (obsolete) — Splinter Review
Assignee: nobody → honzab.moz
Status: NEW → ASSIGNED
Attachment #8373478 - Flags: review?(michal.novotny)
Comment on attachment 8373478 [details] [diff] [review] v1 Review of attachment 8373478 [details] [diff] [review]: ----------------------------------------------------------------- ::: netwerk/cache2/CacheFileIOManager.cpp @@ +929,5 @@ > nsresult rv; > > nsCOMPtr<nsIFile> directory; > > + CacheObserver::ParentDirOverride(getter_AddRefs(directory)); I think CacheObserver::ParentDirOverride() should either return a clone or we need to clone it here since we append a leaf to this nsIFile a few lines below.
Attachment #8373478 - Flags: review?(michal.novotny) → review-
(In reply to Michal Novotny (:michal) from comment #5) > Comment on attachment 8373478 [details] [diff] [review] > v1 > > Review of attachment 8373478 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: netwerk/cache2/CacheFileIOManager.cpp > @@ +929,5 @@ > > nsresult rv; > > > > nsCOMPtr<nsIFile> directory; > > > > + CacheObserver::ParentDirOverride(getter_AddRefs(directory)); > > I think CacheObserver::ParentDirOverride() should either return a clone or > we need to clone it here since we append a leaf to this nsIFile a few lines > below. But we clone before adding the leaf.
Attachment #8373478 - Flags: review- → review?(michal.novotny)
To make it more clear: 914 nsresult 915 CacheFileIOManager::OnProfile() 916 { 917 LOG(("CacheFileIOManager::OnProfile() [gInstance=%p]", gInstance)); 918 919 MOZ_ASSERT(gInstance); 920 921 nsresult rv; 922 923 nsCOMPtr<nsIFile> directory; 924 ... 942 943 if (directory) { Here is the clone: 944 rv = directory->Clone(getter_AddRefs(gInstance->mCacheDirectory)); 945 NS_ENSURE_SUCCESS(rv, rv); 946 947 rv = gInstance->mCacheDirectory->Append(NS_LITERAL_STRING("cache2")); 948 NS_ENSURE_SUCCESS(rv, rv); 949 } 950 951 return NS_OK; 952 }
Right, I've looked into my tree where I have CacheIndex patch applied and it exchanges Clone() and Append(). The current code is wrong since for a very short time we have a wrong path (without the leaf) in mCacheDirectory between Append() and Clone(). Anyway, NS_GetSpecialDirectory() returns either a new file or a cloned file if it is cached, i.e. always returns a file that the caller can modify as needed. CacheObserver::ParentDirOverride() should do the same to be consistent. And call to Clone() should be removed from CacheFileIOManager::OnProfile() since it is not necessary.
Attached patch v2Splinter Review
- clones inside CacheObserver::ParentDirOverride - clone at OnProfile removed
Attachment #8373478 - Attachment is obsolete: true
Attachment #8373478 - Flags: review?(michal.novotny)
Attachment #8377710 - Flags: review?(michal.novotny)
Michal, ping on review. It's actually quite unfortunate this didn't make it for the trial regardless how simple the patch is, people complain!
Add me as a user interested in seeing this. Under Windows, I use browser.cache.disk.parent_directory to put the cache on a ramdisk. (I have a fast broadband connection, and am not concerned about preserving cache between boots.) Under Linux, I put it in POSIX shared memory in /dev/shm. I want to be able to do the same for cache2.
Attachment #8377710 - Flags: review?(michal.novotny) → review+
Flags: in-testsuite-
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: