Closed
Bug 806374
Opened 12 years ago
Closed 11 years ago
Don't store phone's wallpaper or the dialer ringtone or the notification ringtone as a data: URI in the settings DB
Categories
(Firefox OS Graveyard :: Gaia::Settings, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: justin.lebar+bug, Assigned: fabrice)
References
Details
(Keywords: perf, Whiteboard: [MemShrink:P2][c=performance])
Attachments
(2 files, 6 obsolete files)
8.63 KB,
patch
|
gwagner
:
review+
|
Details | Diff | Splinter Review |
220 bytes,
text/html
|
Details |
Filed based on bug 802446 comment 16. I don't know how much memory we're wasting here, but it seems like we may not want to store the phone's wallpaper as a data: URI in the settings DB because * data: URIs are 2.7x larger than blobs * all access to the settings DB is proxied through the main process (apparently?), so the main process uses memory (at least temporarily) to support this image. Can we so something smarter here?
Assignee | ||
Comment 1•12 years ago
|
||
Since the wallpaper is managed by the system app, we can probably just move the image file into the system app resources and reference it.
Reporter | ||
Comment 2•12 years ago
|
||
(In reply to Fabrice Desré [:fabrice] from comment #1) > Since the wallpaper is managed by the system app, we can probably just move > the image file into the system app resources and reference it. The homescreen app is the one which actually displays the wallpaper, right? Under that scheme, how would we transfer the wallpaper from the system app to the homescreen app?
Assignee | ||
Comment 3•12 years ago
|
||
No, the system app displays the wallpaper afaict. Just try by killing the homescreen ;)
Updated•12 years ago
|
Whiteboard: [MemShrink] → [MemShrink:P2]
Comment 4•12 years ago
|
||
(In reply to Fabrice Desré [:fabrice] from comment #3) > No, the system app displays the wallpaper afaict. Just try by killing the > homescreen ;) You are right, but the image files must be shared between: system app/settings app/wallpaper app. And what you said in comment 2 is what system app had done early before.
Comment 5•12 years ago
|
||
Sorry is comment 1. (In reply to Fabrice Desré [:fabrice] from comment #1) > Since the wallpaper is managed by the system app, we can probably just move > the image file into the system app resources and reference it. If we do so, we couldn't set a photo captured by the camera but only the static images in the system app.
Comment 6•11 years ago
|
||
Data URIs are also being used to store ringtones in settings. Beyond the single copy stored directly, you can end up with additional copies of these giant strings getting copied around. For instance, in this B2G log I have, it looks like we have 4 copies of the wallpaper floating around, one inside the CSP cache...
Component: Gaia → Gaia::Settings
Summary: Don't store phone's wallpaper as a data: URI in the settings DB → Don't store phone's wallpaper or the dialer ringtone or the notification ringtone as a data: URI in the settings DB
Assignee | ||
Comment 7•11 years ago
|
||
This patch converts all data: uris that are using when calling set() to blobs. This means that when doing a get() of the setting, we need to check if its a blob and get the blob uri.
Assignee: nobody → fabrice
Attachment #781058 -
Flags: feedback?(anygregor)
Assignee | ||
Comment 8•11 years ago
|
||
The gaia side of the conversion. I still have to do the ringtones, but this patch should take care of all the wallpaper use.
Attachment #781059 -
Flags: review?
Assignee | ||
Comment 9•11 years ago
|
||
Hopefully with the notification and dialer ringtones also fixed.
Attachment #781059 -
Attachment is obsolete: true
Attachment #781059 -
Flags: review?
Reporter | ||
Comment 10•11 years ago
|
||
Surely you need to revoke this object URL at some point?
Assignee | ||
Comment 11•11 years ago
|
||
(In reply to Justin Lebar [:jlebar] from comment #10) > Surely you need to revoke this object URL at some point? Ideally yes (if not they are cleared when the document disappears), but I don't know how to do that for css background images.
Reporter | ||
Comment 12•11 years ago
|
||
Otherwise every time you change the background, we'll leak the old blob permanently, in the main process, right?
Assignee | ||
Comment 13•11 years ago
|
||
Now trying to revoke URL.
Attachment #781082 -
Attachment is obsolete: true
Assignee | ||
Comment 14•11 years ago
|
||
Update of the previous patch to convert data: uris in all object properties, and to also do it in the SettingsService.
Attachment #781058 -
Attachment is obsolete: true
Attachment #781058 -
Flags: feedback?(anygregor)
Attachment #782372 -
Flags: review?(anygregor)
Assignee | ||
Comment 15•11 years ago
|
||
This patch let us use either urls or blobs for the wallpaper and ringtones settings. I also changed the wallpaper saving in the settings app to not do a blob -> data uri anymore. Tim & Vivien, feel free to redirect the review. I just don't know who to ask.
Attachment #781328 -
Attachment is obsolete: true
Attachment #782374 -
Flags: review?(timdream)
Attachment #782374 -
Flags: review?(21)
Comment 16•11 years ago
|
||
Comment on attachment 782372 [details] [diff] [review] gecko patch v2 Review of attachment 782372 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me. The only thing missing is a testcase :) ::: dom/settings/SettingsDB.jsm @@ +166,5 @@ > + let start = aValue.indexOf(",") + 1; > + let isBase64 = ((aValue.indexOf("base64") + 7) == start); > + let payload = aValue.substring(start); > + > + return new Blob([isBase64 ?base64DecToArr(payload) : payload], nit: space after ? @@ +175,5 @@ > + } > + return aValue > + }, > + > + // Makes sure any propery that is a data: uri gets converted to a Blob. nit: property @@ +189,5 @@ > + return aObject > + } else if (kind == "blob") { > + return aObject > + } else if (kind == "date") { > + return aObject maybe combine file, blob, date and add ';' after aObject @@ +194,5 @@ > + } else if (kind == "primitive") { > + return this.convertDataURIToBlob(aObject); > + } > + > + // Fall-through, we now have a dictionnary object. nit: dictionary
Attachment #782372 -
Flags: review?(anygregor) → review+
Assignee | ||
Comment 17•11 years ago
|
||
Try build with nits addressed and a test added (based on the blobs tests, but storing a data: uri instead of a blob) : https://tbpl.mozilla.org/?tree=Try&rev=77de3bb69ddd
Comment 18•11 years ago
|
||
Comment on attachment 782374 [details] [diff] [review] gaia patch v4 Review of attachment 782374 [details] [diff] [review]: ----------------------------------------------------------------- To be honest I'm a bit concerned about memory leaks. Also the code seems really similar in so many places. What about a little shared/js/ file to centralize that?
Assignee | ||
Comment 19•11 years ago
|
||
Everything looks fine in my testing. We'll need to land that before the gecko patch as it supports both blobs and plain text uris.
Attachment #782374 -
Attachment is obsolete: true
Attachment #782374 -
Flags: review?(timdream)
Attachment #782374 -
Flags: review?(21)
Attachment #783536 -
Flags: review?(21)
Comment 20•11 years ago
|
||
Comment on attachment 783536 [details] [diff] [review] gaia patch v5 Review of attachment 783536 [details] [diff] [review]: ----------------------------------------------------------------- Thanks.
Attachment #783536 -
Flags: review?(21) → review+
Assignee | ||
Comment 21•11 years ago
|
||
https://github.com/mozilla-b2g/gaia/commit/996244ec35d2d151a1ae5ac4e17ea0ffcdde8aa0 Keeping the bug open until I push the gecko part.
Comment 22•11 years ago
|
||
backed out of gaia for now: https://github.com/mozilla-b2g/gaia/commit/8ae9100dd47e13a655423191cb3b3e5a02c5388a I don't have any context here but this was breaking the travis build somehow.
Comment 23•11 years ago
|
||
https://github.com/mozilla-b2g/gaia/pull/11431/files#r5667602 Additionally, the SettingsURL constructor needs unit tests before it can be used in the Messages app.
Comment 24•11 years ago
|
||
Looks like I am taking over and getting this landed. Rick - I'll try to address your concerns before we land. Thanks.
Assignee: fabrice → kgrandon
Status: NEW → ASSIGNED
Keywords: perf
Whiteboard: [MemShrink:P2] → [MemShrink:P2][c=performance]
Comment 25•11 years ago
|
||
Gaia part has landed in master: https://github.com/mozilla-b2g/gaia/commit/845abbb2ae4802c1fe50a50336dac922536a329d
Assignee: kgrandon → fabrice
Comment 26•11 years ago
|
||
The landed patch had a few minor differences than v5. Obsoleting the old patch in case someone needs this.
Attachment #783536 -
Attachment is obsolete: true
Comment 27•11 years ago
|
||
please see https://github.com/mozilla-b2g/gaia/commit/90245e0e244063545b83f6b1f21279a04bb077d4#commitcomment-3828736 as I added some recommendation to do the SettingsURL abstraction right. Thanks !
Comment 28•11 years ago
|
||
Fabrice - Would you have any comment on Julien's comment above?
Flags: needinfo?(fabrice)
Comment 30•11 years ago
|
||
Filed bug 903760 for further work.
Assignee | ||
Comment 31•11 years ago
|
||
https://hg.mozilla.org/integration/b2g-inbound/rev/c521aae575b5
Comment 32•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/c521aae575b5
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•