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

Changeset 244352 in webkit


Ignore:
Timestamp:
Apr 16, 2019, 12:46:27 PM (7 years ago)
Author:
rmorisset@apple.com
Message:

[WTF] holdLock should be marked WARN_UNUSED_RETURN
https://bugs.webkit.org/show_bug.cgi?id=196922

Reviewed by Keith Miller.

Source/JavaScriptCore:

There was one case where holdLock was used and the result ignored.
From a comment that was deleted in https://bugs.webkit.org/attachment.cgi?id=328438&action=prettypatch, I believe that it is on purpose.
So I brought back a variant of the comment, and made the ignoring of the return explicit.

  • heap/BlockDirectory.cpp:

(JSC::BlockDirectory::isPagedOut):

Source/WTF:

  • wtf/Locker.h:
Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r244330 r244352  
     12019-04-16  Robin Morisset  <rmorisset@apple.com>
     2
     3        [WTF] holdLock should be marked WARN_UNUSED_RETURN
     4        https://bugs.webkit.org/show_bug.cgi?id=196922
     5
     6        Reviewed by Keith Miller.
     7
     8        There was one case where holdLock was used and the result ignored.
     9        From a comment that was deleted in https://bugs.webkit.org/attachment.cgi?id=328438&action=prettypatch, I believe that it is on purpose.
     10        So I brought back a variant of the comment, and made the ignoring of the return explicit.
     11
     12        * heap/BlockDirectory.cpp:
     13        (JSC::BlockDirectory::isPagedOut):
     14
    1152019-04-16  Caitlin Potter  <caitp@igalia.com>
    216
  • trunk/Source/JavaScriptCore/heap/BlockDirectory.cpp

    r242912 r244352  
    6262    unsigned itersSinceLastTimeCheck = 0;
    6363    for (auto* block : m_blocks) {
    64         if (block)
    65             holdLock(block->block().lock());
     64        if (block) {
     65            // We take and drop the lock as a way of touching that page of memory.
     66            // FIXME: should we instead do a cheaper thing like a volatile load in the page?
     67            (void) holdLock(block->block().lock());
     68        }
    6669        ++itersSinceLastTimeCheck;
    6770        if (itersSinceLastTimeCheck >= Heap::s_timeCheckResolution) {
  • trunk/Source/WTF/ChangeLog

    r244349 r244352  
     12019-04-16  Robin Morisset  <rmorisset@apple.com>
     2
     3        [WTF] holdLock should be marked WARN_UNUSED_RETURN
     4        https://bugs.webkit.org/show_bug.cgi?id=196922
     5
     6        Reviewed by Keith Miller.
     7
     8        * wtf/Locker.h:
     9
    1102019-04-16  Don Olmstead  <don.olmstead@sony.com>
    211
  • trunk/Source/WTF/wtf/Locker.h

    r237099 r244352  
    3131#include <wtf/Assertions.h>
    3232#include <wtf/Atomics.h>
     33#include <wtf/Compiler.h>
    3334#include <wtf/Noncopyable.h>
    3435
     
    120121// auto locker = holdLock(lock);
    121122template<typename LockType>
     123Locker<LockType> holdLock(LockType&) WARN_UNUSED_RETURN;
     124template<typename LockType>
    122125Locker<LockType> holdLock(LockType& lock)
    123126{
     
    126129
    127130template<typename LockType>
     131Locker<LockType> holdLockIf(LockType&, bool predicate) WARN_UNUSED_RETURN;
     132template<typename LockType>
    128133Locker<LockType> holdLockIf(LockType& lock, bool predicate)
    129134{
     
    131136}
    132137
     138template<typename LockType>
     139Locker<LockType> tryHoldLock(LockType&) WARN_UNUSED_RETURN;
    133140template<typename LockType>
    134141Locker<LockType> tryHoldLock(LockType& lock)
Note: See TracChangeset for help on using the changeset viewer.