[WK2][iOS] Regression(r182323): ASSERTION FAILED: WebCore::SQLiteDatabaseTracker...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Apr 2015 20:49:40 +0000 (20:49 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Apr 2015 20:49:40 +0000 (20:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143451
<rdar://problem/20437994>

Reviewed by Anders Carlsson.

Initialize WebProcess::m_webSQLiteDatabaseTracker and
NetworkProcess::m_webSQLiteDatabaseTracker in their respective class
constructors instead of doing it later in the initializeWebProcess() /
initializeNetworkProcess() methods.

If we do it later, it can happen that the tracker gets set after
a SQLiteTransactionInProgressAutoCounter initialization and before
the actual transaction. When this happens, the
SQLiteTransactionInProgressAutoCounter variable fails to increment the
transaction count. Then when the transaction is executed,
SQLiteDatabaseTracker::hasTransactionInProgress() can return false.
This would lead to possible assertions on start up on iOS.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::NetworkProcess):
(WebKit::NetworkProcess::initializeNetworkProcess):
* NetworkProcess/NetworkProcess.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess):
(WebKit::WebProcess::initializeConnection):
* WebProcess/WebProcess.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182437 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkProcess.cpp
Source/WebKit2/NetworkProcess/NetworkProcess.h
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/WebProcess.h

index 88d10e4..31f52d8 100644 (file)
@@ -1,3 +1,33 @@
+2015-04-06  Chris Dumez  <cdumez@apple.com>
+
+        [WK2][iOS] Regression(r182323): ASSERTION FAILED: WebCore::SQLiteDatabaseTracker::hasTransactionInProgress() in NetworkCache::Statistics::initialize()
+        https://bugs.webkit.org/show_bug.cgi?id=143451
+        <rdar://problem/20437994>
+
+        Reviewed by Anders Carlsson.
+
+        Initialize WebProcess::m_webSQLiteDatabaseTracker and
+        NetworkProcess::m_webSQLiteDatabaseTracker in their respective class
+        constructors instead of doing it later in the initializeWebProcess() /
+        initializeNetworkProcess() methods.
+
+        If we do it later, it can happen that the tracker gets set after
+        a SQLiteTransactionInProgressAutoCounter initialization and before
+        the actual transaction. When this happens, the
+        SQLiteTransactionInProgressAutoCounter variable fails to increment the
+        transaction count. Then when the transaction is executed,
+        SQLiteDatabaseTracker::hasTransactionInProgress() can return false.
+        This would lead to possible assertions on start up on iOS.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::NetworkProcess):
+        (WebKit::NetworkProcess::initializeNetworkProcess):
+        * NetworkProcess/NetworkProcess.h:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::WebProcess):
+        (WebKit::WebProcess::initializeConnection):
+        * WebProcess/WebProcess.h:
+
 2015-04-06  Beth Dakin  <bdakin@apple.com>
 
         https://trac.webkit.org/changeset/182338 introduced a build failure that I 
index a7f5414..30a8e60 100644 (file)
 #include "NetworkCacheCoders.h"
 #endif
 
-#if PLATFORM(IOS)
-#include "WebSQLiteDatabaseTracker.h"
-#endif
-
 using namespace WebCore;
 
 namespace WebKit {
@@ -86,6 +82,9 @@ NetworkProcess::NetworkProcess()
 #if PLATFORM(COCOA)
     , m_clearCacheDispatchGroup(0)
 #endif
+#if PLATFORM(IOS)
+    , m_webSQLiteDatabaseTracker(*this)
+#endif
 {
     NetworkProcessPlatformStrategies::initialize();
 
@@ -198,10 +197,6 @@ void NetworkProcess::initializeNetworkProcess(const NetworkProcessCreationParame
     if (parameters.shouldUseTestingNetworkSession)
         NetworkStorageSession::switchToNewTestingSession();
 
-#if PLATFORM(IOS)
-    m_webSQLiteDatabaseTracker = std::make_unique<WebSQLiteDatabaseTracker>(*this);
-#endif
-
     NetworkProcessSupplementMap::const_iterator it = m_supplements.begin();
     NetworkProcessSupplementMap::const_iterator end = m_supplements.end();
     for (; it != end; ++it)
index f1c9e8b..5166498 100644 (file)
 #include <wtf/Forward.h>
 #include <wtf/NeverDestroyed.h>
 
+#if PLATFORM(IOS)
+#include "WebSQLiteDatabaseTracker.h"
+#endif
+
 namespace WebCore {
 class CertificateInfo;
 }
@@ -50,10 +54,6 @@ class NetworkProcessSupplement;
 struct NetworkProcessCreationParameters;
 struct SecurityOriginData;
 
-#if PLATFORM(IOS)
-class WebSQLiteDatabaseTracker;
-#endif
-
 class NetworkProcess : public ChildProcess, private DownloadManager::Client {
     WTF_MAKE_NONCOPYABLE(NetworkProcess);
     friend class NeverDestroyed<NetworkProcess>;
@@ -178,7 +178,7 @@ private:
 #endif
 
 #if PLATFORM(IOS)
-    std::unique_ptr<WebSQLiteDatabaseTracker> m_webSQLiteDatabaseTracker;
+    WebSQLiteDatabaseTracker m_webSQLiteDatabaseTracker;
 #endif
 };
 
index b6e4479..908b201 100644 (file)
 #include "WebNotificationManager.h"
 #endif
 
-#if PLATFORM(IOS)
-#include "WebSQLiteDatabaseTracker.h"
-#endif
-
 #if ENABLE(BATTERY_STATUS)
 #include "WebBatteryManager.h"
 #endif
@@ -181,6 +177,9 @@ WebProcess::WebProcess()
 #endif
     , m_nonVisibleProcessCleanupTimer(*this, &WebProcess::nonVisibleProcessCleanupTimerFired)
     , m_webOriginDataManager(std::make_unique<WebOriginDataManager>(*this, *this))
+#if PLATFORM(IOS)
+    , m_webSQLiteDatabaseTracker(*this)
+#endif
 {
     // Initialize our platform strategies.
     WebPlatformStrategies::initialize();
@@ -236,10 +235,6 @@ void WebProcess::initializeConnection(IPC::Connection* connection)
 #if ENABLE(SEC_ITEM_SHIM)
     SecItemShim::singleton().initializeConnection(connection);
 #endif
-
-#if PLATFORM(IOS)
-    m_webSQLiteDatabaseTracker = std::make_unique<WebSQLiteDatabaseTracker>(*this);
-#endif
     
     WebProcessSupplementMap::const_iterator it = m_supplements.begin();
     WebProcessSupplementMap::const_iterator end = m_supplements.end();
index 073ed85..92adbc1 100644 (file)
 #include <WebCore/MachSendRight.h>
 #endif
 
+#if PLATFORM(IOS)
+#include "WebSQLiteDatabaseTracker.h"
+#endif
+
 namespace API {
 class Object;
 }
@@ -90,10 +94,6 @@ class WebResourceLoadScheduler;
 class WebToDatabaseProcessConnection;
 #endif
 
-#if PLATFORM(IOS)
-class WebSQLiteDatabaseTracker;
-#endif
-
 class WebProcess : public ChildProcess, public WebOriginDataManagerSupplement, private DownloadManager::Client {
     friend class NeverDestroyed<DownloadManager>;
 public:
@@ -379,7 +379,7 @@ private:
 
     std::unique_ptr<WebOriginDataManager> m_webOriginDataManager;
 #if PLATFORM(IOS)
-    std::unique_ptr<WebSQLiteDatabaseTracker> m_webSQLiteDatabaseTracker;
+    WebSQLiteDatabaseTracker m_webSQLiteDatabaseTracker;
 #endif
 };