The caches for per-font/word shaped glyph data (introduced in bug 703100, replacing gfxTextRunWordCache) should observe the memory-pressure notification and discard cached words when memory is low. This would have been difficult to do in the old gfxTextRunWordCache world, because of the complex ownership and referencing of the glyph data, but with the per-gfxFont shaped-word caches, it should be simple. This will then allow us to keep shaped-word data in the cache longer for potential re-use, knowing that it will be evicted if necessary.
I love this idea. Do you plan on having this land together with the cache changes, or after?
No reason we shouldn't land it at the same time, I think - I'll post a patch shortly. It's pretty trivial to implement in the new model.
Created attachment 580010 [details] [diff] [review] observe memory-pressure notification and discard cached gfxShapedWord records.
Backed out of inbound for crashes: https://tbpl.mozilla.org/?tree=Mozilla-Inbound&rev=f94f83c7f2df https://hg.mozilla.org/integration/mozilla-inbound/rev/76fc8cdd2a31
Created attachment 588347 [details] [diff] [review] patch, v2 - observe memory-pressure notification and discard cached gfxShapedWord records Well, that lit up the tree like it's still Christmas. This patch passes try without complaint :) .... marking for re-review as it's somewhat restructured from the previous version.