Title: [188147] trunk/Source/_javascript_Core
Revision
188147
Author
[email protected]
Date
2015-08-07 12:34:13 -0700 (Fri, 07 Aug 2015)

Log 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:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (188146 => 188147)


--- trunk/Source/_javascript_Core/ChangeLog	2015-08-07 19:09:59 UTC (rev 188146)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-08-07 19:34:13 UTC (rev 188147)
@@ -1,3 +1,22 @@
+2015-08-07  Mark Lam  <[email protected]>
+
+        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:
+
 2015-08-07  Saam barati  <[email protected]>
 
         Interpreter::unwind shouldn't be responsible for assigning the correct scope.

Modified: trunk/Source/_javascript_Core/runtime/Watchdog.cpp (188146 => 188147)


--- trunk/Source/_javascript_Core/runtime/Watchdog.cpp	2015-08-07 19:09:59 UTC (rev 188146)
+++ trunk/Source/_javascript_Core/runtime/Watchdog.cpp	2015-08-07 19:34:13 UTC (rev 188147)
@@ -37,9 +37,9 @@
 Watchdog::Watchdog()
     : m_timerDidFire(false)
     , m_didFire(false)
-    , m_limit(NO_LIMIT)
-    , m_startTime(0)
-    , m_elapsedTime(0)
+    , m_timeoutPeriod(NO_LIMIT)
+    , m_startCPUTime(0)
+    , m_elapsedCPUTime(0)
     , m_reentryCount(0)
     , m_isStopped(true)
     , m_callback(0)
@@ -66,7 +66,7 @@
 
     m_didFire = false; // Reset the watchdog.
 
-    m_limit = limit;
+    m_timeoutPeriod = limit;
     m_callback = callback;
     m_callbackData1 = data1;
     m_callbackData2 = data2;
@@ -98,9 +98,9 @@
     stopCountdown();
 
     auto currentTime = currentCPUTime();
-    auto deltaTime = currentTime - m_startTime;
-    auto totalElapsedTime = m_elapsedTime + deltaTime;
-    if (totalElapsedTime > m_limit) {
+    auto deltaCPUTime = currentTime - m_startCPUTime;
+    auto totalElapsedCPUTime = m_elapsedCPUTime + deltaCPUTime;
+    if (totalElapsedCPUTime > m_timeoutPeriod) {
         // Case 1: the allowed CPU time has elapsed.
 
         // If m_callback is not set, then we terminate by default.
@@ -121,10 +121,10 @@
 
         // Tell the timer to alarm us again when it thinks we've reached the
         // end of the allowed time.
-        auto remainingTime = m_limit - totalElapsedTime;
-        m_elapsedTime = totalElapsedTime;
-        m_startTime = currentTime;
-        startCountdown(remainingTime);
+        auto remainingCPUTime = m_timeoutPeriod - totalElapsedCPUTime;
+        m_elapsedCPUTime = totalElapsedCPUTime;
+        m_startCPUTime = currentTime;
+        startCountdown(remainingCPUTime);
     }
 
     return false;
@@ -132,7 +132,7 @@
 
 bool Watchdog::isEnabled()
 {
-    return (m_limit != NO_LIMIT);
+    return (m_timeoutPeriod != NO_LIMIT);
 }
 
 void Watchdog::fire()
@@ -164,9 +164,9 @@
         return; // Not executing JS script. No need to start.
 
     if (isEnabled()) {
-        m_elapsedTime = std::chrono::microseconds::zero();
-        m_startTime = currentCPUTime();
-        startCountdown(m_limit);
+        m_elapsedCPUTime = std::chrono::microseconds::zero();
+        m_startCPUTime = currentCPUTime();
+        startCountdown(m_timeoutPeriod);
     }
 }
 

Modified: trunk/Source/_javascript_Core/runtime/Watchdog.h (188146 => 188147)


--- trunk/Source/_javascript_Core/runtime/Watchdog.h	2015-08-07 19:09:59 UTC (rev 188146)
+++ trunk/Source/_javascript_Core/runtime/Watchdog.h	2015-08-07 19:34:13 UTC (rev 188147)
@@ -82,9 +82,9 @@
     bool m_timerDidFire;
     bool m_didFire;
 
-    std::chrono::microseconds m_limit;
-    std::chrono::microseconds m_startTime;
-    std::chrono::microseconds m_elapsedTime;
+    std::chrono::microseconds m_timeoutPeriod;
+    std::chrono::microseconds m_startCPUTime;
+    std::chrono::microseconds m_elapsedCPUTime;
 
     int m_reentryCount;
     bool m_isStopped;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to