Bug 206077
| Summary: | MemoryPressureHandler should handle more than one callback | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ben Nham <nham> |
| Component: | Web Template Framework | Assignee: | Ben Nham <nham> |
| Status: | NEW | ||
| Severity: | Normal | CC: | cdumez, nham, timothy, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Ben Nham
Currently MemoryPressureHandler only stores a single callback lambda. This causes issues with the common pattern of setting the lambda for the singleton MemoryPressureHandler.
For instance, all of these callsites do the equivalent of MemoryPressureHandler::singleton().setLowMemoryHandler in the UI process:
1. Legacy WebView init in WebInstallMemoryPressureHandler
2. WebProcessPool init in WebProcessPool::platformInitialize
3. +[NSAttributedString retrieveOrCreateWebview] used by all of the +[NSAttributedString loadFromHTMLWith...] APIs
So for instance, if your app creates a WKWebView, and then calls +[NSAttributedString loadFromHTMLWithRequest:options:completionHandler:], then the WebProcessPool low memory handler installed by WKWebView gets overwritten by the NSAttributedString low memory handler, which seems undesirable.
There's a FIXME about this in WebProcessPool, so we should probably make it harder to trample on an existing memory pressure handler, or just allow multiple callbacks to be attached to a single memory pressure handler.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/58484110>