⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 280600 in webkit


Ignore:
Timestamp:
Aug 3, 2021, 10:05:15 AM (5 years ago)
Author:
youenn@apple.com
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):

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r280559 r280600  
     12021-08-03  Youenn Fablet  <youenn@apple.com>
     2
     3        RealtimeMediaSource::audioSamplesAvailable is calling malloc as part of locking in audio thread
     4        https://bugs.webkit.org/show_bug.cgi?id=228688
     5
     6        Reviewed by Eric Carlson.
     7
     8        Allow allocations in lockSlow since allocations might happen in rare case and not for each lockSlow call.
     9
     10        * wtf/Lock.cpp:
     11        (WTF::Lock::lockSlow):
     12        (WTF::Lock::unlockSlow):
     13        (WTF::Lock::unlockFairlySlow):
     14
    1152021-08-02  Ryosuke Niwa  <rniwa@webkit.org>
    216
  • trunk/Source/WTF/wtf/Lock.cpp

    r278257 r280600  
    4444    if (profileLockContention)
    4545        STACK_SHOT_PROFILE(4, 2, 5);
     46
     47    // Heap allocations are forbidden on certain threads (e.g. audio rendering thread) for performance reasons so we need to
     48    // explicitly allow the following allocation(s). In some rare cases, the lockSlow() algorithm may cause allocations.
     49    DisableMallocRestrictionsForCurrentThreadScope disableMallocRestrictions;
     50
    4651    DefaultLockAlgorithm::lockSlow(m_byte);
    4752}
     
    4954void Lock::unlockSlow()
    5055{
    51     // Heap allocations are forbidden on the certain threads (e.g. audio rendering thread) for performance reasons so we need to
    52     // explicitly allow the following allocation(s). In some rare cases, the unlockSlow() algorith may cause allocations.
     56    // Heap allocations are forbidden on certain threads (e.g. audio rendering thread) for performance reasons so we need to
     57    // explicitly allow the following allocation(s). In some rare cases, the unlockSlow() algorithm may cause allocations.
    5358    DisableMallocRestrictionsForCurrentThreadScope disableMallocRestrictions;
    5459
     
    5863void Lock::unlockFairlySlow()
    5964{
    60     // Heap allocations are forbidden on the certain threads (e.g. audio rendering thread) for performance reasons so we need to
    61     // explicitly allow the following allocation(s). In some rare cases, the unlockSlow() algorith may cause allocations.
     65    // Heap allocations are forbidden on certain threads (e.g. audio rendering thread) for performance reasons so we need to
     66    // explicitly allow the following allocation(s). In some rare cases, the unlockSlow() algorithm may cause allocations.
    6267    DisableMallocRestrictionsForCurrentThreadScope disableMallocRestrictions;
    6368
Note: See TracChangeset for help on using the changeset viewer.