Closed Bug 1401850 Opened 7 years ago Closed 7 years ago

Implement nsIQuotaManagerService::clearContentData

Categories

(Core :: Storage: Quota Manager, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: baku, Assigned: baku)

References

Details

Attachments

(1 file, 1 obsolete file)

This is needed for bug 1401542, bug 1047098 and bug 1333050.
Blocks: 1333050
Attachment #8910603 - Flags: review?(jvarga)
Blocks: 1047098
FinalizeOnOwningThreadReady must be called also when mOriginList is empty. Note that I don't want to touch mOriginList in FinalizeRequired(). In case there is nothing to remove, I think it's better to do an extra couple of Dispatch().
Attachment #8910603 - Attachment is obsolete: true
Attachment #8910603 - Flags: review?(jvarga)
Attachment #8910649 - Flags: review?(jvarga)
Ok, this looks better, reviewing ...
Blocks: 1401900
During review I've got an idea how do implement this without touching C++ code which is already quite complex. In the meantime a new method has been implemented nsIQuotaManagerService::GetUsage, this method returns an array with information about all origins that have stored data. The array can be just filtered for http/https/file schemes and call clearStoragesForPrincipal for individual origins. That's it. baku, could you try this ? Sorry, that I didn't figure out this sooner.
What you are saying doesn't work because of the exclusive lock. This is exactly what I was proposing initially exposing Clear(). See your comment here: https://bugzilla.mozilla.org/show_bug.cgi?id=1333050#c44
Flags: needinfo?(jvarga)
Basically, if your comment there is right, any use of clearStoragesForPrincipal() in our codebase is wrong. Except for testing, of course.
But clear() covers everything and clearStoragesForPrincipal() covers just one origin. clear() needs to get exclusive lock for everything which means all existing operations are aborted (not just ones for http/https/file). When you call getUsage() it gets a shared lock for everything, so nothing is aborted. Then individual clearStoragesForPrincipal() calls will request an exclusive lock for just one particular origin and abort operations only for that one origin. It's like an exclusive lock for entire SQL table or a lock for just one row in a table. Let me know if it's still not clear.
Flags: needinfo?(jvarga)
So, what's the difference between what you are proposing and my first approach here: https://bugzilla.mozilla.org/show_bug.cgi?id=1333050#c44 ?
Flags: needinfo?(jvarga)
Your first approach creates a new class ClearContentOp. Itts ctor calls: QuotaRequestBase(/* aExclusive */ true) which then calls: NormalOriginOperationBase(Nullable<PersistenceType>(), OriginScope::FromNull(), aExclusive) these 3 arguments will be used when a lock for the operation is requested. Nullable<PersistenceType>() means all persistence types OriginScope::FromNull() means all origins aExclusive is true So, it's an exclusive lock for everything and aborts operations for all origins. I'm proposing to use getUsage() which doesn't have clear anything and just collect all origins that have stored data. For that a shared lock is enough.
Flags: needinfo?(jvarga)
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
Attachment #8910649 - Flags: review?(jvarga)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: