Title: [280600] trunk/Source/WTF
Revision
280600
Author
you...@apple.com
Date
2021-08-03 10:05:15 -0700 (Tue, 03 Aug 2021)

Log Message

RealtimeMediaSource::audioSamplesAvailable is calling malloc as part of locking in audio thread
https://bugs.webkit.org/show_bug.cgi?id=228688

Reviewed by Eric Carlson.

Allow allocations in lockSlow since allocations might happen in rare case and not for each lockSlow call.

* wtf/Lock.cpp:
(WTF::Lock::lockSlow):
(WTF::Lock::unlockSlow):
(WTF::Lock::unlockFairlySlow):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (280599 => 280600)


--- trunk/Source/WTF/ChangeLog	2021-08-03 16:54:57 UTC (rev 280599)
+++ trunk/Source/WTF/ChangeLog	2021-08-03 17:05:15 UTC (rev 280600)
@@ -1,3 +1,17 @@
+2021-08-03  Youenn Fablet  <you...@apple.com>
+
+        RealtimeMediaSource::audioSamplesAvailable is calling malloc as part of locking in audio thread
+        https://bugs.webkit.org/show_bug.cgi?id=228688
+
+        Reviewed by Eric Carlson.
+
+        Allow allocations in lockSlow since allocations might happen in rare case and not for each lockSlow call.
+
+        * wtf/Lock.cpp:
+        (WTF::Lock::lockSlow):
+        (WTF::Lock::unlockSlow):
+        (WTF::Lock::unlockFairlySlow):
+
 2021-08-02  Ryosuke Niwa  <rn...@webkit.org>
 
         Add CheckedRef

Modified: trunk/Source/WTF/wtf/Lock.cpp (280599 => 280600)


--- trunk/Source/WTF/wtf/Lock.cpp	2021-08-03 16:54:57 UTC (rev 280599)
+++ trunk/Source/WTF/wtf/Lock.cpp	2021-08-03 17:05:15 UTC (rev 280600)
@@ -43,13 +43,18 @@
 {
     if (profileLockContention)
         STACK_SHOT_PROFILE(4, 2, 5);
+
+    // Heap allocations are forbidden on certain threads (e.g. audio rendering thread) for performance reasons so we need to
+    // explicitly allow the following allocation(s). In some rare cases, the lockSlow() algorithm may cause allocations.
+    DisableMallocRestrictionsForCurrentThreadScope disableMallocRestrictions;
+
     DefaultLockAlgorithm::lockSlow(m_byte);
 }
 
 void Lock::unlockSlow()
 {
-    // Heap allocations are forbidden on the certain threads (e.g. audio rendering thread) for performance reasons so we need to
-    // explicitly allow the following allocation(s). In some rare cases, the unlockSlow() algorith may cause allocations.
+    // Heap allocations are forbidden on certain threads (e.g. audio rendering thread) for performance reasons so we need to
+    // explicitly allow the following allocation(s). In some rare cases, the unlockSlow() algorithm may cause allocations.
     DisableMallocRestrictionsForCurrentThreadScope disableMallocRestrictions;
 
     DefaultLockAlgorithm::unlockSlow(m_byte, DefaultLockAlgorithm::Unfair);
@@ -57,8 +62,8 @@
 
 void Lock::unlockFairlySlow()
 {
-    // Heap allocations are forbidden on the certain threads (e.g. audio rendering thread) for performance reasons so we need to
-    // explicitly allow the following allocation(s). In some rare cases, the unlockSlow() algorith may cause allocations.
+    // Heap allocations are forbidden on certain threads (e.g. audio rendering thread) for performance reasons so we need to
+    // explicitly allow the following allocation(s). In some rare cases, the unlockSlow() algorithm may cause allocations.
     DisableMallocRestrictionsForCurrentThreadScope disableMallocRestrictions;
 
     DefaultLockAlgorithm::unlockSlow(m_byte, DefaultLockAlgorithm::Fair);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to