Bug 127390 - WebKit2 View Gestures (Swipe): Snapshots should be purgeable
Summary: WebKit2 View Gestures (Swipe): Snapshots should be purgeable
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
Keywords: InRadar
: 127389 (view as bug list)
Depends on:
Reported: 2014-01-21 18:10 PST by Tim Horton
Modified: 2014-01-28 11:31 PST (History)
4 users (show)

See Also:

patch take 1 (13.23 KB, patch)
2014-01-28 03:42 PST, Tim Horton
no flags Details | Formatted Diff | Diff
patch (14.74 KB, patch)
2014-01-28 11:03 PST, Tim Horton
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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. ***