USE(WEB_THREAD): More explicit WebThread initialization
[WebKit-https.git] / Source / WTF / wtf / mac / MainThreadMac.mm
index cc3fee965e5a880d8209b9524400f41b4627866a..857c7043c39fdd61a936c090774e2bffb6de4979 100644 (file)
@@ -73,9 +73,15 @@ void initializeMainThreadPlatform()
     staticMainThreadCaller = [[JSWTFMainThreadCaller alloc] init];
 
     mainThreadEstablishedAsPthreadMain = false;
+
+#if !USE(WEB_THREAD)
     mainThreadPthread = pthread_self();
     mainThreadNSThread = [[NSThread currentThread] retain];
-    
+#else
+    ASSERT(!mainThreadPthread);
+    ASSERT(!mainThreadNSThread);
+#endif
+
     initializeGCThreads();
 }
 
@@ -136,7 +142,6 @@ void scheduleDispatchFunctionsOnMainThread()
 #if USE(WEB_THREAD)
 bool isMainThread()
 {
-    ASSERT(!mainThreadEstablishedAsPthreadMain);
     return (isWebThread() || pthread_main_np()) && WebCoreWebThreadIsLockedOrDisabled();
 }
 
@@ -162,6 +167,15 @@ void initializeWebThreadIdentifier()
     sWebThreadIdentifier = currentThread();
 }
 
+void initializeWebThreadPlatform()
+{
+    ASSERT(!pthread_main_np());
+
+    mainThreadEstablishedAsPthreadMain = false;
+    mainThreadPthread = pthread_self();
+    mainThreadNSThread = [[NSThread currentThread] retain];
+}
+
 bool canAccessThreadLocalDataForThread(ThreadIdentifier threadId)
 {
     ThreadIdentifier currentThreadId = currentThread();