RESOLVED FIXED 115131
REGRESSION (r146544): Once a custom font is cached to disk, it starts failing to render until the page is refreshed.
https://bugs.webkit.org/show_bug.cgi?id=115131
Summary REGRESSION (r146544): Once a custom font is cached to disk, it starts failing...
Brady Eidson
Reported 2013-04-24 15:09:56 PDT
REGRESSION (r146544): Once a custom font is cached to disk, it starts failing to render until the page is refreshed. One example of a WebFont user in the wild is http://www.okemo.com/activities/snowsports/ticketing/deals/onlinedeals.asp We can't do the CachedResource::tryReplaceEncodedData trick for CachedFonts on CG platforms because the CGFont object is directly reliant on the original encoded data from the original SharedBuffer. This patch will introduce the concept of a CachedResource saying it doesn't support being swapped out. In radar as <rdar://problem/13622998>
Attachments
Patch v1 - Don't replace encoded data for a CachedFont that has ever created a FontCustomPlatformData object (4.32 KB, patch)
2013-04-24 15:15 PDT, Brady Eidson
ap: review+
Brady Eidson
Comment 1 2013-04-24 15:15:31 PDT
Created attachment 199521 [details] Patch v1 - Don't replace encoded data for a CachedFont that has ever created a FontCustomPlatformData object
Alexey Proskuryakov
Comment 2 2013-04-24 15:25:04 PDT
Comment on attachment 199521 [details] Patch v1 - Don't replace encoded data for a CachedFont that has ever created a FontCustomPlatformData object View in context: https://bugs.webkit.org/attachment.cgi?id=199521&action=review > Source/WebCore/loader/cache/CachedFont.h:67 > + virtual bool shouldTryReplaceEncodedData() const; I think that it's a "may", not "should". > Source/WebCore/loader/cache/CachedResource.h:299 > virtual PurgePriority purgePriority() const { return PurgeDefault; } > + virtual bool shouldTryReplaceEncodedData() const { return true; } OVERRIDE
Brady Eidson
Comment 3 2013-04-24 15:25:58 PDT
(In reply to comment #2) > (From update of attachment 199521 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=199521&action=review > > > Source/WebCore/loader/cache/CachedFont.h:67 > > + virtual bool shouldTryReplaceEncodedData() const; > > I think that it's a "may", not "should". Fair enough. > > > Source/WebCore/loader/cache/CachedResource.h:299 > > virtual PurgePriority purgePriority() const { return PurgeDefault; } > > + virtual bool shouldTryReplaceEncodedData() const { return true; } > > OVERRIDE Duh. Thanks!
Brady Eidson
Comment 4 2013-04-24 15:34:49 PDT
mitz
Comment 5 2013-04-24 15:43:36 PDT
Comment on attachment 199521 [details] Patch v1 - Don't replace encoded data for a CachedFont that has ever created a FontCustomPlatformData object View in context: https://bugs.webkit.org/attachment.cgi?id=199521&action=review >>> Source/WebCore/loader/cache/CachedResource.h:299 >>> + virtual bool shouldTryReplaceEncodedData() const { return true; } >> >> OVERRIDE > > Duh. > > Thanks! I’m surprised that the default is true!
Brady Eidson
Comment 6 2013-04-24 16:00:41 PDT
(In reply to comment #5) > (From update of attachment 199521 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=199521&action=review > > >>> Source/WebCore/loader/cache/CachedResource.h:299 > >>> + virtual bool shouldTryReplaceEncodedData() const { return true; } > >> > >> OVERRIDE > > > > Duh. > > > > Thanks! > > I’m surprised that the default is true! Why? Only certain CachedFonts are known to misbehave with the replacement. All other CachedResources still get it.
mitz
Comment 7 2013-04-24 16:06:01 PDT
(In reply to comment #6) > (In reply to comment #5) > > (From update of attachment 199521 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=199521&action=review > > > > >>> Source/WebCore/loader/cache/CachedResource.h:299 > > >>> + virtual bool shouldTryReplaceEncodedData() const { return true; } > > >> > > >> OVERRIDE > > > > > > Duh. > > > > > > Thanks! > > > > I’m surprised that the default is true! > > Why? Only certain CachedFonts are known to misbehave with the replacement. All other CachedResources still get it. Because if you’re writing a new CachedResource derived class, you should inherit safe behavior by default, and make a conscious choice to opt into unsafe behavior if you know that you can handle it.
Brady Eidson
Comment 8 2013-04-24 16:08:42 PDT
(In reply to comment #7) > (In reply to comment #6) > > (In reply to comment #5) > > > (From update of attachment 199521 [details] [details] [details]) > > > View in context: https://bugs.webkit.org/attachment.cgi?id=199521&action=review > > > > > > >>> Source/WebCore/loader/cache/CachedResource.h:299 > > > >>> + virtual bool shouldTryReplaceEncodedData() const { return true; } > > > >> > > > > > > I’m surprised that the default is true! > > > > Why? Only certain CachedFonts are known to misbehave with the replacement. All other CachedResources still get it. > > Because if you’re writing a new CachedResource derived class, you should inherit safe behavior by default, and make a conscious choice to opt into unsafe behavior if you know that you can handle it. Oh, you and your good points. :P
Brady Eidson
Comment 9 2013-04-24 16:10:53 PDT
But on that note, I think it should probably be pure virtual so you're forced to consider it.
Alexey Proskuryakov
Comment 10 2013-04-24 16:31:22 PDT
I would note that "safe" behavior is the one that doesn't kill performance. From this point of view, the current default is actually safe.
mitz
Comment 11 2013-04-24 16:56:33 PDT
(In reply to comment #10) > I would note that "safe" behavior is the one that doesn't kill performance. From this point of view, the current default is actually safe. When I used the word “safe”, I didn’t mean “doesn’t kill performance”. Maybe there’s another word for “doesn’t kill performance”, or maybe there should be, but the word “safe” already means something different, as in the sentence “when shouldTryReplaceEncodedData() returns false, it is not safe to hang on to the pointer to the encoded data beyond the end of the current iteration of the run loop”.
mitz
Comment 12 2013-04-24 16:58:56 PDT
(In reply to comment #11) > (In reply to comment #10) > > I would note that "safe" behavior is the one that doesn't kill performance. From this point of view, the current default is actually safe. > > When I used the word “safe”, I didn’t mean “doesn’t kill performance”. Maybe there’s another word for “doesn’t kill performance”, or maybe there should be, but the word “safe” already means something different, as in the sentence “when shouldTryReplaceEncodedData() returns false, it is not safe to hang on to the pointer to the encoded data beyond the end of the current iteration of the run loop”. s/false/true/ :-\
Brady Eidson
Comment 13 2013-04-24 17:12:27 PDT
This whole mechanism is a memory optimization for process-per-tab mode. Not doing it does not "kill performance", and *all* resources will still get the file backed memory on the next load after it was cached.
Note You need to log in before you can comment on or make changes to this bug.