Changeset 233461 in webkit
- Timestamp:
- Jul 3, 2018 3:41:37 AM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r233452 r233461 1 2018-07-03 David Kilzer <ddkilzer@apple.com> 2 3 [iOS] Add assert to catch improper use of WebCore::Timer in UI Process 4 <https://webkit.org/b/185330> 5 <rdar://problem/32816079> 6 7 Reviewed by Darin Adler. 8 9 * platform/RuntimeApplicationChecks.cpp: 10 (WebCore::s_webKitProcessType): Add. Global to track process 11 type. 12 (WebCore::setWebKitProcessType): Implement new function that is 13 called when initializing Web, Network, and Storage processes. 14 (WebCore::isInNetworkProcess): Add. 15 (WebCore::isInStorageProcess): Add. 16 (WebCore::isInWebProcess): Add. 17 - Check value in s_webKitProcessType to determine which process 18 is currently running. 19 * platform/RuntimeApplicationChecks.h: 20 (WebCore::isInNetworkProcess): Add. 21 (WebCore::isInStorageProcess): Add. 22 (WebCore::isInWebProcess): 23 - Make available for all platforms. 24 25 * platform/Timer.cpp: 26 (WebCore::TimerBase::TimerBase): Add assert and os_log_fault. 27 This catches the unwanted behavior on iOS using isAllowed(). 28 (WebCore::TimerBase::isAllowed): Add implementation. 29 * platform/Timer.h: 30 (WebCore::TimerBase::isAllowed): Add declaration. 31 32 * platform/cocoa/RuntimeApplicationChecksCocoa.mm: 33 (WebCore::isInWebProcess): Delete. Replace with method in 34 RuntimeApplicationChecks.cpp. 35 1 36 2018-07-02 Antti Koivisto <antti@apple.com> 2 37 -
trunk/Source/WebCore/platform/RuntimeApplicationChecks.cpp
r216903 r233461 47 47 } 48 48 49 #if !PLATFORM(WIN) 50 static WebKitProcessType s_webKitProcessType { WebKitProcessType::UIProcess }; 51 52 void setWebKitProcessType(WebKitProcessType type) 53 { 54 s_webKitProcessType = type; 55 } 56 57 bool isInNetworkProcess() 58 { 59 return s_webKitProcessType == WebKitProcessType::NetworkProcess; 60 } 61 62 bool isInStorageProcess() 63 { 64 return s_webKitProcessType == WebKitProcessType::StorageProcess; 65 } 66 67 bool isInWebProcess() 68 { 69 return s_webKitProcessType == WebKitProcessType::WebProcess; 70 } 71 #endif 72 49 73 int presentingApplicationPID() 50 74 { -
trunk/Source/WebCore/platform/RuntimeApplicationChecks.h
r232969 r233461 34 34 35 35 #if PLATFORM(WIN) 36 inline bool isInNetworkProcess() { return false; } 37 inline bool isInStorageProcess() { return false; } 36 38 inline bool isInWebProcess() { return false; } 37 #elif !PLATFORM(COCOA) 38 inline bool isInWebProcess() { return true; } 39 #else 40 enum class WebKitProcessType { UIProcess = 0, NetworkProcess, StorageProcess, WebProcess }; 41 WEBCORE_EXPORT void setWebKitProcessType(WebKitProcessType); 42 bool isInNetworkProcess(); 43 bool isInStorageProcess(); 44 bool isInWebProcess(); 39 45 #endif 40 46 41 47 #if PLATFORM(COCOA) 42 43 bool isInWebProcess();44 48 45 49 WEBCORE_EXPORT void setApplicationBundleIdentifier(const String&); -
trunk/Source/WebCore/platform/Timer.cpp
r229209 r233461 28 28 #include "Timer.h" 29 29 30 #include "Logging.h" 31 #include "RuntimeApplicationChecks.h" 30 32 #include "SharedTimer.h" 31 33 #include "ThreadGlobalData.h" … … 34 36 #include <limits> 35 37 #include <math.h> 38 #include <wtf/Compiler.h> 36 39 #include <wtf/MainThread.h> 37 40 #include <wtf/Vector.h> 41 42 #if USE(WEB_THREAD) 43 #include "WebCoreThread.h" 44 #endif 38 45 39 46 namespace WebCore { … … 187 194 TimerBase::TimerBase() 188 195 { 196 #if PLATFORM(IOS) 197 if (UNLIKELY(!isAllowed())) { 198 #define WEBCORE_TIMERBASE_ASSERTION_MESSAGE "WebCore::Timer should not be used in UI Process." 199 ASSERT_WITH_MESSAGE(false, WEBCORE_TIMERBASE_ASSERTION_MESSAGE); 200 RELEASE_LOG_FAULT(Threading, WEBCORE_TIMERBASE_ASSERTION_MESSAGE); 201 #undef WEBCORE_TIMERBASE_ASSERTION_MESSAGE 202 } 203 #endif 189 204 } 190 205 … … 241 256 if (inHeap()) 242 257 checkHeapIndex(); 258 } 259 260 bool TimerBase::isAllowed() 261 { 262 #if PLATFORM(IOS) 263 if (isInWebProcess() || isInNetworkProcess() || isInStorageProcess()) 264 return true; 265 266 #if USE(WEB_THREAD) 267 if (WebThreadIsEnabled() && (WebThreadIsCurrent() || WebThreadIsLocked())) 268 return true; 269 #endif 270 271 return false; 272 #else 273 return true; 274 #endif 243 275 } 244 276 -
trunk/Source/WebCore/platform/Timer.h
r233435 r233461 79 79 void checkHeapIndex() const; 80 80 81 static bool isAllowed(); 82 81 83 void setNextFireTime(MonotonicTime); 82 84 -
trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm
r233122 r233461 66 66 } 67 67 68 bool isInWebProcess()69 {70 static bool mainBundleIsWebProcess = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.WebKit.WebContent.Development"]71 || [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.WebKit.WebContent"]72 || [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.WebProcess"];73 return mainBundleIsWebProcess;74 }75 76 68 static bool applicationBundleIsEqualTo(const String& bundleIdentifierString) 77 69 { -
trunk/Source/WebKit/ChangeLog
r233460 r233461 1 2018-07-03 David Kilzer <ddkilzer@apple.com> 2 3 [iOS] Add assert to catch improper use of WebCore::Timer in UI Process 4 <https://webkit.org/b/185330> 5 <rdar://problem/32816079> 6 7 Reviewed by Darin Adler. 8 9 * NetworkProcess/NetworkProcess.cpp: 10 (WebKit::NetworkProcess::NetworkProcess): 11 * StorageProcess/StorageProcess.cpp: 12 (WebKit::StorageProcess::StorageProcess): 13 * WebProcess/WebProcess.cpp: 14 (WebKit::m_nonVisibleProcessCleanupTimer): 15 - Call setWebKitProcessType() to se the global for the current 16 process. 17 1 18 2018-07-03 Frederic Wang <fred.wang@free.fr> 2 19 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r233180 r233461 129 129 webProcessConnection->setOnLineState(isOnLine); 130 130 }); 131 132 WebCore::setWebKitProcessType(WebKitProcessType::NetworkProcess); 131 133 } 132 134 -
trunk/Source/WebKit/StorageProcess/StorageProcess.cpp
r232891 r233461 41 41 #include <WebCore/IDBKeyData.h> 42 42 #include <WebCore/NotImplemented.h> 43 #include <WebCore/RuntimeApplicationChecks.h> 43 44 #include <WebCore/SWServerWorker.h> 44 45 #include <WebCore/SecurityOrigin.h> … … 73 74 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=135365 - Need a more explicit way of doing this besides accessing the UTF8Encoding. 74 75 UTF8Encoding(); 76 77 WebCore::setWebKitProcessType(WebKitProcessType::StorageProcess); 75 78 } 76 79 -
trunk/Source/WebKit/WebProcess/WebProcess.cpp
r233162 r233461 210 210 211 211 Gigacage::disableDisablingPrimitiveGigacageIfShouldBeEnabled(); 212 213 WebCore::setWebKitProcessType(WebKitProcessType::WebProcess); 212 214 } 213 215
Note: See TracChangeset
for help on using the changeset viewer.