WebKit Bugzilla
Attachment 341175 Details for
Bug 185330
: [iOS] Add assert to catch improper use of WebCore::Timer in UI Process
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch v1
bug-185330-20180523223141.patch (text/plain), 6.73 KB, created by
David Kilzer (:ddkilzer)
on 2018-05-23 22:31:41 PDT
(
hide
)
Description:
Patch v1
Filename:
MIME Type:
Creator:
David Kilzer (:ddkilzer)
Created:
2018-05-23 22:31:41 PDT
Size:
6.73 KB
patch
obsolete
>Subversion Revision: 232139 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c719b83d7a328ee03e7f71bae1be02cee8cbe1e3..ffcba5218ea653909b23ba9e3b2e9fa665d72205 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2018-05-23 David Kilzer <ddkilzer@apple.com> >+ >+ [iOS] Add assert to catch improper use of WebCore::Timer in UI Process >+ <https://webkit.org/b/185330> >+ <rdar://problem/32816079> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * platform/RuntimeApplicationChecks.h: >+ (WebCore::setIsUIProcess): Declare new method. >+ (WebCore::isUIProcess): Ditto. >+ * platform/Timer.cpp: >+ (WebCore::TimerBase::TimerBase): Add assert and os_log_fault. >+ This catches the unwanted behavior. >+ (WebCore::TimerBase::isAllowedToUseWebCoreTimerInUIProcess): Add. >+ * platform/Timer.h: >+ (WebCore::TimerBase::isAllowedToUseWebCoreTimerInUIProcess): Add >+ declaration. >+ * platform/cocoa/RuntimeApplicationChecksCocoa.mm: >+ (s_isUIProcess): Add. Global to track UI Process state. >+ (WebCore::setIsUIProcess): Add. Sets global to true. >+ (WebCore::isUIProcess): Retun value of global. >+ > 2018-05-23 David Kilzer <ddkilzer@apple.com> > > Don't create the SubimageCache just to clear an image from it >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 25b3002c468cdc0ce88b2de403af76a72b333236..7f15d4b8bb78c359d8d5c36906cddd483d7adf24 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,16 @@ >+2018-05-23 David Kilzer <ddkilzer@apple.com> >+ >+ [iOS] Add assert to catch improper use of WebCore::Timer in UI Process >+ <https://webkit.org/b/185330> >+ <rdar://problem/32816079> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: >+ (-[WKWebViewConfiguration init]): Call WebCore::setIsUIProcess() >+ to set the global flag when a WKWebViewConfiguration object is >+ created in the current process. >+ > 2018-05-23 Eric Carlson <eric.carlson@apple.com> > > Avoid loading AVFoundation to check supported MIME types if possible >diff --git a/Source/WebCore/platform/RuntimeApplicationChecks.h b/Source/WebCore/platform/RuntimeApplicationChecks.h >index 94e28f8592e1548338f28116009edc5444e9ec94..11817d3f99a065a19dfd4c014c5d5b2c787703dd 100644 >--- a/Source/WebCore/platform/RuntimeApplicationChecks.h >+++ b/Source/WebCore/platform/RuntimeApplicationChecks.h >@@ -40,6 +40,9 @@ inline bool isInWebProcess() { return true; } > > #if PLATFORM(COCOA) > >+WEBCORE_EXPORT void setIsUIProcess(); >+bool isUIProcess(); >+ > bool isInWebProcess(); > > WEBCORE_EXPORT void setApplicationBundleIdentifier(const String&); >diff --git a/Source/WebCore/platform/Timer.cpp b/Source/WebCore/platform/Timer.cpp >index 43a5920bfc1ffd079029456fb7cc6efe272c6ccf..f4a10f49a93eb632ca746473d9aeca172eb73903 100644 >--- a/Source/WebCore/platform/Timer.cpp >+++ b/Source/WebCore/platform/Timer.cpp >@@ -27,15 +27,22 @@ > #include "config.h" > #include "Timer.h" > >+#include "Logging.h" >+#include "RuntimeApplicationChecks.h" > #include "SharedTimer.h" > #include "ThreadGlobalData.h" > #include "ThreadTimers.h" > #include <limits.h> > #include <limits> > #include <math.h> >+#include <wtf/Compiler.h> > #include <wtf/MainThread.h> > #include <wtf/Vector.h> > >+#if USE(WEB_THREAD) >+#include "WebCoreThread.h" >+#endif >+ > namespace WebCore { > > class TimerHeapReference; >@@ -186,6 +193,15 @@ inline bool TimerHeapLessThanFunction::operator()(const TimerBase* a, const Time > > TimerBase::TimerBase() > { >+#if PLATFORM(IOS) >+ // FIXME: Enable for PLATFORM(COCOA): <rdar://problem/40005654> IOSurfacePool should stop using WebCore::Timer. >+ if (UNLIKELY(!isAllowedToUseWebCoreTimerInUIProcess())) { >+#define WEBCORE_TIMERBASE_ASSERTION_MESSAGE "WebCore::Timer should not be used in UI Process." >+ ASSERT_WITH_MESSAGE(false, WEBCORE_TIMERBASE_ASSERTION_MESSAGE); >+ RELEASE_LOG_FAULT(Threading, WEBCORE_TIMERBASE_ASSERTION_MESSAGE); >+#undef WEBCORE_TIMERBASE_ASSERTION_MESSAGE >+ } >+#endif > } > > TimerBase::~TimerBase() >@@ -242,6 +258,23 @@ inline void TimerBase::checkConsistency() const > checkHeapIndex(); > } > >+bool TimerBase::isAllowedToUseWebCoreTimerInUIProcess() >+{ >+#if PLATFORM(COCOA) >+ if (!isUIProcess()) >+ return true; >+ >+#if USE(WEB_THREAD) >+ if (WebThreadIsEnabled() && (WebThreadIsCurrent() || WebThreadIsLocked())) >+ return true; >+#endif >+ >+ return false; >+#else >+ return true; >+#endif >+} >+ > void TimerBase::heapDecreaseKey() > { > ASSERT(static_cast<bool>(m_nextFireTime)); >diff --git a/Source/WebCore/platform/Timer.h b/Source/WebCore/platform/Timer.h >index 5e757d40555caf56cb0c0834ef3319013f29f24f..cc87e95a060314f08e59c66c4d33733bf6c70767 100644 >--- a/Source/WebCore/platform/Timer.h >+++ b/Source/WebCore/platform/Timer.h >@@ -78,6 +78,8 @@ private: > void checkConsistency() const; > void checkHeapIndex() const; > >+ static bool isAllowedToUseWebCoreTimerInUIProcess(); >+ > void setNextFireTime(MonotonicTime); > > bool inHeap() const { return m_heapIndex != -1; } >diff --git a/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm b/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm >index 377dcaa1e0d48dd80a1f5ce5255e911c157e37ae..02b1fcc9dfa6697db464b0a79582101e95afbf6a 100644 >--- a/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm >+++ b/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm >@@ -38,6 +38,7 @@ namespace WebCore { > #if !ASSERT_MSG_DISABLED > static bool applicationBundleIdentifierOverrideWasQueried; > #endif >+static bool s_isUIProcess; > > // The application bundle identifier gets set to the UIProcess bundle identifier by the WebProcess and > // the Networking upon initialization. It is unset otherwise. >@@ -65,6 +66,16 @@ void setApplicationBundleIdentifier(const String& bundleIdentifier) > applicationBundleIdentifierOverride() = bundleIdentifier; > } > >+void setIsUIProcess() >+{ >+ s_isUIProcess = true; >+} >+ >+bool isUIProcess() >+{ >+ return s_isUIProcess; >+} >+ > bool isInWebProcess() > { > static bool mainBundleIsWebProcess = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.WebKit.WebContent.Development"] >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm >index 14562c41709efa60c813a783624ef15c02f5e2bb..9f893e632c2b29dea06e17b27a016af28c42cebb 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm >@@ -172,6 +172,7 @@ - (instancetype)init > return nil; > > WebKit::InitializeWebKit2(); >+ WebCore::setIsUIProcess(); > > #if PLATFORM(IOS) > #if !ENABLE(EXTRA_ZOOM_MODE)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185330
:
340571
|
340637
|
341175
|
341181
|
341183
|
341541
|
344076
|
344083
|
344217
|
344224