Towards mitigating the web content process being killed when suspended holding lock files, we should have the web content process notify the UI process when it is holding such files so that the UI process can acquire a background task assertion to allow both to continue to run for an extended period of time in the background. In particular, we want to take a background task assertion when performing a SQLite transaction(s).
Created attachment 240575 [details]
I open to suggestions on this patch.
The class WebSQLiteDatabaseTracker (included in the patch) isn't specific to iOS and hence can be used by other ports. At the time of writing, the iOS port is the only port that implements a non-trivial ProcessAssertion class to acquire a background task assertion. I guarded the instantiation of this class with PLATFORM(IOS) though I placed the class files in Source/WebKit2/WebProcess/WebCoreSupport/ (should I move them to an iOS-specific directory?) because I was unclear if it was acceptable to instantiate for all ports a WebSQLiteDatabaseTracker, which would send messages to the UIProcess (*), given that iOS is the only port that makes use of such messages. I was also unclear if we should either add a new compile-time guard for this feature to avoid the instantiation on non-iOS ports, say ENABLE_SQL_DATABASE_TRACKER, or if it's acceptable to instantiate WebSQLiteDatabaseTracker for all ports and have it only enabled for iOS (say, by not calling SQLDatabaseTracker::setClient() on non-iOS ports). Let me know if there is a preferred way to expose this functionality.
(*) I didn't measure the performance implications of such messaging.
Comment on attachment 240575 [details]
Clearing flags on attachment: 240575
Committed r175698: <http://trac.webkit.org/changeset/175698>
All reviewed patches have been landed. Closing bug.