[WK2] Extend processDidCrash delegate to let the client know the reason for the crash
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 May 2017 18:54:37 +0000 (18:54 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 May 2017 18:54:37 +0000 (18:54 +0000)
commit82f54cf22b7c475315be86a2207b1352eb58e3d7
tree893417e6a5b6db39d3868e9f0ed9f155d1c86edf
parentbf0427b3c1ce44a91512ed7c57ed67081ba785f7
[WK2] Extend processDidCrash delegate to let the client know the reason for the crash
https://bugs.webkit.org/show_bug.cgi?id=171565
<rdar://problem/31204417>

Reviewed by Sam Weinig.

Source/WebKit2:

Extend processDidCrash delegate to let the client know the reason for the crash. This
is needed by some clients to distinguish actual crashes from terminations due to
resource limits.

* Shared/ProcessCrashReason.h: Added.
* UIProcess/API/APINavigationClient.h:
(API::NavigationClient::processDidCrash):
* UIProcess/API/C/WKAPICast.h:
(WebKit::toAPI):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageNavigationClient):
* UIProcess/API/C/WKPageNavigationClient.h:
* UIProcess/API/C/WKProcessCrashReason.h: Added.
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::processDidCrash):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::processDidCrash):
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didClose):
(WebKit::WebProcessProxy::requestTermination):
(WebKit::diagnosticLoggingKeyForTerminationReason):
(WebKit::toProcessCrashReason):
(WebKit::WebProcessProxy::terminateProcessDueToResourceLimits):
(WebKit::WebProcessProxy::didExceedActiveMemoryLimit):
(WebKit::WebProcessProxy::didExceedInactiveMemoryLimit):
(WebKit::WebProcessProxy::didExceedBackgroundCPULimit):
* UIProcess/WebProcessProxy.h:
* WebKit2.xcodeproj/project.pbxproj:

Tools:

Add API test coverage.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/ProcessDidCrashWithReason.cpp: Added.
(TestWebKitAPI::didFinishNavigation):
(TestWebKitAPI::didCrashWithReason):
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216129 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/ProcessCrashReason.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/APINavigationClient.h
Source/WebKit2/UIProcess/API/C/WKAPICast.h
Source/WebKit2/UIProcess/API/C/WKPage.cpp
Source/WebKit2/UIProcess/API/C/WKPageNavigationClient.h
Source/WebKit2/UIProcess/API/C/WKProcessCrashReason.h [new file with mode: 0644]
Source/WebKit2/UIProcess/Cocoa/NavigationState.h
Source/WebKit2/UIProcess/Cocoa/NavigationState.mm
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebProcessProxy.cpp
Source/WebKit2/UIProcess/WebProcessProxy.h
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2/ProcessDidCrashWithReason.cpp [new file with mode: 0644]