Bug 127390

Summary: WebKit2 View Gestures (Swipe): Snapshots should be purgeable
Product: WebKit Reporter: Tim Horton <thorton>
Component: WebKit2Assignee: Tim Horton <thorton>
Severity: Normal CC: andersca, sam, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Description Flags
patch take 1
patch andersca: review+

Description Tim Horton 2014-01-21 18:10:00 PST
In the interests of allowing the operating system to clean up snapshots when the system is under memory pressure, they should be made purgeable. We could even assign purgeability priority outwards from the current back-forward item to help further-away snapshots get thrown away first.
Comment 1 Radar WebKit Bug Importer 2014-01-21 18:10:31 PST
Comment 2 Tim Horton 2014-01-28 03:42:22 PST
Created attachment 222427 [details]
patch take 1

Not sure if scanning the b-f list is too expensive. I'm sure there's a faster way...
Not sure if we actually want to wait, with a white snapshot view, if the image has been purged/evicted; maybe we should just switch immediately in that case.
I would kind of like ViewSnapshotStore to own the purgeability story, but I'm not totally sure how to make that work yet.
Would love it if someone had an easy way to make CGImage purgeable, but I don't see anything.
Comment 3 Tim Horton 2014-01-28 11:03:41 PST
Created attachment 222467 [details]
Comment 4 Anders Carlsson 2014-01-28 11:12:09 PST
Comment on attachment 222467 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=222467&action=review

> Source/WebKit2/UIProcess/mac/ViewGestureController.mm:51
> +static const uint32_t WebKitIOSurfacePurgeableNonVolatile = 0;
> +static const uint32_t WebKitIOSurfacePurgeableVolatile = 1;
> +static const uint32_t WebKitIOSurfacePurgeableEmpty = 2;

I think you should use a real enum here with real IOSurface names.

> Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm:46
> +static const uint32_t WebKitIOSurfacePurgeableVolatile = 1;

Real enum.
Comment 5 Tim Horton 2014-01-28 11:29:32 PST
Comment 6 Tim Horton 2014-01-28 11:31:22 PST
*** Bug 127389 has been marked as a duplicate of this bug. ***