Add logging when SpringBoard enables WebThread
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Apr 2018 05:53:03 +0000 (05:53 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Apr 2018 05:53:03 +0000 (05:53 +0000)
<https://webkit.org/b/185100>
<rdar://problem/39746542>

Reviewed by Daniel Bates.

Source/WebCore:

* platform/RuntimeApplicationChecks.h:
(WebCore::IOSApplication::isSpringBoard): Add declaration.
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::IOSApplication::isSpringBoard): Add implementation.
* platform/ios/wak/WebCoreThread.mm:
(WebThreadEnable): Call RELEASE_LOG_FAULT() if this is called by
SpringBoard.

Source/WTF:

* wtf/Assertions.h:
(RELEASE_LOG_FAULT): Add macro to call os_log_fault().
* wtf/Platform.h: Drive-by fix to enable USE(OS_LOG) on
public iOS SDKs since <rdar://problem/27758343> was
fixed in iOS 11.0.

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

Source/WTF/ChangeLog
Source/WTF/wtf/Assertions.h
Source/WTF/wtf/Platform.h
Source/WebCore/ChangeLog
Source/WebCore/platform/RuntimeApplicationChecks.h
Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm
Source/WebCore/platform/ios/wak/WebCoreThread.mm

index 6cb0c0e..a05d6d4 100644 (file)
@@ -1,3 +1,17 @@
+2018-04-27  David Kilzer  <ddkilzer@apple.com>
+
+        Add logging when SpringBoard enables WebThread
+        <https://webkit.org/b/185100>
+        <rdar://problem/39746542>
+
+        Reviewed by Daniel Bates.
+
+        * wtf/Assertions.h:
+        (RELEASE_LOG_FAULT): Add macro to call os_log_fault().
+        * wtf/Platform.h: Drive-by fix to enable USE(OS_LOG) on
+        public iOS SDKs since <rdar://problem/27758343> was
+        fixed in iOS 11.0.
+
 2018-04-26  Mark Lam  <mark.lam@apple.com>
 
         Gardening: Speculative build fix for Windows.
index ea0024b..d823f7c 100644 (file)
@@ -445,6 +445,7 @@ WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashWithSecurityImplication(v
 #if RELEASE_LOG_DISABLED
 #define RELEASE_LOG(channel, ...) ((void)0)
 #define RELEASE_LOG_ERROR(channel, ...) LOG_ERROR(__VA_ARGS__)
+#define RELEASE_LOG_FAULT(channel, ...) LOG_ERROR(__VA_ARGS__)
 
 #define RELEASE_LOG_IF(isAllowed, channel, ...) ((void)0)
 #define RELEASE_LOG_ERROR_IF(isAllowed, channel, ...) do { if (isAllowed) RELEASE_LOG_ERROR(channel, __VA_ARGS__); } while (0)
@@ -454,6 +455,7 @@ WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashWithSecurityImplication(v
 #else
 #define RELEASE_LOG(channel, ...) os_log(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
 #define RELEASE_LOG_ERROR(channel, ...) os_log_error(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
+#define RELEASE_LOG_FAULT(channel, ...) os_log_fault(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
 #define RELEASE_LOG_INFO(channel, ...) os_log_info(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
 
 #define RELEASE_LOG_IF(isAllowed, channel, ...) do { if (isAllowed) RELEASE_LOG(      channel, __VA_ARGS__); } while (0)
index d9ba176..5ea719b 100644 (file)
 #define USE_MEDIATOOLBOX 1
 #endif
 
-/* FIXME: Enable USE_OS_LOG when building with the public iOS 10 SDK once we fix <rdar://problem/27758343>. */
-#if PLATFORM(MAC) || (PLATFORM(IOS) && USE(APPLE_INTERNAL_SDK))
+#if PLATFORM(MAC) || PLATFORM(IOS)
 #define USE_OS_LOG 1
 #if USE(APPLE_INTERNAL_SDK)
 #define USE_OS_STATE 1
index 0cd1acf..3ee1a38 100644 (file)
@@ -1,3 +1,19 @@
+2018-04-27  David Kilzer  <ddkilzer@apple.com>
+
+        Add logging when SpringBoard enables WebThread
+        <https://webkit.org/b/185100>
+        <rdar://problem/39746542>
+
+        Reviewed by Daniel Bates.
+
+        * platform/RuntimeApplicationChecks.h:
+        (WebCore::IOSApplication::isSpringBoard): Add declaration.
+        * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
+        (WebCore::IOSApplication::isSpringBoard): Add implementation.
+        * platform/ios/wak/WebCoreThread.mm:
+        (WebThreadEnable): Call RELEASE_LOG_FAULT() if this is called by
+        SpringBoard.
+
 2018-04-27  Keith Rollin  <krollin@apple.com>
 
         Fix crash in DocumentLoader::startLoadingMainResource
index af4890d..94e28f8 100644 (file)
@@ -78,6 +78,7 @@ WEBCORE_EXPORT bool isMobileSafari();
 WEBCORE_EXPORT bool isWebBookmarksD();
 bool isDumpRenderTree();
 bool isMobileStore();
+bool isSpringBoard();
 WEBCORE_EXPORT bool isWebApp();
 WEBCORE_EXPORT bool isWebProcess();
 bool isIBooks();
index 58626ee..377dcaa 100644 (file)
@@ -206,6 +206,12 @@ bool IOSApplication::isMobileStore()
     return isMobileStore;
 }
 
+bool IOSApplication::isSpringBoard()
+{
+    static bool isSpringBoard = applicationBundleIsEqualTo("com.apple.springboard");
+    return isSpringBoard;
+}
+
 bool IOSApplication::isWebApp()
 {
     static bool isWebApp = applicationBundleIsEqualTo("com.apple.webapp");
index b281ecd..4a92bc6 100644 (file)
@@ -30,6 +30,7 @@
 
 #import "CommonVM.h"
 #import "FloatingPointEnvironment.h"
+#import "Logging.h"
 #import "RuntimeApplicationChecks.h"
 #import "ThreadGlobalData.h"
 #import "WAKWindow.h"
@@ -876,6 +877,8 @@ WebThreadContext* WebThreadCurrentContext(void)
 void WebThreadEnable(void)
 {
     RELEASE_ASSERT_WITH_MESSAGE(!WebCore::IOSApplication::isWebProcess(), "The WebProcess should never run a Web Thread");
+    if (WebCore::IOSApplication::isSpringBoard())
+        RELEASE_LOG_FAULT(Threading, "SpringBoard enabled WebThread.");
 
     static std::once_flag flag;
     std::call_once(flag, StartWebThread);