12015-05-06 Daniel Bates <dabates@apple.com>
2
3 [iOS][WK2] Pause/resume database thread when UIProcess enters/leaves the background
4 https://bugs.webkit.org/show_bug.cgi?id=144657
5 <rdar://problem/18894598>
6
7 Reviewed by NOBODY (OOPS!).
8
9 Pause and resume the database thread when the UIProcess enters and leaves the background,
10 respectively, so that we avoid WebProcess termination due to holding a locked SQLite
11 database file when the WebProcess is suspended. This behavior matches the analagous
12 behavior in Legacy WebKit.
13
14 * UIProcess/WebPageProxy.h:
15 * UIProcess/ios/WKContentView.mm:
16 (-[WKContentView _applicationDidEnterBackground:]): Call WebPageProxy::applicationDidEnterBackground()
17 when the UIProcess enters the background.
18 * UIProcess/ios/WebPageProxyIOS.mm:
19 (WebKit::WebPageProxy::applicationDidEnterBackground): Added; notify the WebProcess to pause the database thread.
20 We temporarily take out background assertion on the WebProcess before sending this notification to ensure that the
21 WebProcess is running to receive it. We'll release this assertion when the WebProcess replies that it received the
22 notification.
23 * WebProcess/WebCoreSupport/WebDatabaseManager.cpp:
24 (WebKit::WebDatabaseManager::setPauseAllDatabases): Added; turns around and calls DatabaseManager::setPauseAllDatabases().
25 * WebProcess/WebCoreSupport/WebDatabaseManager.h:
26 * WebProcess/WebPage/WebPage.h:
27 * WebProcess/WebPage/WebPage.messages.in: Add message ApplicationDidEnterBackground(). Also,
28 add empty lines to help demarcate this message and the other UIKit application lifecycle-related
29 messages from the rest of the list of messages.
30 * WebProcess/WebPage/ios/WebPageIOS.mm:
31 (WebKit::WebPage::applicationWillEnterForeground): Resume the database thread.
32 (WebKit::WebPage::applicationDidEnterBackground): Pause the database thread.
33