Changeset 188147 in webkit


Ignore:
Timestamp:
Aug 7, 2015 12:34:13 PM (9 years ago)
Author:
mark.lam@apple.com
Message:

Rename some variables in the JSC watchdog implementation.
https://bugs.webkit.org/show_bug.cgi?id=147790

Rubber stamped by Benjamin Poulain.

This is just a refactoring patch to give the variable better names that describe their
intended use. There is no behavior change.

  • runtime/Watchdog.cpp:

(JSC::Watchdog::Watchdog):
(JSC::Watchdog::setTimeLimit):
(JSC::Watchdog::didFire):
(JSC::Watchdog::isEnabled):
(JSC::Watchdog::fire):
(JSC::Watchdog::startCountdownIfNeeded):

  • runtime/Watchdog.h:
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r188144 r188147  
     12015-08-07  Mark Lam  <mark.lam@apple.com>
     2
     3        Rename some variables in the JSC watchdog implementation.
     4        https://bugs.webkit.org/show_bug.cgi?id=147790
     5
     6        Rubber stamped by Benjamin Poulain.
     7
     8        This is just a refactoring patch to give the variable better names that describe their
     9        intended use.  There is no behavior change.
     10
     11        * runtime/Watchdog.cpp:
     12        (JSC::Watchdog::Watchdog):
     13        (JSC::Watchdog::setTimeLimit):
     14        (JSC::Watchdog::didFire):
     15        (JSC::Watchdog::isEnabled):
     16        (JSC::Watchdog::fire):
     17        (JSC::Watchdog::startCountdownIfNeeded):
     18        * runtime/Watchdog.h:
     19
    1202015-08-07  Saam barati  <saambarati1@gmail.com>
    221
  • trunk/Source/JavaScriptCore/runtime/Watchdog.cpp

    r176973 r188147  
    3838    : m_timerDidFire(false)
    3939    , m_didFire(false)
    40     , m_limit(NO_LIMIT)
    41     , m_startTime(0)
    42     , m_elapsedTime(0)
     40    , m_timeoutPeriod(NO_LIMIT)
     41    , m_startCPUTime(0)
     42    , m_elapsedCPUTime(0)
    4343    , m_reentryCount(0)
    4444    , m_isStopped(true)
     
    6767    m_didFire = false; // Reset the watchdog.
    6868
    69     m_limit = limit;
     69    m_timeoutPeriod = limit;
    7070    m_callback = callback;
    7171    m_callbackData1 = data1;
     
    9999
    100100    auto currentTime = currentCPUTime();
    101     auto deltaTime = currentTime - m_startTime;
    102     auto totalElapsedTime = m_elapsedTime + deltaTime;
    103     if (totalElapsedTime > m_limit) {
     101    auto deltaCPUTime = currentTime - m_startCPUTime;
     102    auto totalElapsedCPUTime = m_elapsedCPUTime + deltaCPUTime;
     103    if (totalElapsedCPUTime > m_timeoutPeriod) {
    104104        // Case 1: the allowed CPU time has elapsed.
    105105
     
    122122        // Tell the timer to alarm us again when it thinks we've reached the
    123123        // end of the allowed time.
    124         auto remainingTime = m_limit - totalElapsedTime;
    125         m_elapsedTime = totalElapsedTime;
    126         m_startTime = currentTime;
    127         startCountdown(remainingTime);
     124        auto remainingCPUTime = m_timeoutPeriod - totalElapsedCPUTime;
     125        m_elapsedCPUTime = totalElapsedCPUTime;
     126        m_startCPUTime = currentTime;
     127        startCountdown(remainingCPUTime);
    128128    }
    129129
     
    133133bool Watchdog::isEnabled()
    134134{
    135     return (m_limit != NO_LIMIT);
     135    return (m_timeoutPeriod != NO_LIMIT);
    136136}
    137137
     
    165165
    166166    if (isEnabled()) {
    167         m_elapsedTime = std::chrono::microseconds::zero();
    168         m_startTime = currentCPUTime();
    169         startCountdown(m_limit);
     167        m_elapsedCPUTime = std::chrono::microseconds::zero();
     168        m_startCPUTime = currentCPUTime();
     169        startCountdown(m_timeoutPeriod);
    170170    }
    171171}
  • trunk/Source/JavaScriptCore/runtime/Watchdog.h

    r187587 r188147  
    8383    bool m_didFire;
    8484
    85     std::chrono::microseconds m_limit;
    86     std::chrono::microseconds m_startTime;
    87     std::chrono::microseconds m_elapsedTime;
     85    std::chrono::microseconds m_timeoutPeriod;
     86    std::chrono::microseconds m_startCPUTime;
     87    std::chrono::microseconds m_elapsedCPUTime;
    8888
    8989    int m_reentryCount;
Note: See TracChangeset for help on using the changeset viewer.