Bug 138155 - [iOS] WebProcess needs to take a background task assertion to prevent being killed for "suspended with locked system files"
Summary: [iOS] WebProcess needs to take a background task assertion to prevent being k...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad iOS 8.1
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-10-28 16:02 PDT by Daniel Bates
Modified: 2014-11-06 08:40 PST (History)
8 users (show)

See Also:


Attachments
Patch (17.19 KB, patch)
2014-10-28 16:05 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2014-10-28 16:02:38 PDT
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).
Comment 1 Daniel Bates 2014-10-28 16:03:22 PDT
<rdar://problem/17939303>
Comment 2 Daniel Bates 2014-10-28 16:05:50 PDT
Created attachment 240575 [details]
Patch
Comment 3 Daniel Bates 2014-10-28 16:23:20 PDT
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 4 Daniel Bates 2014-11-06 08:40:22 PST
Comment on attachment 240575 [details]
Patch

Clearing flags on attachment: 240575

Committed r175698: <http://trac.webkit.org/changeset/175698>
Comment 5 Daniel Bates 2014-11-06 08:40:26 PST
All reviewed patches have been landed.  Closing bug.