Title: [256678] branches/safari-609-branch/Source/WebCore
Revision
256678
Author
repst...@apple.com
Date
2020-02-14 19:01:54 -0800 (Fri, 14 Feb 2020)

Log Message

Cherry-pick r256474. rdar://problem/59446973

    Web Inspector: inspector/cpu-profiler/threads.html is flaky crashing
    https://bugs.webkit.org/show_bug.cgi?id=207588
    <rdar://problem/57458123>

    Reviewed by Yusuke Suzuki.

    * page/cocoa/ResourceUsageThreadCocoa.mm:
    (WebCore::ResourceUsageThread::platformCollectCPUData):
    Use a fence to force Thread to be completely ready for use by other threads
    prior to storing it. Otherwise, ResourceUsageThread may see it too early.

    * workers/WorkerThread.cpp:
    (WebCore::WorkerThread::start): Ignore worker threads that are
    not fully initialized.

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

Modified Paths

Diff

Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (256677 => 256678)


--- branches/safari-609-branch/Source/WebCore/ChangeLog	2020-02-15 03:01:52 UTC (rev 256677)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog	2020-02-15 03:01:54 UTC (rev 256678)
@@ -1,5 +1,44 @@
 2020-02-14  Russell Epstein  <repst...@apple.com>
 
+        Cherry-pick r256474. rdar://problem/59446973
+
+    Web Inspector: inspector/cpu-profiler/threads.html is flaky crashing
+    https://bugs.webkit.org/show_bug.cgi?id=207588
+    <rdar://problem/57458123>
+    
+    Reviewed by Yusuke Suzuki.
+    
+    * page/cocoa/ResourceUsageThreadCocoa.mm:
+    (WebCore::ResourceUsageThread::platformCollectCPUData):
+    Use a fence to force Thread to be completely ready for use by other threads
+    prior to storing it. Otherwise, ResourceUsageThread may see it too early.
+    
+    * workers/WorkerThread.cpp:
+    (WebCore::WorkerThread::start): Ignore worker threads that are
+    not fully initialized.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256474 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-02-12  Brian Burg  <bb...@apple.com>
+
+            Web Inspector: inspector/cpu-profiler/threads.html is flaky crashing
+            https://bugs.webkit.org/show_bug.cgi?id=207588
+            <rdar://problem/57458123>
+
+            Reviewed by Yusuke Suzuki.
+
+            * page/cocoa/ResourceUsageThreadCocoa.mm:
+            (WebCore::ResourceUsageThread::platformCollectCPUData):
+            Use a fence to force Thread to be completely ready for use by other threads
+            prior to storing it. Otherwise, ResourceUsageThread may see it too early.
+
+            * workers/WorkerThread.cpp:
+            (WebCore::WorkerThread::start): Ignore worker threads that are
+            not fully initialized.
+
+2020-02-14  Russell Epstein  <repst...@apple.com>
+
         Cherry-pick r256470. rdar://problem/59446998
 
     ServiceWorkerContainer::jobResolvedWithRegistration scopeExit should capture all lambda parameters by value

Modified: branches/safari-609-branch/Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm (256677 => 256678)


--- branches/safari-609-branch/Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm	2020-02-15 03:01:52 UTC (rev 256677)
+++ branches/safari-609-branch/Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm	2020-02-15 03:01:54 UTC (rev 256678)
@@ -168,6 +168,9 @@
     {
         LockHolder lock(WorkerThread::workerThreadsMutex());
         for (auto* thread : WorkerThread::workerThreads(lock)) {
+            // Ignore worker threads that have not been fully started yet.
+            if (!thread->thread())
+                continue;
             mach_port_t machThread = thread->thread()->machThread();
             if (machThread != MACH_PORT_NULL)
                 knownWorkerThreads.set(machThread, thread->identifier().isolatedCopy());

Modified: branches/safari-609-branch/Source/WebCore/workers/WorkerThread.cpp (256677 => 256678)


--- branches/safari-609-branch/Source/WebCore/workers/WorkerThread.cpp	2020-02-15 03:01:52 UTC (rev 256677)
+++ branches/safari-609-branch/Source/WebCore/workers/WorkerThread.cpp	2020-02-15 03:01:54 UTC (rev 256678)
@@ -143,9 +143,12 @@
 
     m_evaluateCallback = WTFMove(evaluateCallback);
 
-    m_thread = Thread::create(isServiceWorkerThread() ? "WebCore: Service Worker" : "WebCore: Worker", [this] {
+    Ref<Thread> thread = Thread::create(isServiceWorkerThread() ? "WebCore: Service Worker" : "WebCore: Worker", [this] {
         workerThread();
     });
+    // Force the Thread object to be initialized fully before storing it to m_thread (and becoming visible to other threads).
+    WTF::storeStoreFence();
+    m_thread = WTFMove(thread);
 }
 
 void WorkerThread::workerThread()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to