Open Bug 585125 Opened 14 years ago Updated 2 years ago

Add General Purpose Notifications To the Cache

Categories

(Core :: Networking: Cache, defect, P5)

x86_64
Linux
defect

Tracking

()

People

(Reporter: byronm, Unassigned)

Details

(Whiteboard: [necko-would-take])

Attachments

(1 file, 1 obsolete file)

Currently, while the cache code has debug logging in place, it does not provide any notifications on useful events, such as when an entry is created, modified, or deleted. This is something that could be potentially handy for a variety of purposes. An immediate use case for such notifications is to create a dynamic about:cache UI that can update itself as the cache's contents change (rather than requiring the user to refresh the page). Mehdi Mulani is working on this. Because the cache code does not run on the main thread, notifications must be dispatched to the main thread and sent from there. This means that the state of the cache may have changed before any observers actually get the notification. Because of this, I don't think we can actually offer up any cache descriptors, etc. as it would be unsafe to do so. Currently, I just pass the key of the entry, paired with a topic (i.e., "eviction", "modification", or "insertion"). Any observers who actually need a handle on the entry could obtain it through the usual fashion: get a session, get a descriptor based on the key, and so forth. The patch that I am attaching is only a work in progress. Namely, there are not yet any notifications instrumenting the memory cache, among other things. Michal--could you please check the call sites that I do have in place, and see where else I might need to add them? I know that one set of evictions I am missing is when nsDiskCacheDevice::EvictDiskCacheEntries is called. This one is tricky, because it ultimately will call doom if the entry is active (I handle that case fine) or will just delete the data from disk if the entry is not active. To get the key of the entry in the latter case, I would have to read the entry in from disk, just so that we could then delete it... there should be a better way. I'm sure there are also string and memory issues. Feedback is welcome, and I'll work to improve this in the meantime.
Attachment #463615 - Attachment is patch: true
Attachment #463615 - Attachment mime type: application/octet-stream → text/plain
This bug doesn't block bug 573176 anymore because information about the cache was not included in the about:permissions interface that was implemented there. We can file a bug to include this information later, but it doesn't seem like a priority right now, and it may be out of scope for the about:permissions page.
No longer blocks: 573176
Whiteboard: [necko-would-take]
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: