Add "databaseProcessDidCrash" to the WKContextClient; Adopt it in WKTR.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Feb 2016 17:35:52 +0000 (17:35 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Feb 2016 17:35:52 +0000 (17:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=154428

Reviewed by Jer Noble.

Source/WebKit2:

* UIProcess/API/C/WKContext.h:
* UIProcess/API/C/mac/WKContextPrivateMac.h:
* UIProcess/API/C/mac/WKContextPrivateMac.mm:
(WKContextGetDatabaseProcessIdentifier):

* UIProcess/WebContextClient.cpp:
(WebKit::WebContextClient::databaseProcessDidCrash):
* UIProcess/WebContextClient.h:

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::databaseProcessCrashed):
(WebKit::WebProcessPool::databaseProcessIdentifier):
* UIProcess/WebProcessPool.h:

Tools:

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::databaseProcessName):
(WTR::TestController::databaseProcessDidCrash):
* WebKitTestRunner/TestController.h:

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKContext.h
Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.h
Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.mm
Source/WebKit2/UIProcess/WebContextClient.cpp
Source/WebKit2/UIProcess/WebContextClient.h
Source/WebKit2/UIProcess/WebProcessPool.cpp
Source/WebKit2/UIProcess/WebProcessPool.h
Tools/ChangeLog
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h

index a4a9b10..08474bf 100644 (file)
@@ -1,3 +1,24 @@
+2016-02-19  Brady Eidson  <beidson@apple.com>
+
+        Add "databaseProcessDidCrash" to the WKContextClient; Adopt it in WKTR.
+        https://bugs.webkit.org/show_bug.cgi?id=154428
+
+        Reviewed by Jer Noble.
+
+        * UIProcess/API/C/WKContext.h:
+        * UIProcess/API/C/mac/WKContextPrivateMac.h:
+        * UIProcess/API/C/mac/WKContextPrivateMac.mm:
+        (WKContextGetDatabaseProcessIdentifier):
+
+        * UIProcess/WebContextClient.cpp:
+        (WebKit::WebContextClient::databaseProcessDidCrash):
+        * UIProcess/WebContextClient.h:
+
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::databaseProcessCrashed):
+        (WebKit::WebProcessPool::databaseProcessIdentifier):
+        * UIProcess/WebProcessPool.h:
+
 2016-02-18  Gwang Yoon Hwang  <yoon@igalia.com>
 
         [GTK] Limit the number of tiles according to the visible area
index 2790969..b8a9e84 100644 (file)
@@ -45,10 +45,13 @@ typedef uint32_t WKCacheModel;
 
 // Context Client
 typedef void (*WKContextPlugInAutoStartOriginHashesChangedCallback)(WKContextRef context, const void *clientInfo);
-typedef void (*WKContextNetworkProcessDidCrashCallback)(WKContextRef context, const void *clientInfo);
 typedef void (*WKContextPlugInInformationBecameAvailableCallback)(WKContextRef context, WKArrayRef plugIn, const void *clientInfo);
 typedef WKDataRef (*WKContextCopyWebCryptoMasterKeyCallback)(WKContextRef context, const void *clientInfo);
 
+typedef void (*WKContextChildProcessDidCrashCallback)(WKContextRef context, const void *clientInfo);
+typedef WKContextChildProcessDidCrashCallback WKContextNetworkProcessDidCrashCallback;
+typedef WKContextChildProcessDidCrashCallback WKContextDatabaseProcessDidCrashCallback;
+
 typedef struct WKContextClientBase {
     int                                                                 version;
     const void *                                                        clientInfo;
@@ -75,6 +78,21 @@ typedef struct WKContextClientV1 {
     WKContextCopyWebCryptoMasterKeyCallback                             copyWebCryptoMasterKey;
 } WKContextClientV1;
 
+typedef struct WKContextClientV2 {
+    WKContextClientBase                                                 base;
+
+    // Version 0.
+    WKContextPlugInAutoStartOriginHashesChangedCallback                 plugInAutoStartOriginHashesChanged;
+    WKContextNetworkProcessDidCrashCallback                             networkProcessDidCrash;
+    WKContextPlugInInformationBecameAvailableCallback                   plugInInformationBecameAvailable;
+
+    // Version 1.
+    WKContextCopyWebCryptoMasterKeyCallback                             copyWebCryptoMasterKey;
+
+    // Version 2.
+    WKContextDatabaseProcessDidCrashCallback                            databaseProcessDidCrash;
+} WKContextClientV2;
+
 // FIXME: Remove these once support for Mavericks has been dropped.
 enum {
     kWKProcessModelSharedSecondaryProcess = 0,
index 98fe3f6..1611d93 100644 (file)
@@ -78,6 +78,7 @@ WK_EXPORT bool WKContextShouldBlockWebGL();
 WK_EXPORT bool WKContextShouldSuggestBlockWebGL();
 
 WK_EXPORT pid_t WKContextGetNetworkProcessIdentifier(WKContextRef context);
+WK_EXPORT pid_t WKContextGetDatabaseProcessIdentifier(WKContextRef context);
 
 #ifdef __cplusplus
 }
index bfe3df7..4c192b6 100644 (file)
@@ -168,3 +168,8 @@ pid_t WKContextGetNetworkProcessIdentifier(WKContextRef contextRef)
 {
     return toImpl(contextRef)->networkProcessIdentifier();
 }
+
+pid_t WKContextGetDatabaseProcessIdentifier(WKContextRef contextRef)
+{
+    return toImpl(contextRef)->databaseProcessIdentifier();
+}
index 46b36d1..41224da 100644 (file)
@@ -47,6 +47,14 @@ void WebContextClient::networkProcessDidCrash(WebProcessPool* processPool)
     m_client.networkProcessDidCrash(toAPI(processPool), m_client.base.clientInfo);
 }
 
+void WebContextClient::databaseProcessDidCrash(WebProcessPool* processPool)
+{
+    if (!m_client.databaseProcessDidCrash)
+        return;
+
+    m_client.databaseProcessDidCrash(toAPI(processPool), m_client.base.clientInfo);
+}
+
 void WebContextClient::plugInInformationBecameAvailable(WebProcessPool* processPool, API::Array* plugInInfo)
 {
     if (!m_client.plugInInformationBecameAvailable)
index 44d43cd..29c9b60 100644 (file)
@@ -34,7 +34,7 @@ namespace API {
 class Array;
 
 template<> struct ClientTraits<WKContextClientBase> {
-    typedef std::tuple<WKContextClientV0, WKContextClientV1> Versions;
+    typedef std::tuple<WKContextClientV0, WKContextClientV1, WKContextClientV2> Versions;
 };
 }
 
@@ -47,6 +47,7 @@ class WebContextClient : public API::Client<WKContextClientBase> {
 public:
     void plugInAutoStartOriginHashesChanged(WebProcessPool*);
     void networkProcessDidCrash(WebProcessPool*);
+    void databaseProcessDidCrash(WebProcessPool*);
     void plugInInformationBecameAvailable(WebProcessPool*, API::Array*);
     PassRefPtr<API::Data> copyWebCryptoMasterKey(WebProcessPool*);
 };
index 3d62f92..92e95d1 100644 (file)
@@ -451,6 +451,7 @@ void WebProcessPool::databaseProcessCrashed(DatabaseProcessProxy* databaseProces
     for (auto& supplement : m_supplements)
         supplement.value->processDidClose(databaseProcessProxy);
 
+    m_client.databaseProcessDidCrash(this);
     m_databaseProcess = nullptr;
 }
 #endif
@@ -838,6 +839,18 @@ pid_t WebProcessPool::networkProcessIdentifier()
     return m_networkProcess->processIdentifier();
 }
 
+pid_t WebProcessPool::databaseProcessIdentifier()
+{
+#if ENABLE(DATABASE_PROCESS)
+    if (!m_databaseProcess)
+        return 0;
+
+    return m_databaseProcess->processIdentifier();
+#else
+    return 0;
+#endif
+}
+
 void WebProcessPool::setAlwaysUsesComplexTextCodePath(bool alwaysUseComplexText)
 {
     m_alwaysUsesComplexTextCodePath = alwaysUseComplexText;
index 127c363..1fb3d24 100644 (file)
@@ -187,6 +187,7 @@ public:
 #endif
 
     pid_t networkProcessIdentifier();
+    pid_t databaseProcessIdentifier();
 
     void setAlwaysUsesComplexTextCodePath(bool);
     void setShouldUseFontSmoothing(bool);
index 642ac17..311d523 100644 (file)
@@ -1,3 +1,16 @@
+2016-02-19  Brady Eidson  <beidson@apple.com>
+
+        Add "databaseProcessDidCrash" to the WKContextClient; Adopt it in WKTR.
+        https://bugs.webkit.org/show_bug.cgi?id=154428
+
+        Reviewed by Jer Noble.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::generatePageConfiguration):
+        (WTR::TestController::databaseProcessName):
+        (WTR::TestController::databaseProcessDidCrash):
+        * WebKitTestRunner/TestController.h:
+
 2016-02-18  Philippe Normand  <pnormand@igalia.com>
 
         [GStreamer] Bump internal jhbuild versions to 1.6.3
index ba20bbd..f303c8e 100644 (file)
@@ -433,12 +433,13 @@ WKRetainPtr<WKPageConfigurationRef> TestController::generatePageConfiguration(WK
     };
     WKContextSetInjectedBundleClient(m_context.get(), &injectedBundleClient.base);
 
-    WKContextClientV1 contextClient = {
-        { 1, this },
+    WKContextClientV2 contextClient = {
+        { 2, this },
         0, // plugInAutoStartOriginHashesChanged
         networkProcessDidCrash,
         0, // plugInInformationBecameAvailable
         0, // copyWebCryptoMasterKey
+        databaseProcessDidCrash,
     };
     WKContextSetClient(m_context.get(), &contextClient.base);
 
@@ -821,6 +822,16 @@ const char* TestController::networkProcessName()
 #endif
 }
 
+const char* TestController::databaseProcessName()
+{
+    // FIXME: Find a way to not hardcode the process name.
+#if PLATFORM(COCOA)
+    return "com.apple.WebKit.Databases.Development";
+#else
+    return "DatabaseProcess";
+#endif
+}
+
 static std::string testPath(WKURLRef url)
 {
     auto scheme = adoptWK(WKURLCopyScheme(url));
@@ -1138,6 +1149,11 @@ void TestController::networkProcessDidCrash(WKContextRef context, const void *cl
     static_cast<TestController*>(const_cast<void*>(clientInfo))->networkProcessDidCrash();
 }
 
+void TestController::databaseProcessDidCrash(WKContextRef context, const void *clientInfo)
+{
+    static_cast<TestController*>(const_cast<void*>(clientInfo))->databaseProcessDidCrash();
+}
+
 void TestController::didReceiveKeyDownMessageFromInjectedBundle(WKDictionaryRef messageBodyDictionary, bool synchronous)
 {
     WKRetainPtr<WKStringRef> keyKey = adoptWK(WKStringCreateWithUTF8CString("Key"));
@@ -1445,6 +1461,17 @@ void TestController::networkProcessDidCrash()
     exit(1);
 }
 
+void TestController::databaseProcessDidCrash()
+{
+#if PLATFORM(COCOA)
+    pid_t pid = WKContextGetDatabaseProcessIdentifier(m_context.get());
+    fprintf(stderr, "#CRASHED - %s (pid %ld)\n", databaseProcessName(), static_cast<long>(pid));
+#else
+    fprintf(stderr, "#CRASHED - %s\n", databaseProcessName());
+#endif
+    exit(1);
+}
+
 // WKPageNavigationClient
 
 void TestController::didCommitNavigation(WKPageRef page, WKNavigationRef navigation, WKTypeRef, const void* clientInfo)
index ff06cfb..3822b3e 100644 (file)
@@ -114,6 +114,7 @@ public:
 
     static const char* webProcessName();
     static const char* networkProcessName();
+    static const char* databaseProcessName();
 
     WorkQueueManager& workQueueManager() { return m_workQueueManager; }
 
@@ -185,6 +186,8 @@ private:
     // WKContextClient
     static void networkProcessDidCrash(WKContextRef, const void*);
     void networkProcessDidCrash();
+    static void databaseProcessDidCrash(WKContextRef, const void*);
+    void databaseProcessDidCrash();
 
     // WKPageNavigationClient
     static void didCommitNavigation(WKPageRef, WKNavigationRef, WKTypeRef userData, const void*);