Closed
Bug 767320
Opened 12 years ago
Closed 12 years ago
Addon.hasResource() should cache results to try avoid unnecessary IO in the future
Categories
(Toolkit :: Add-ons Manager, defect)
Toolkit
Add-ons Manager
Tracking
()
RESOLVED
FIXED
mozilla17
People
(Reporter: Unfocused, Assigned: darktrojan)
Details
Attachments
(1 file, 1 obsolete file)
4.42 KB,
patch
|
Unfocused
:
review+
|
Details | Diff | Splinter Review |
Addon.hasResource() does a fstat (or looks up the zip entry) to see if a file exists every time it's called. However, that result shouldn't change (we actively discourage addons from modifying themselves, as that can change the file modification time on their directory on some OSes). As such, we can potentially avoid some IO by caching the results.
Assignee | ||
Comment 1•12 years ago
|
||
Reporter | ||
Comment 2•12 years ago
|
||
Comment on attachment 641806 [details] [diff] [review]
v1
Review of attachment 641806 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/mozapps/extensions/XPIProvider.jsm
@@ +3843,5 @@
> if (aAddon._installLocation.locked)
> throw new Error("Cannot uninstall addons from locked install locations");
>
> + if ("_hasResourceCache" in aAddon)
> + aAddon._hasResourceCache = new Dict();
Would like to use start using Map, instead of Dict.jsm (all the functions are exactly the same anyway).
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Map
(Ignore the scary warning - the only thing not done yet is iterating over Maps, which we don't need here.)
Attachment #641806 -
Flags: review?(bmcbride) → review-
Assignee | ||
Comment 3•12 years ago
|
||
Attachment #641806 -
Attachment is obsolete: true
Attachment #642212 -
Flags: review?(bmcbride)
Reporter | ||
Comment 4•12 years ago
|
||
Comment on attachment 642212 [details] [diff] [review]
v2
Review of attachment 642212 [details] [diff] [review]:
-----------------------------------------------------------------
\o/
Attachment #642212 -
Flags: review?(bmcbride) → review+
Assignee | ||
Comment 5•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/abe7818a3f52
(https://tbpl.mozilla.org/?tree=Try&rev=549a42fd271e)
Flags: in-testsuite+
Flags: in-moztrap-
Flags: in-litmus-
Comment 6•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in
before you can comment on or make changes to this bug.
Description
•