Source/WebCore/ChangeLog

 12015-05-05 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
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Export WebCore functionality to pause and resume the database thread so that we can
 9 make use of this functionality from WebKit2.
 10
 11 * Modules/webdatabase/AbstractDatabaseServer.h:
 12 * Modules/webdatabase/DatabaseManager.cpp:
 13 (WebCore::DatabaseManager::setPauseAllDatabases): Added; turns around and calls DatabaseServer::setPauseAllDatabases().
 14 * Modules/webdatabase/DatabaseManager.h:
 15 * Modules/webdatabase/DatabaseServer.cpp:
 16 (WebCore::DatabaseServer::setPauseAllDatabases): Added; turns around and calls
 17 DatabaseTracker::tracker().setDatabasesPaused() to pause or resume the database thread.
 18 For now, we guard this call with PLATFORM(IOS). We'll look to remove this guard once
 19 we fix <https://bugs.webkit.org/show_bug.cgi?id=144660>.
 20 * Modules/webdatabase/DatabaseServer.h:
 21
1222015-05-04 Javier Fernandez <jfernandez@igalia.com>
223
324 [CSS Box Alignment] Upgrade justify-content parsing to CSS3 Box Alignment spec.

Source/WebKit2/ChangeLog

 12015-05-05 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
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Pause and resume the database thread when the UIProcess enters and leaves the background,
 9 respectively, so that we avoid WebProcess termination due to holding a locked SQLite
 10 database file when the WebProcess is suspended. This behavior matches the analagous
 11 behavior in Legacy WebKit.
 12
 13 * UIProcess/WebPageProxy.h:
 14 * UIProcess/ios/WKContentView.mm:
 15 (-[WKContentView _applicationDidEnterBackground:]): Call WebPageProxy::applicationDidEnterBackground()
 16 when the UIProcess enters the background.
 17 * UIProcess/ios/WebPageProxyIOS.mm:
 18 (WebKit::WebPageProxy::applicationDidEnterBackground): Added; pause the database thread.
 19 * WebProcess/WebCoreSupport/WebDatabaseManager.cpp:
 20 (WebKit::WebDatabaseManager::setPauseAllDatabases): Added; turns around and calls DatabaseManager::setPauseAllDatabases().
 21 * WebProcess/WebCoreSupport/WebDatabaseManager.h:
 22 * WebProcess/WebPage/WebPage.h:
 23 * WebProcess/WebPage/WebPage.messages.in: Add message ApplicationDidEnterBackground(). Also,
 24 add empty lines to help demarcate this message and the other UIKit application lifecycle-related
 25 messages from the rest of the list of messages.
 26 * WebProcess/WebPage/ios/WebPageIOS.mm:
 27 (WebKit::WebPage::applicationWillEnterForeground): Resume the database thread.
 28 (WebKit::WebPage::applicationDidEnterBackground): Pause the database thread.
 29
1302015-05-04 Zan Dobersek <zdobersek@igalia.com>
231
332 [WTF] Remove Functional.h inclusions

Source/WebCore/Modules/webdatabase/AbstractDatabaseServer.h

@@public:
7171 virtual bool deleteOrigin(SecurityOrigin*) = 0;
7272 virtual bool deleteDatabase(SecurityOrigin*, const String& name) = 0;
7373
 74 virtual void setPauseAllDatabases(bool) = 0;
 75
7476 virtual void interruptAllDatabasesForContext(const DatabaseContext*) = 0;
7577
7678protected:

Source/WebCore/Modules/webdatabase/DatabaseManager.cpp

@@bool DatabaseManager::deleteDatabase(SecurityOrigin* origin, const String& name)
397397 return m_server->deleteDatabase(origin, name);
398398}
399399
 400void DatabaseManager::setPauseAllDatabases(bool pauseAllDatabases)
 401{
 402 m_server->setPauseAllDatabases(pauseAllDatabases);
 403}
 404
400405void DatabaseManager::interruptAllDatabasesForContext(ScriptExecutionContext* context)
401406{
402407 RefPtr<DatabaseContext> databaseContext = existingDatabaseContextFor(context);

Source/WebCore/Modules/webdatabase/DatabaseManager.h

@@public:
103103 WEBCORE_EXPORT bool deleteOrigin(SecurityOrigin*);
104104 WEBCORE_EXPORT bool deleteDatabase(SecurityOrigin*, const String& name);
105105
 106 WEBCORE_EXPORT void setPauseAllDatabases(bool);
 107
106108 void interruptAllDatabasesForContext(ScriptExecutionContext*);
107109
108110private:

Source/WebCore/Modules/webdatabase/DatabaseServer.cpp

@@bool DatabaseServer::deleteDatabase(SecurityOrigin* origin, const String& name)
108108 return DatabaseTracker::tracker().deleteDatabase(origin, name);
109109}
110110
 111void DatabaseServer::setPauseAllDatabases(bool pauseAllDatabases)
 112{
 113#if PLATFORM(IOS)
 114 DatabaseTracker::tracker().setDatabasesPaused(pauseAllDatabases);
 115#else
 116 UNUSED_PARAM(pauseAllDatabases);
 117#endif
 118}
 119
111120void DatabaseServer::interruptAllDatabasesForContext(const DatabaseContext* context)
112121{
113122 DatabaseTracker::tracker().interruptAllDatabasesForContext(context);

Source/WebCore/Modules/webdatabase/DatabaseServer.h

@@public:
6060 virtual bool deleteOrigin(SecurityOrigin*);
6161 virtual bool deleteDatabase(SecurityOrigin*, const String& name);
6262
 63 virtual void setPauseAllDatabases(bool) override;
 64
6365 virtual void interruptAllDatabasesForContext(const DatabaseContext*);
6466
6567protected:

Source/WebKit2/UIProcess/WebPageProxy.h

@@public:
493493 void setAssistedNodeValue(const String&);
494494 void setAssistedNodeValueAsNumber(double);
495495 void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection = false);
 496
496497 void applicationWillEnterForeground();
 498 void applicationDidEnterBackground();
497499 void applicationWillResignActive();
498500 void applicationDidBecomeActive();
 501
499502 void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale);
500503 void commitPotentialTapFailed();
501504 void didNotHandleTapAsClick(const WebCore::IntPoint&);

Source/WebKit2/UIProcess/ios/WKContentView.mm

@@- (void)_applicationWillResignActive:(NSNotification*)notification
551551- (void)_applicationDidEnterBackground:(NSNotification*)notification
552552{
553553 _isBackground = YES;
 554 _page->applicationDidEnterBackground();
554555 _page->viewStateDidChange(ViewState::AllFlags & ~ViewState::IsInWindow);
555556}
556557

Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm

@@void WebPageProxy::applicationWillEnterForeground()
598598 m_process->send(Messages::WebPage::ApplicationWillEnterForeground(), m_pageID);
599599}
600600
 601void WebPageProxy::applicationDidEnterBackground()
 602{
 603 m_process->send(Messages::WebPage::ApplicationDidEnterBackground(), m_pageID);
 604}
 605
601606void WebPageProxy::applicationWillResignActive()
602607{
603608 m_process->send(Messages::WebPage::ApplicationWillResignActive(), m_pageID);

Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp

@@void WebDatabaseManager::deleteAllDatabases() const
137137 DatabaseManager::singleton().deleteAllDatabases();
138138}
139139
 140void WebDatabaseManager::setPauseAllDatabases(bool pauseAllDatabases)
 141{
 142 DatabaseManager::singleton().setPauseAllDatabases(pauseAllDatabases);
 143}
 144
140145void WebDatabaseManager::setQuotaForOrigin(const String& originIdentifier, unsigned long long quota) const
141146{
142147 // If the quota is set to a value lower than the current usage, that quota will

Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h

@@public:
4646 void setQuotaForOrigin(const String& originIdentifier, unsigned long long quota) const;
4747 void deleteAllDatabases() const;
4848
 49 void setPauseAllDatabases(bool = true);
 50
4951private:
5052 // WebProcessSupplement
5153 virtual void initialize(const WebProcessCreationParameters&) override;

Source/WebKit2/WebProcess/WebPage/WebPage.h

@@public:
783783 void updateVisibleContentRects(const VisibleContentRectUpdateInfo&, double oldestTimestamp);
784784 bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
785785 void willStartUserTriggeredZooming();
 786
786787 void applicationWillResignActive();
787788 void applicationWillEnterForeground();
 789 void applicationDidEnterBackground();
788790 void applicationDidBecomeActive();
 791
789792 void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale);
790793 void completePendingSyntheticClickForContentChangeObserver();
791794#endif

Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

@@messages -> WebPage LegacyReceiver {
8787 SetAssistedNodeValue(String value)
8888 SetAssistedNodeValueAsNumber(double value)
8989 SetAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection)
 90
9091 ApplicationWillResignActive()
9192 ApplicationWillEnterForeground()
 93 ApplicationDidEnterBackground()
9294 ApplicationDidBecomeActive()
 95
9396 ContentSizeCategoryDidChange(String contentSizeCategory)
9497 ExecuteEditCommandWithCallback(String name, uint64_t callbackID)
9598 GetLookupContextAtPoint(WebCore::IntPoint point, uint64_t callbackID)

Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

4242#import "WKAccessibilityWebPageObjectIOS.h"
4343#import "WebChromeClient.h"
4444#import "WebCoreArgumentCoders.h"
 45#import "WebDatabaseManager.h"
4546#import "WebFrame.h"
4647#import "WebImage.h"
4748#import "WebKitSystemInterface.h"

@@void WebPage::applicationWillResignActive()
27172718
27182719void WebPage::applicationWillEnterForeground()
27192720{
 2721 WebProcess::singleton().supplement<WebDatabaseManager>()->setPauseAllDatabases(false);
27202722 [[NSNotificationCenter defaultCenter] postNotificationName:WebUIApplicationWillEnterForegroundNotification object:nil];
27212723}
27222724
 2725void WebPage::applicationDidEnterBackground()
 2726{
 2727 WebProcess::singleton().supplement<WebDatabaseManager>()->setPauseAllDatabases();
 2728}
 2729
27232730void WebPage::applicationDidBecomeActive()
27242731{
27252732 [[NSNotificationCenter defaultCenter] postNotificationName:WebUIApplicationDidBecomeActiveNotification object:nil];